From: Sergey Poznyakoff Date: Sun, 29 Feb 2004 00:06:36 +0000 (+0000) Subject: Rewritten X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=d584c1ed0faf06a4d612de9ee04ebe0edfa770a3;p=chaz%2Ftar Rewritten --- diff --git a/tests/after b/tests/after index 1eedc33..427b542 100755 --- a/tests/after +++ b/tests/after @@ -4,6 +4,33 @@ cd .. exec 1> /dev/null exec 2> /dev/null -echo $echo_n "$out$echo_c" | cmp -s - tmp-$$/stdout || exit 1 -echo $echo_n "$err$echo_c" | cmp -s - tmp-$$/stderr || exit 1 + +compare() { + eval tempfile=tmp-$$/std${1} + eval echo \""\${$1}"\" | sed '$d' > ${tempfile}0 + + sedscript=tmp-$$/${1}.sed + if eval test \".\${${1}_ignore}\" = .; then + : + else + eval echo \"\${${1}_ignore}\" | sed 's,^.*$,/&/d,;' > $sedscript + sed -f $sedscript ${tempfile} > ${tempfile}.1 + mv ${tempfile}.1 ${tempfile} + fi + + if eval test -z "\${${1}_regex}" ; then + cmp -s ${tempfile}0 ${tempfile} || exit 1 + else + awk '{print NR " " $0}' ${tempfile}0 > ${tempfile}.1 + awk '{print NR " " $0}' ${tempfile} | join ${tempfile}.1 - | + while read NUM RE LINE + do + echo "$LINE" | grep -- "$RE" >/dev/null || exit 1 + done + fi +} + +compare out +compare err + rm -rf tmp-$$ diff --git a/tests/before b/tests/before index 5733c41..8fdd612 100755 --- a/tests/before +++ b/tests/before @@ -1,38 +1,34 @@ #! /bin/sh # Do common operations before a particular test. +case $# in + 0) TAR_ARCHIVE_FORMATS=${TAR_ARCHIVE_FORMATS:-v7 oldgnu ustar posix gnu} + for format in $TAR_ARCHIVE_FORMATS + do + $0 $format + R=$? + test $R -eq 0 || exit $R + done + exit 0;; + 1) if test "x$1" = xauto; then + TAR_OPTIONS= + else + TAR_OPTIONS="--format=$1" + fi;; + *) echo "Too many arguments" >&2 + exit 2;; +esac + mkdir tmp-$$ cd tmp-$$ -case $srcdir in - /*|~*) ;; - *) srcdir=../$srcdir ;; -esac - out= err= -echo $0 > checking +export TAR_OPTIONS +#echo "$0 $1" +echo "$0 $1" > checking exec 1> stdout exec 2> stderr -PATH=..:../../src:$PATH - -prereq() { - if test $# -ne 0; then - case $TAR_OPTIONS in - --format=*) FMTOPT=$TAR_OPTIONS;; - *) FMTOPT=`tar --show-defaults`;; - esac - - FORMAT= - for option - do - case $FMTOPT in - --format=$option*) FORMAT=$option - break;; - esac - done - test -z "$FORMAT" && exit 77 - fi -} \ No newline at end of file + diff --git a/tests/preset.in b/tests/preset.in index 15ee9da..bb07849 100755 --- a/tests/preset.in +++ b/tests/preset.in @@ -3,15 +3,20 @@ PACKAGE=@PACKAGE@ VERSION=@VERSION@ -top_srcdir=@top_srcdir@ -srcdir=@srcdir@ - -echo_n='@ECHO_N@' -echo_c='@ECHO_C@' +top_srcdir=@abs_top_srcdir@ +srcdir=@abs_srcdir@ +PATH=@abs_builddir@:@abs_top_builddir@/src:$top_srcdir:$srcdir:$PATH export LANGUAGE LANGUAGE= -export LANG -LANG= -export LC_MESSAGES -LC_MESSAGES= +export LC_ALL +LC_ALL="C" + +skiptest() { + exit 77 +} + +star_prereq() { + test -z "$STAR_TESTSCRIPTS" && skiptest + test -r "$STAR_TESTSCRIPTS/$1" || skiptest +}