]> Dogcows Code - chaz/tar/blob - tests/star/quicktest.sh
Added to the repository
[chaz/tar] / tests / star / quicktest.sh
1 #! /bin/sh
2 # This file is part of GNU tar testsuite.
3 # Copyright (C) 2004 Free Software Foundation, Inc.
4 #
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 2, or (at your option)
8 # any later version.
9 #
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.
14 #
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., 59 Temple Place - Suite 330, Boston, MA
18 # 02111-1307, USA.
19
20 # Usage: quicktest FILELIST ARCHIVE-NAME
21 quicktest() {
22 DIR=quicktest.$$
23 mkdir $DIR
24 cd $DIR
25
26 TAR_OPTIONS=""
27 export TAR_OPTIONS
28
29 tar xf $2
30 tar -cf ../archive -H ustar -T $1
31 cd ..
32
33 ${TARTEST:-tartest} -v < $2 > $DIR/old.out
34 ${TARTEST:-tartest} -v < archive > $DIR/new.out
35
36 if cmp $DIR/old.out $DIR/new.out; then
37 echo "PASS"
38 rm -r $DIR
39 exit 0
40 else
41 echo "FAIL. Examine $DIR for details"
42 exit 1
43 fi
44 }
45
46 test_access() {
47 if [ -r $1 ]; then
48 :
49 else
50 echo "$1 does not exist or is unreadable"
51 echo 77
52 fi
53 }
54
55 check_environ() {
56 if [ "$STAR_TESTSCRIPTS" = "" ]; then
57 echo "STAR_TESTSCRIPTS not set"
58 exit 77
59 fi
60
61 if [ -d $STAR_TESTSCRIPTS ]; then
62 :
63 else
64 echo "STAR_TESTSCRIPTS is not a directory"
65 exit 77
66 fi
67
68 ARCHIVE=$STAR_TESTSCRIPTS/ustar-all-quicktest.tar
69 test_access $ARCHIVE
70 FILELIST=$STAR_TESTSCRIPTS/quicktest.filelist
71 test_access $FILELIST
72
73 ${TARTEST:-tartest} < /dev/null > /dev/null 2>&1
74 if [ $? -eq 127 ]; then
75 echo "tartest not in your path"
76 exit 77
77 fi
78 }
79
80 getargs() {
81 for option
82 do
83 case $option in
84 *=*) eval $option;;
85 *) echo "Unknown option: $option" >&2
86 exit 77;;
87 esac
88 done
89 }
90
91 if [ -w / ]; then
92 getargs $*
93 check_environ
94 quicktest $FILELIST $ARCHIVE
95 else
96 echo "You need to be root to run this test"
97 exit 77
98 fi
99
100 # End of quicktest.sh
This page took 0.043171 seconds and 5 git commands to generate.