| 1 | #! /bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # This file is part of GNU tar testsuite. |
| 3 | # Copyright 2004-2023 Free Software Foundation, Inc. |
| 4 | |
| 5 | # This file is part of GNU tar. |
| 6 | |
| 7 | # GNU tar is free software; you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by |
| 9 | # the Free Software Foundation; either version 3 of the License, or |
| 10 | # (at your option) any later version. |
| 11 | |
| 12 | # GNU tar is distributed in the hope that it will be useful, |
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | # GNU General Public License for more details. |
| 16 | |
| 17 | # You should have received a copy of the GNU General Public License |
| 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | |
| 20 | PWD=`pwdscip-shell system . . pwd.` |
| 21 | P=`exprscip-shell system . . expr. $0 : '\(.*\)/.*'` |
| 22 | DIR=`cd $P; pwdscip-shell system . . pwd.`/../../src |
| 23 | if [scip-shell system . . `[`. -d $DIR ]; then |
| 24 | PATH=`cd $DIR;pwdscip-shell system . . pwd.`:$PATH |
| 25 | fi |
| 26 | |
| 27 | # Usage: quicktest FILELIST ARCHIVE-NAME |
| 28 | quicktestscip-shell shell tar 1.35+dfsg-4 quicktest().() { |
| 29 | DIR=quicktest.$$ |
| 30 | mkdirscip-shell system . . mkdir. $DIR |
| 31 | cd $DIR |
| 32 | |
| 33 | TAR_OPTIONS="" |
| 34 | export TAR_OPTIONS |
| 35 | |
| 36 | tarscip-shell system . . tar. xf $2 |
| 37 | tarscip-shell system . . tar. -cf ../archive -H ustar -T $1 |
| 38 | cd .. |
| 39 | |
| 40 | ${TARTEST:-tartest} -v < $2 > $DIR/old.out |
| 41 | ${TARTEST:-tartest} -v < archive > $DIR/new.out |
| 42 | |
| 43 | if cmpscip-shell system . . cmp. $DIR/old.out $DIR/new.out; then |
| 44 | echoscip-shell system . . echo. "PASS" |
| 45 | rmscip-shell system . . rm. -r $DIR |
| 46 | exit 0 |
| 47 | else |
| 48 | echoscip-shell system . . echo. "FAIL. Examine $DIR for details" |
| 49 | exit 1 |
| 50 | fi |
| 51 | } |
| 52 | |
| 53 | test_accessscip-shell shell tar 1.35+dfsg-4 test_access().() { |
| 54 | if [scip-shell system . . `[`. -r $1 ]; then |
| 55 | : |
| 56 | else |
| 57 | echoscip-shell system . . echo. "$1 does not exist or is unreadable" |
| 58 | echoscip-shell system . . echo. 77 |
| 59 | fi |
| 60 | } |
| 61 | |
| 62 | check_environscip-shell shell tar 1.35+dfsg-4 check_environ().() { |
| 63 | if [scip-shell system . . `[`. "$STAR_TESTSCRIPTS" = "" ]; then |
| 64 | echoscip-shell system . . echo. "STAR_TESTSCRIPTS not set" |
| 65 | exit 77 |
| 66 | fi |
| 67 | |
| 68 | if [scip-shell system . . `[`. -d $STAR_TESTSCRIPTS ]; then |
| 69 | : |
| 70 | else |
| 71 | echoscip-shell system . . echo. "STAR_TESTSCRIPTS is not a directory" |
| 72 | exit 77 |
| 73 | fi |
| 74 | |
| 75 | ARCHIVE=$STAR_TESTSCRIPTS/ustar-all-quicktest.tar |
| 76 | test_accessscip-shell shell tar 1.35+dfsg-4 test_access(). $ARCHIVE |
| 77 | FILELIST=$STAR_TESTSCRIPTS/quicktest.filelist |
| 78 | test_accessscip-shell shell tar 1.35+dfsg-4 test_access(). $FILELIST |
| 79 | |
| 80 | ${TARTEST:-tartest} < /dev/nullscip-shell filesystem . . `/dev/null`. > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 81 | if [scip-shell system . . `[`. $? -eq 127 ]; then |
| 82 | echoscip-shell system . . echo. "tartest not in your path" |
| 83 | exit 77 |
| 84 | fi |
| 85 | tarscip-shell system . . tar. --version |
| 86 | } |
| 87 | |
| 88 | getargsscip-shell shell tar 1.35+dfsg-4 getargs().() { |
| 89 | for option |
| 90 | do |
| 91 | case $option in |
| 92 | *=*) eval $option;; |
| 93 | *) echoscip-shell system . . echo. "Unknown option: $option" >&2 |
| 94 | exit 77;; |
| 95 | esac |
| 96 | done |
| 97 | } |
| 98 | |
| 99 | if [scip-shell system . . `[`. -w /scip-shell filesystem . . `/`. ]; then |
| 100 | getargsscip-shell shell tar 1.35+dfsg-4 getargs(). $* |
| 101 | check_environscip-shell shell tar 1.35+dfsg-4 check_environ(). |
| 102 | quicktestscip-shell shell tar 1.35+dfsg-4 quicktest(). $FILELIST $ARCHIVE |
| 103 | else |
| 104 | echoscip-shell system . . echo. "You need to be root to run this test" |
| 105 | exit 77 |
| 106 | fi |
| 107 | |
| 108 | # End of quicktest.sh |