commit b439cedfda5e68ab1819a1750d8ab05437b66c4e parent ee4724712b13bdcf59782386612e9fcda8977a3a Author: Roberto E. Vargas Caballero <k0ga@shike2.com> Date: Fri, 8 Nov 2024 09:48:26 +0100 tests/ar: Enable use of executor for the tests This change makes easy to use qemu, valgrind or any other tool that can add additional checks or enable running tests in different architectures. Diffstat:
40 files changed, 87 insertions(+), 83 deletions(-)
diff --git a/tests/ar/execute/0001-append.sh b/tests/ar/execute/0001-append.sh @@ -15,9 +15,9 @@ echo Second > file2 echo Third > file3 rm -f file.a -scc-ar -qv file.a file1 file2 file3 +$EXEC $AR -qv file.a file1 file2 file3 -scc-ar -t file.a > $tmp1 +$EXEC $AR -t file.a > $tmp1 cat <<EOF > $tmp2 file1 @@ -27,7 +27,7 @@ EOF cmp $tmp1 $tmp2 -scc-ar -p file.a > $tmp1 +$EXEC $AR -p file.a > $tmp1 cat <<EOF > $tmp2 First diff --git a/tests/ar/execute/0002-append.sh b/tests/ar/execute/0002-append.sh @@ -15,10 +15,10 @@ echo Second > file2 echo Third > file3 rm -f file.a -scc-ar -qv file.a file1 -scc-ar -qv file.a file2 -scc-ar -qv file.a file3 -scc-ar -t file.a > $tmp1 +$EXEC $AR -qv file.a file1 +$EXEC $AR -qv file.a file2 +$EXEC $AR -qv file.a file3 +$EXEC $AR -t file.a > $tmp1 cat <<EOF > $tmp2 file1 @@ -28,7 +28,7 @@ EOF cmp $tmp1 $tmp2 -scc-ar -p file.a > $tmp1 +$EXEC $AR -p file.a > $tmp1 cat <<EOF > $tmp2 First diff --git a/tests/ar/execute/0003-append.sh b/tests/ar/execute/0003-append.sh @@ -15,9 +15,9 @@ echo Second > file-2 echo Third > file-3 cp master.a file.a -scc-ar -qv file.a file-1 file-2 file-3 +$EXEC $AR -qv file.a file-1 file-2 file-3 -scc-ar -t file.a file-1 file-2 file-3 > $tmp1 +$EXEC $AR -t file.a file-1 file-2 file-3 > $tmp1 cat <<EOF > $tmp2 file-1 @@ -27,7 +27,7 @@ EOF cmp $tmp1 $tmp2 -scc-ar -p file.a file-1 file-2 file-3 > $tmp1 +$EXEC $AR -p file.a file-1 file-2 file-3 > $tmp1 cat <<EOF > $tmp2 First diff --git a/tests/ar/execute/0004-append.sh b/tests/ar/execute/0004-append.sh @@ -11,7 +11,7 @@ trap "rm -f file.a f1 f2 f3 $tmp1 $tmp2" 0 2 3 15 #empty file list rm -f file.a -scc-ar -qv file.a +$EXEC $AR -qv file.a if ! test -f file.a then echo "ar -q didn't generated empty archive" >&2 diff --git a/tests/ar/execute/0005-append.sh b/tests/ar/execute/0005-append.sh @@ -11,7 +11,7 @@ trap "rm -f file.a f1 f2 f3 $tmp1 $tmp2" 0 2 3 15 #empty file list rm -f file.a -if scc-ar -qv file.a badfile.a +if $EXEC $AR -qv file.a badfile.a then echo "ar -q failed to detect missed file" >&2 exit 1 diff --git a/tests/ar/execute/0006-append.sh b/tests/ar/execute/0006-append.sh @@ -11,4 +11,4 @@ trap "rm -f file.a f1 f2 f3 $tmp1 $tmp2" 0 2 3 15 #empty file list rm -f file.a -scc-ar -qv file.a file.a +$EXEC $AR -qv file.a file.a diff --git a/tests/ar/execute/0007-delete.sh b/tests/ar/execute/0007-delete.sh @@ -10,9 +10,9 @@ trap "rm -f file.a" 0 2 3 15 cp master.a file.a -scc-ar -dv file.a file2 +$EXEC $AR -dv file.a file2 -if scc-ar -tv file.a file2 +if $EXEC $AR -tv file.a file2 then echo file-2 was not deleted >&2 exit 1 diff --git a/tests/ar/execute/0008-delete.sh b/tests/ar/execute/0008-delete.sh @@ -10,9 +10,9 @@ trap "rm -f file.a" 0 2 3 15 cp master.a file.a -scc-ar -dv file.a file1 file2 +$EXEC $AR -dv file.a file1 file2 -if scc-ar -tv file.a file1 file2 +if $EXEC $AR -tv file.a file1 file2 then echo file-1 or file-2 were not deleted >&2 exit 1 diff --git a/tests/ar/execute/0009-delete.sh b/tests/ar/execute/0009-delete.sh @@ -9,9 +9,9 @@ trap "rm -f file.a" 0 2 3 15 #delete two members, 2nd and 3rd cp master.a file.a -scc-ar -dv file.a file2 file3 +$EXEC $AR -dv file.a file2 file3 -if scc-ar -tv file.a file2 file3 +if $EXEC $AR -tv file.a file2 file3 then echo file-2 file-3 were not deleted >&2 exit 1 diff --git a/tests/ar/execute/0010-delete.sh b/tests/ar/execute/0010-delete.sh @@ -9,15 +9,15 @@ trap "rm -f file.a" 0 2 3 15 #remove all the members cp master.a file.a -scc-ar -dv file.a file1 file2 file3 +$EXEC $AR -dv file.a file1 file2 file3 -if scc-ar -tv file.a file2 file3 +if $EXEC $AR -tv file.a file2 file3 then echo file-1 file2 file were not deleted >&2 exit 1 fi -if test `scc-ar -t file.a | wc -l` -ne 0 +if test `$EXEC $AR -t file.a | wc -l` -ne 0 then echo file.a is not empty after deleting all the members >&2 exit 1 diff --git a/tests/ar/execute/0011-delete.sh b/tests/ar/execute/0011-delete.sh @@ -11,7 +11,7 @@ cp master.a file.a last=`ls -l file.a | awk '{print $6,$7,$8}'` -if ! scc-ar -dv file.a +if ! $EXEC $AR -dv file.a then echo ar returned with error when no members exit 1 diff --git a/tests/ar/execute/0012-delete.sh b/tests/ar/execute/0012-delete.sh @@ -10,9 +10,9 @@ trap "rm -f file.a" 0 2 3 15 cp master.a file.a -scc-ar -dv file.a file2 +$EXEC $AR -dv file.a file2 -if scc-ar -tv file.a file2 +if $EXEC $AR -tv file.a file2 then echo file-2 was not deleted >&2 exit 1 @@ -24,9 +24,9 @@ fi cp master.a file.a -scc-ar -dv file.a file1 file2 +$EXEC $AR -dv file.a file1 file2 -if scc-ar -tv file.a file1 file2 +if $EXEC $AR -tv file.a file1 file2 then echo file-1 or file-2 were not deleted >&2 exit 1 @@ -37,9 +37,9 @@ fi #delete two members, 2nd and 3rd cp master.a file.a -scc-ar -dv file.a file2 file3 +$EXEC $AR -dv file.a file2 file3 -if scc-ar -tv file.a file2 file3 +if $EXEC $AR -tv file.a file2 file3 then echo file-2 file-3 were not deleted >&2 exit 1 @@ -49,15 +49,15 @@ fi #remove all the members cp master.a file.a -scc-ar -dv file.a file1 file2 file3 +$EXEC $AR -dv file.a file1 file2 file3 -if scc-ar -tv file.a file2 file3 +if $EXEC $AR -tv file.a file2 file3 then echo file-1 file2 file were not deleted >&2 exit 1 fi -if test `scc-ar -t file.a | wc -l` -ne 0 +if test `$EXEC $AR -t file.a | wc -l` -ne 0 then echo file.a is not empty after deleting all the members >&2 exit 1 @@ -71,7 +71,7 @@ cp master.a file.a last=`ls -l file.a | awk '{print $6,$7,$8}'` -if ! scc-ar -dv file.a +if ! $EXEC $AR -dv file.a then echo ar returned with error when no members exit 1 @@ -87,7 +87,7 @@ fi #delete not existing member cp master.a file.a -if scc-ar -dv file.a badfile +if $EXEC $AR -dv file.a badfile then echo ar returned ok deleting a not existing member >&2 exit 1 diff --git a/tests/ar/execute/0013-print.sh b/tests/ar/execute/0013-print.sh @@ -12,7 +12,7 @@ trap "rm -f file.a $tmp1 $tmp2" 0 2 3 15 cp master.a file.a -scc-ar -p file.a file1 > $tmp1 +$EXEC $AR -p file.a file1 > $tmp1 cat <<! > $tmp2 This is the first file, diff --git a/tests/ar/execute/0014-print.sh b/tests/ar/execute/0014-print.sh @@ -11,7 +11,7 @@ trap "rm -f file.a $tmp1 $tmp2" 0 2 3 15 #print 3rd member cp master.a file.a -scc-ar -p file.a file3 > $tmp1 +$EXEC $AR -p file.a file3 > $tmp1 cat <<! > $tmp2 and at the end, this is the last file diff --git a/tests/ar/execute/0015-print.sh b/tests/ar/execute/0015-print.sh @@ -11,7 +11,7 @@ trap "rm -f file.a $tmp1 $tmp2" 0 2 3 15 #print 2nd member with verbose cp master.a file.a -scc-ar -pv file.a file2 >$tmp1 +$EXEC $AR -pv file.a file2 >$tmp1 cat <<! > $tmp2 diff --git a/tests/ar/execute/0016-print.sh b/tests/ar/execute/0016-print.sh @@ -11,7 +11,7 @@ trap "rm -f file.a $tmp1 $tmp2" 0 2 3 15 #print all members cp master.a file.a -scc-ar -p file.a file1 file2 file3 >$tmp1 +$EXEC $AR -p file.a file1 file2 file3 >$tmp1 cat <<! > $tmp2 This is the first file, diff --git a/tests/ar/execute/0017-print.sh b/tests/ar/execute/0017-print.sh @@ -10,7 +10,7 @@ trap "rm -f file.a $tmp1 $tmp2" 0 2 3 15 #and now with no members in command line cp master.a file.a -scc-ar -p file.a > $tmp1 +$EXEC $AR -p file.a > $tmp1 cat <<! > $tmp2 This is the first file, diff --git a/tests/ar/execute/0018-list.sh b/tests/ar/execute/0018-list.sh @@ -12,7 +12,7 @@ trap "rm -f file.a $tmp1 $tmp2" 0 2 3 15 cp master.a file.a -scc-ar -t file.a file1 > $tmp1 +$EXEC $AR -t file.a file1 > $tmp1 cat <<! > $tmp2 file1 diff --git a/tests/ar/execute/0019-list.sh b/tests/ar/execute/0019-list.sh @@ -11,7 +11,7 @@ trap "rm -f file.a $tmp1 $tmp2" 0 2 3 15 #print 3rd member cp master.a file.a -scc-ar -t file.a file3 > $tmp1 +$EXEC $AR -t file.a file3 > $tmp1 cat <<! > $tmp2 file3 diff --git a/tests/ar/execute/0020-list.sh b/tests/ar/execute/0020-list.sh @@ -11,7 +11,7 @@ trap "rm -f file.a $tmp1 $tmp2" 0 2 3 15 #print 2nd member with verbose cp master.a file.a -scc-ar -tv file.a file2 >$tmp1 +$EXEC $AR -tv file.a file2 >$tmp1 cat <<! > $tmp2 rw-r--r-- `id -u`/`id -g` Tue Jan 1 00:00:00 1980 file2 diff --git a/tests/ar/execute/0021-list.sh b/tests/ar/execute/0021-list.sh @@ -11,7 +11,7 @@ trap "rm -f file.a $tmp1 $tmp2" 0 2 3 15 #print all members cp master.a file.a -scc-ar -t file.a file1 file2 file3 >$tmp1 +$EXEC $AR -t file.a file1 file2 file3 >$tmp1 cat <<! > $tmp2 file1 diff --git a/tests/ar/execute/0022-list.sh b/tests/ar/execute/0022-list.sh @@ -12,7 +12,7 @@ trap "rm -f file.a $tmp1 $tmp2" 0 2 3 15 cp master.a file.a -scc-ar -t file.a file1 > $tmp1 +$EXEC $AR -t file.a file1 > $tmp1 cat <<! > $tmp2 file1 @@ -23,7 +23,7 @@ cmp $tmp1 $tmp2 ############################################################################ #print 3rd member -scc-ar -t file.a file3 > $tmp1 +$EXEC $AR -t file.a file3 > $tmp1 cat <<! > $tmp2 file3 @@ -34,7 +34,7 @@ cmp $tmp1 $tmp2 ############################################################################ #print 2nd member with verbose -scc-ar -tv file.a file2 >$tmp1 +$EXEC $AR -tv file.a file2 >$tmp1 cat <<! > $tmp2 rw-r--r-- `id -u`/`id -g` Tue Jan 1 00:00:00 1980 file2 @@ -45,7 +45,7 @@ cmp $tmp1 $tmp2 ############################################################################ #print all members -scc-ar -t file.a file1 file2 file3 >$tmp1 +$EXEC $AR -t file.a file1 file2 file3 >$tmp1 cat <<! > $tmp2 file1 @@ -57,6 +57,6 @@ cmp $tmp1 $tmp2 #and now with no members in command line -scc-ar -t file.a > $tmp1 +$EXEC $AR -t file.a > $tmp1 cmp $tmp1 $tmp2 diff --git a/tests/ar/execute/0023-extract.sh b/tests/ar/execute/0023-extract.sh @@ -11,7 +11,7 @@ trap "rm -f file* $tmp1 $tmp2" 0 2 3 15 #extract 1st member cp master.a file.a -scc-ar -xv file.a file1 +$EXEC $AR -xv file.a file1 cat <<EOF > $tmp1 This is the first file, diff --git a/tests/ar/execute/0024-extract.sh b/tests/ar/execute/0024-extract.sh @@ -11,7 +11,7 @@ trap "rm -f file* $tmp1 $tmp2" 0 2 3 15 #extract 3rd member cp master.a file.a -scc-ar -xv file.a file3 +$EXEC $AR -xv file.a file3 cat <<EOF > $tmp1 and at the end, this is the last file diff --git a/tests/ar/execute/0025-extract.sh b/tests/ar/execute/0025-extract.sh @@ -11,7 +11,7 @@ trap "rm -f file* $tmp1 $tmp2" 0 2 3 15 #extract 3rd member cp master.a file.a -scc-ar -xv file.a file3 +$EXEC $AR -xv file.a file3 cat <<EOF > $tmp1 and at the end, this is the last file diff --git a/tests/ar/execute/0026-extract.sh b/tests/ar/execute/0026-extract.sh @@ -11,7 +11,7 @@ trap "rm -f file* $tmp1 $tmp2" 0 2 3 15 #extract all members cp master.a file.a -scc-ar -xv file.a file1 file2 file3 +$EXEC $AR -xv file.a file1 file2 file3 cat <<EOF > $tmp1 This is the first file, diff --git a/tests/ar/execute/0027-extract.sh b/tests/ar/execute/0027-extract.sh @@ -11,7 +11,7 @@ trap "rm -f file* $tmp1 $tmp2" 0 2 3 15 #extract without parameters cp master.a file.a -scc-ar -xv file.a +$EXEC $AR -xv file.a cat <<EOF > $tmp1 This is the first file, diff --git a/tests/ar/execute/0029-move.sh b/tests/ar/execute/0029-move.sh @@ -11,8 +11,8 @@ trap "rm -f file* $tmp1 $tmp2" 0 2 3 15 #move 1st without specifier cp master.a file.a -scc-ar -mv file.a file1 -scc-ar -t file.a > $tmp1 +$EXEC $AR -mv file.a file1 +$EXEC $AR -t file.a > $tmp1 cat <<EOF > $tmp2 file2 diff --git a/tests/ar/execute/0030-move.sh b/tests/ar/execute/0030-move.sh @@ -11,8 +11,8 @@ trap "rm -f file* $tmp1 $tmp2" 0 2 3 15 #move 1st at the end cp master.a file.a -scc-ar -mv -a file3 file.a file1 -scc-ar -t file.a > $tmp1 +$EXEC $AR -mv -a file3 file.a file1 +$EXEC $AR -t file.a > $tmp1 cat <<EOF > $tmp2 file2 diff --git a/tests/ar/execute/0031-move.sh b/tests/ar/execute/0031-move.sh @@ -11,8 +11,8 @@ trap "rm -f file* $tmp1 $tmp2" 0 2 3 15 #and now, test without parameters cp master.a file.a -scc-ar -mv file.a -scc-ar -t file.a > $tmp1 +$EXEC $AR -mv file.a +$EXEC $AR -t file.a > $tmp1 cat <<EOF > $tmp2 file1 diff --git a/tests/ar/execute/0032-update.sh b/tests/ar/execute/0032-update.sh @@ -13,9 +13,9 @@ trap "rm -f file* $tmp1 $tmp2" 0 2 3 15 echo First > file1 cp master.a file.a -scc-ar -rv file.a file1 +$EXEC $AR -rv file.a file1 -scc-ar -p file.a file1 > $tmp1 +$EXEC $AR -p file.a file1 > $tmp1 cat <<EOF > $tmp2 First diff --git a/tests/ar/execute/0033-update.sh b/tests/ar/execute/0033-update.sh @@ -13,9 +13,9 @@ trap "rm -f file* $tmp1 $tmp2" 0 2 3 15 echo First > file-1 cp master.a file.a -scc-ar -rv file.a file-1 +$EXEC $AR -rv file.a file-1 -scc-ar -p file.a file-1 > $tmp1 +$EXEC $AR -p file.a file-1 > $tmp1 cat <<EOF > $tmp2 First diff --git a/tests/ar/execute/0034-update.sh b/tests/ar/execute/0034-update.sh @@ -13,9 +13,9 @@ trap "rm -f file* $tmp1 $tmp2" 0 2 3 15 echo First > file1 cp master.a file.a -scc-ar -rv -a file1 file.a file1 +$EXEC $AR -rv -a file1 file.a file1 -scc-ar -p file.a file1 > $tmp1 +$EXEC $AR -p file.a file1 > $tmp1 cat <<EOF > $tmp2 First @@ -23,7 +23,7 @@ EOF cmp $tmp1 $tmp2 -scc-ar -t file.a > $tmp1 +$EXEC $AR -t file.a > $tmp1 cat <<EOF > $tmp2 file1 diff --git a/tests/ar/execute/0035-update.sh b/tests/ar/execute/0035-update.sh @@ -13,9 +13,9 @@ trap "rm -f file* $tmp1 $tmp2" 0 2 3 15 echo First > file1 cp master.a file.a -scc-ar -rv -b file1 file.a file1 +$EXEC $AR -rv -b file1 file.a file1 -scc-ar -p file.a file1 > $tmp1 +$EXEC $AR -p file.a file1 > $tmp1 cat <<EOF > $tmp2 First @@ -23,7 +23,7 @@ EOF cmp $tmp1 $tmp2 -scc-ar -t file.a > $tmp1 +$EXEC $AR -t file.a > $tmp1 cat <<EOF > $tmp2 file1 diff --git a/tests/ar/execute/0036-update.sh b/tests/ar/execute/0036-update.sh @@ -13,9 +13,9 @@ trap "rm -f file* $tmp1 $tmp2" 0 2 3 15 echo First > file-1 cp master.a file.a -scc-ar -rv -b file1 file.a file-1 +$EXEC $AR -rv -b file1 file.a file-1 -scc-ar -p file.a file-1 > $tmp1 +$EXEC $AR -p file.a file-1 > $tmp1 cat <<EOF > $tmp2 First @@ -23,7 +23,7 @@ EOF cmp $tmp1 $tmp2 -scc-ar -t file.a > $tmp1 +$EXEC $AR -t file.a > $tmp1 cat <<EOF > $tmp2 file-1 diff --git a/tests/ar/execute/0037-update.sh b/tests/ar/execute/0037-update.sh @@ -13,9 +13,9 @@ trap "rm -f file* $tmp1 $tmp2" 0 2 3 15 echo First > file-1 cp master.a file.a -scc-ar -rv -a file1 file.a file-1 +$EXEC $AR -rv -a file1 file.a file-1 -scc-ar -p file.a file-1 > $tmp1 +$EXEC $AR -p file.a file-1 > $tmp1 cat <<EOF > $tmp2 First @@ -23,7 +23,7 @@ EOF cmp $tmp1 $tmp2 -scc-ar -t file.a > $tmp1 +$EXEC $AR -t file.a > $tmp1 cat <<EOF > $tmp2 file1 diff --git a/tests/ar/execute/0038-update.sh b/tests/ar/execute/0038-update.sh @@ -11,9 +11,9 @@ trap "rm -f file* $tmp1 $tmp2" 0 2 3 15 #Update without parameters cp master.a file.a -scc-ar -rv file.a +$EXEC $AR -rv file.a -scc-ar -t file.a > $tmp1 +$EXEC $AR -t file.a > $tmp1 cat <<EOF > $tmp2 file1 diff --git a/tests/ar/execute/0039-update.sh b/tests/ar/execute/0039-update.sh @@ -15,9 +15,9 @@ echo First > file1 cp master.a file.a sleep 1 touch file1 -scc-ar -ruv file.a file1 +$EXEC $AR -ruv file.a file1 -scc-ar -p file.a file1 > $tmp1 +$EXEC $AR -p file.a file1 > $tmp1 cat <<EOF > $tmp2 First @@ -27,9 +27,9 @@ cmp $tmp1 $tmp2 echo Second > file1 touch -t 197001010000 file.1 -scc-ar -ruv file.a file1 +$EXEC $AR -ruv file.a file1 -scc-ar -p file.a file1 > $tmp1 +$EXEC $AR -p file.a file1 > $tmp1 cat <<EOF > $tmp2 First diff --git a/tests/ar/execute/Makefile b/tests/ar/execute/Makefile @@ -1,9 +1,10 @@ .POSIX: ROOT=../../.. +AR = $(ROOT)/bin/scc-ar all: master.a - @TZ=UTC PATH=$(ROOT)/bin:$$PATH ./chktest.sh + @AR=$(AR) ./chktest.sh master.a: mkmaster.sh @./mkmaster.sh diff --git a/tests/ar/execute/chktest.sh b/tests/ar/execute/chktest.sh @@ -5,6 +5,9 @@ ulimit -c 0 rm -f test.log rm -rf file* +export AR=${AR:-scc-ar} +export TZ=${TZ:-UTC} + for i in *-*.sh do printf "Test: %s\n\n" $i >> test.log