Support for POSIX ACLs
[tar.git] / tests / star / quicktest.sh
blobcbc65112bd8fab70870209d92787668115be79b0
1 #! /bin/sh
2 # This file is part of GNU tar testsuite.
3 # Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3, or (at your option)
8 # any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 # 02110-1301, USA.
20 PWD=`pwd`
21 P=`expr $0 : '\(.*\)/.*'`
22 DIR=`cd $P; pwd`/../../src
23 if [ -d $DIR ]; then
24 PATH=`cd $DIR;pwd`:$PATH
27 # Usage: quicktest FILELIST ARCHIVE-NAME
28 quicktest() {
29 DIR=quicktest.$$
30 mkdir $DIR
31 cd $DIR
33 TAR_OPTIONS=""
34 export TAR_OPTIONS
36 tar xf $2
37 tar -cf ../archive -H ustar -T $1
38 cd ..
40 ${TARTEST:-tartest} -v < $2 > $DIR/old.out
41 ${TARTEST:-tartest} -v < archive > $DIR/new.out
43 if cmp $DIR/old.out $DIR/new.out; then
44 echo "PASS"
45 rm -r $DIR
46 exit 0
47 else
48 echo "FAIL. Examine $DIR for details"
49 exit 1
53 test_access() {
54 if [ -r $1 ]; then
56 else
57 echo "$1 does not exist or is unreadable"
58 echo 77
62 check_environ() {
63 if [ "$STAR_TESTSCRIPTS" = "" ]; then
64 echo "STAR_TESTSCRIPTS not set"
65 exit 77
68 if [ -d $STAR_TESTSCRIPTS ]; then
70 else
71 echo "STAR_TESTSCRIPTS is not a directory"
72 exit 77
75 ARCHIVE=$STAR_TESTSCRIPTS/ustar-all-quicktest.tar
76 test_access $ARCHIVE
77 FILELIST=$STAR_TESTSCRIPTS/quicktest.filelist
78 test_access $FILELIST
80 ${TARTEST:-tartest} < /dev/null > /dev/null 2>&1
81 if [ $? -eq 127 ]; then
82 echo "tartest not in your path"
83 exit 77
85 tar --version
88 getargs() {
89 for option
91 case $option in
92 *=*) eval $option;;
93 *) echo "Unknown option: $option" >&2
94 exit 77;;
95 esac
96 done
99 if [ -w / ]; then
100 getargs $*
101 check_environ
102 quicktest $FILELIST $ARCHIVE
103 else
104 echo "You need to be root to run this test"
105 exit 77
108 # End of quicktest.sh