scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 1766ea468274d175a8716adaf59679f15cea73c8
parent 382300ad25f6c0235fadfc5d6381c41ad70d0ac8
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 21 Feb 2018 16:38:06 +0100

Split tests in smaller files

This makes easier to debug the problems.

Diffstat:
Dtests/ar/execute/00-test-q.sh | 69---------------------------------------------------------------------
Atests/ar/execute/0001-append.sh | 39+++++++++++++++++++++++++++++++++++++++
Atests/ar/execute/0002-append.sh | 40++++++++++++++++++++++++++++++++++++++++
Atests/ar/execute/0003-append.sh | 39+++++++++++++++++++++++++++++++++++++++
Atests/ar/execute/0004-append.sh | 20++++++++++++++++++++
Atests/ar/execute/0005-append.sh | 19+++++++++++++++++++
Atests/ar/execute/0006-append.sh | 15+++++++++++++++
Atests/ar/execute/0007-delete.sh | 20++++++++++++++++++++
Atests/ar/execute/0008-delete.sh | 20++++++++++++++++++++
Atests/ar/execute/0009-delete.sh | 19+++++++++++++++++++
Atests/ar/execute/0010-delete.sh | 25+++++++++++++++++++++++++
Atests/ar/execute/0011-delete.sh | 26++++++++++++++++++++++++++
Rtests/ar/execute/10-test-d.sh -> tests/ar/execute/0012-delete.sh | 0
Atests/ar/execute/0013-print.sh | 25+++++++++++++++++++++++++
Atests/ar/execute/0014-print.sh | 24++++++++++++++++++++++++
Atests/ar/execute/0015-print.sh | 28++++++++++++++++++++++++++++
Atests/ar/execute/0016-print.sh | 30++++++++++++++++++++++++++++++
Atests/ar/execute/0017-print.sh | 28++++++++++++++++++++++++++++
Atests/ar/execute/0018-list.sh | 22++++++++++++++++++++++
Atests/ar/execute/0019-list.sh | 21+++++++++++++++++++++
Atests/ar/execute/0020-list.sh | 20++++++++++++++++++++
Atests/ar/execute/0021-list.sh | 22++++++++++++++++++++++
Rtests/ar/execute/30-test-t.sh -> tests/ar/execute/0022-list.sh | 0
Atests/ar/execute/0023-extract.sh | 23+++++++++++++++++++++++
Atests/ar/execute/0024-extract.sh | 24++++++++++++++++++++++++
Atests/ar/execute/0025-extract.sh | 23+++++++++++++++++++++++
Atests/ar/execute/0026-extract.sh | 37+++++++++++++++++++++++++++++++++++++
Atests/ar/execute/0027-extract.sh | 38++++++++++++++++++++++++++++++++++++++
Atests/ar/execute/0029-move.sh | 26++++++++++++++++++++++++++
Atests/ar/execute/0030-move.sh | 26++++++++++++++++++++++++++
Atests/ar/execute/0031-move.sh | 26++++++++++++++++++++++++++
Dtests/ar/execute/20-test-p.sh | 79-------------------------------------------------------------------------------
Dtests/ar/execute/40-test-x.sh | 95-------------------------------------------------------------------------------
Dtests/ar/execute/50-test-m.sh | 70----------------------------------------------------------------------
Mtests/ar/execute/Makefile | 1-
Mtests/ar/execute/chktest.sh | 2+-
36 files changed, 726 insertions(+), 315 deletions(-)

diff --git a/tests/ar/execute/00-test-q.sh b/tests/ar/execute/00-test-q.sh @@ -1,69 +0,0 @@ -#!/bin/sh - -exec >> test.log 2>&1 - -set -e - -trap "rm -f file.a;\ - rm -f *.tst" 0 2 3 - -########################################################################### -#Generate a bunch of files that we can use to test -q - -for i in `awk 'BEGIN {for (i=0; i <999; ++i) print i}'` -do - echo $i > $i.tst -done - - -########################################################################### -#Append all the generated files one by one - -rm -f file.a -ls | grep .tst | sort -n | xargs -n 1 ar -qv file.a - -ar -t file.a | -tee -a test.log | -awk '$0 != NR-1 ".tst" { - printf "bad line %d:%s\n", NR, $0 - exit 1 -}' - -########################################################################### -#Appenp all the generated files 10 by 10 - -rm -f file.a -ls | grep .tst | sort -n | xargs -n 10 ar -qv file.a - -ar -t file.a | -tee -a test.log | -awk '$0 != NR-1 ".tst" { - printf "bad line %d:%s\n", NR, $0 - exit 1 -}' - - -########################################################################### -#Test special cases - -#empty file list -rm -f file.a -ar -qv file.a -if ! test -f file.a -then - echo "ar -q didn't generated empty archive" >&2 - exit 1 -fi - -#recursive inclusion -rm -f file.a -ar -qv file.a file.a - - -#missed file -ar -qv file.a badfile.a || true -if ar -qv file.a badfile.a -then - echo "ar -q failed to detect missed file" >&2 - exit 1 -fi diff --git a/tests/ar/execute/0001-append.sh b/tests/ar/execute/0001-append.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +exec >> test.log 2>&1 +set -e + +trap "rm -f file.a f1 f2 f3 $tmp1 $tmp2" 0 2 3 + +tmp1=`mktemp` +tmp2=`mktemp` + +########################################################################### +#Append generated files at once to an empty archive + +echo First > file1 +echo Second > file2 +echo Third > file3 + +rm -f file.a +ar -qv file.a file1 file2 file3 + +ar -t file.a > $tmp1 + +cat <<EOF > $tmp2 +file1 +file2 +file3 +EOF + +cmp $tmp1 $tmp2 + +ar -p file.a > $tmp1 + +cat <<EOF > $tmp2 +First +Second +Third +EOF + +cmp $tmp1 $tmp2 diff --git a/tests/ar/execute/0002-append.sh b/tests/ar/execute/0002-append.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +exec >> test.log 2>&1 +set -e + +trap "rm -f file.a f1 f2 f3 $tmp1 $tmp2" 0 2 3 + +tmp1=`mktemp` +tmp2=`mktemp` + +########################################################################### +#Append generated files one by one to an empty file + +echo First > file1 +echo Second > file2 +echo Third > file3 + +rm -f file.a +ar -qv file.a file1 +ar -qv file.a file2 +ar -qv file.a file3 +ar -t file.a > $tmp1 + +cat <<EOF > $tmp2 +file1 +file2 +file3 +EOF + +cmp $tmp1 $tmp2 + +ar -p file.a > $tmp1 + +cat <<EOF > $tmp2 +First +Second +Third +EOF + +cmp $tmp1 $tmp2 diff --git a/tests/ar/execute/0003-append.sh b/tests/ar/execute/0003-append.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +exec >> test.log 2>&1 +set -e + +trap "rm -f file.a f1 f2 f3 $tmp1 $tmp2" 0 2 3 + +tmp1=`mktemp` +tmp2=`mktemp` + +########################################################################### +#Append generated files at once to an existing archive + +echo First > file1 +echo Second > file2 +echo Third > file3 + +cp master.a file.a +ar -qv file.a file1 file2 file3 + +ar -t file.a file1 file2 file3 > $tmp1 + +cat <<EOF > $tmp2 +file1 +file2 +file3 +EOF + +cmp $tmp1 $tmp2 + +ar -p file.a file1 file2 file3 > $tmp1 + +cat <<EOF > $tmp2 +First +Second +Third +EOF + +cmp $tmp1 $tmp2 diff --git a/tests/ar/execute/0004-append.sh b/tests/ar/execute/0004-append.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +exec >> test.log 2>&1 +set -e + +trap "rm -f file.a f1 f2 f3 $tmp1 $tmp2" 0 2 3 + +tmp1=`mktemp` +tmp2=`mktemp` + +########################################################################### +#empty file list + +rm -f file.a +ar -qv file.a +if ! test -f file.a +then + echo "ar -q didn't generated empty archive" >&2 + exit 1 +fi diff --git a/tests/ar/execute/0005-append.sh b/tests/ar/execute/0005-append.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +exec >> test.log 2>&1 +set -e + +trap "rm -f file.a f1 f2 f3 $tmp1 $tmp2" 0 2 3 + +tmp1=`mktemp` +tmp2=`mktemp` + +########################################################################### +#empty file list + +rm -f file.a +if ar -qv file.a badfile.a +then + echo "ar -q failed to detect missed file" >&2 + exit 1 +fi diff --git a/tests/ar/execute/0006-append.sh b/tests/ar/execute/0006-append.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +exec >> test.log 2>&1 +set -e + +trap "rm -f file.a f1 f2 f3 $tmp1 $tmp2" 0 2 3 + +tmp1=`mktemp` +tmp2=`mktemp` + +########################################################################### +#empty file list + +rm -f file.a +ar -qv file.a file.a diff --git a/tests/ar/execute/0007-delete.sh b/tests/ar/execute/0007-delete.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +exec >> test.log 2>&1 + +set -e + +trap "rm -f file.a" 0 2 3 + +############################################################################ +#delete one member + +cp master.a file.a + +ar -dv file.a file2 + +if ar -tv file.a file2 +then + echo file-2 was not deleted >&2 + exit 1 +fi diff --git a/tests/ar/execute/0008-delete.sh b/tests/ar/execute/0008-delete.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +exec >> test.log 2>&1 + +set -e + +trap "rm -f file.a" 0 2 3 + +############################################################################ +#delete two members, 1st and 2nd + +cp master.a file.a + +ar -dv file.a file1 file2 + +if ar -tv file.a file1 file2 +then + echo file-1 or file-2 were not deleted >&2 + exit 1 +fi diff --git a/tests/ar/execute/0009-delete.sh b/tests/ar/execute/0009-delete.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +exec >> test.log 2>&1 + +set -e + +trap "rm -f file.a" 0 2 3 + +############################################################################ +#delete two members, 2nd and 3rd + +cp master.a file.a +ar -dv file.a file2 file3 + +if ar -tv file.a file2 file3 +then + echo file-2 file-3 were not deleted >&2 + exit 1 +fi diff --git a/tests/ar/execute/0010-delete.sh b/tests/ar/execute/0010-delete.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +exec >> test.log 2>&1 + +set -e + +trap "rm -f file.a" 0 2 3 + +############################################################################ +#remove all the members + +cp master.a file.a +ar -dv file.a file1 file2 file3 + +if ar -tv file.a file2 file3 +then + echo file-1 file2 file were not deleted >&2 + exit 1 +fi + +if test `ar -t file.a | wc -l` -ne 0 +then + echo file.a is not empty after deleting all the members >&2 + exit 1 +fi diff --git a/tests/ar/execute/0011-delete.sh b/tests/ar/execute/0011-delete.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +exec >> test.log 2>&1 + +set -e + +trap "rm -f file.a" 0 2 3 + +############################################################################ +#no members +cp master.a file.a + +last=`ls -l file.a | awk '{print $6,$7,$8}'` + +if ! ar -dv file.a +then + echo ar returned with error when no members + exit 1 +fi + +now=`ls -l file.a | awk '{print $6,$7,$8}'` +if test "$now" != "$last" +then + echo empty ar -d modified the archive >&2 + exit 1 +fi diff --git a/tests/ar/execute/10-test-d.sh b/tests/ar/execute/0012-delete.sh diff --git a/tests/ar/execute/0013-print.sh b/tests/ar/execute/0013-print.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +exec >> test.log 2>&1 + + +set -e + +tmp1=`mktemp` +tmp2=`mktemp` +trap "rm -f file.a $tmp1 $tmp2" 0 2 3 + +############################################################################ +#print 1st member + +cp master.a file.a + +ar -p file.a file1 > $tmp1 + +cat <<! > $tmp2 +This is the first file, +and it should go in the +first position in the archive. +! + +cmp $tmp1 $tmp2 diff --git a/tests/ar/execute/0014-print.sh b/tests/ar/execute/0014-print.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +exec >> test.log 2>&1 + + +set -e + +tmp1=`mktemp` +tmp2=`mktemp` +trap "rm -f file.a $tmp1 $tmp2" 0 2 3 + +############################################################################ +#print 3rd member + +cp master.a file.a +ar -p file.a file3 > $tmp1 + +cat <<! > $tmp2 +and at the end, this is the last file +that should go at the end of the file, +thus it should go in the third position. +! + +cmp $tmp1 $tmp2 diff --git a/tests/ar/execute/0015-print.sh b/tests/ar/execute/0015-print.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +exec >> test.log 2>&1 + + +set -e + +tmp1=`mktemp` +tmp2=`mktemp` +trap "rm -f file.a $tmp1 $tmp2" 0 2 3 + + +############################################################################ +#print 2nd member with verbose + +cp master.a file.a +ar -pv file.a file2 >$tmp1 + +cat <<! > $tmp2 + +<file2> + +But this other one is the second one, +and it shouldn't go in the first position +because it should go in the second position. +! + +cmp $tmp1 $tmp2 diff --git a/tests/ar/execute/0016-print.sh b/tests/ar/execute/0016-print.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +exec >> test.log 2>&1 + + +set -e + +tmp1=`mktemp` +tmp2=`mktemp` +trap "rm -f file.a $tmp1 $tmp2" 0 2 3 + +############################################################################ +#print all members + +cp master.a file.a +ar -p file.a file1 file2 file3 >$tmp1 + +cat <<! > $tmp2 +This is the first file, +and it should go in the +first position in the archive. +But this other one is the second one, +and it shouldn't go in the first position +because it should go in the second position. +and at the end, this is the last file +that should go at the end of the file, +thus it should go in the third position. +! + +cmp $tmp1 $tmp2 diff --git a/tests/ar/execute/0017-print.sh b/tests/ar/execute/0017-print.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +exec >> test.log 2>&1 + +set -e + +tmp1=`mktemp` +tmp2=`mktemp` +trap "rm -f file.a $tmp1 $tmp2" 0 2 3 + +#and now with no members in command line + +cp master.a file.a +ar -p file.a > $tmp1 + +cat <<! > $tmp2 +This is the first file, +and it should go in the +first position in the archive. +But this other one is the second one, +and it shouldn't go in the first position +because it should go in the second position. +and at the end, this is the last file +that should go at the end of the file, +thus it should go in the third position. +! + +cmp $tmp1 $tmp2 diff --git a/tests/ar/execute/0018-list.sh b/tests/ar/execute/0018-list.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +exec >> test.log 2>&1 +set -e + +tmp1=`mktemp` +tmp2=`mktemp` +trap "rm -f file.a $tmp1 $tmp2" 0 2 3 + + +############################################################################ +#list 1st member + +cp master.a file.a + +ar -t file.a file1 > $tmp1 + +cat <<! > $tmp2 +file1 +! + +cmp $tmp1 $tmp2 diff --git a/tests/ar/execute/0019-list.sh b/tests/ar/execute/0019-list.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +exec >> test.log 2>&1 +set -e + +tmp1=`mktemp` +tmp2=`mktemp` +trap "rm -f file.a $tmp1 $tmp2" 0 2 3 + + +############################################################################ +#print 3rd member + +cp master.a file.a +ar -t file.a file3 > $tmp1 + +cat <<! > $tmp2 +file3 +! + +cmp $tmp1 $tmp2 diff --git a/tests/ar/execute/0020-list.sh b/tests/ar/execute/0020-list.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +exec >> test.log 2>&1 +set -e + +tmp1=`mktemp` +tmp2=`mktemp` +trap "rm -f file.a $tmp1 $tmp2" 0 2 3 + +############################################################################ +#print 2nd member with verbose + +cp master.a file.a +ar -tv file.a file2 >$tmp1 + +cat <<! > $tmp2 +rw-r--r-- `id -u`/`id -g` Tue Jan 1 00:00:00 1980 file2 +! + +cmp $tmp1 $tmp2 diff --git a/tests/ar/execute/0021-list.sh b/tests/ar/execute/0021-list.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +exec >> test.log 2>&1 +set -e + +tmp1=`mktemp` +tmp2=`mktemp` +trap "rm -f file.a $tmp1 $tmp2" 0 2 3 + +############################################################################ +#print all members + +cp master.a file.a +ar -t file.a file1 file2 file3 >$tmp1 + +cat <<! > $tmp2 +file1 +file2 +file3 +! + +cmp $tmp1 $tmp2 diff --git a/tests/ar/execute/30-test-t.sh b/tests/ar/execute/0022-list.sh diff --git a/tests/ar/execute/0023-extract.sh b/tests/ar/execute/0023-extract.sh @@ -0,0 +1,23 @@ +#!/bin/sh + + +exec >> test.log 2>&1 +set -e + +tmp1=`mktemp` +tmp2=`mktemp` +trap "rm -f file* $tmp1 $tmp2" 0 2 3 + +############################################################################ +#extract 1st member + +cp master.a file.a +ar -xv file.a file1 + +cat <<EOF > $tmp1 +This is the first file, +and it should go in the +first position in the archive. +EOF + +cmp file1 $tmp1 diff --git a/tests/ar/execute/0024-extract.sh b/tests/ar/execute/0024-extract.sh @@ -0,0 +1,24 @@ +#!/bin/sh + + +exec >> test.log 2>&1 +set -e + +tmp1=`mktemp` +tmp2=`mktemp` +trap "rm -f file* $tmp1 $tmp2" 0 2 3 + + +############################################################################ +#extract 3rd member + +cp master.a file.a +ar -xv file.a file3 + +cat <<EOF > $tmp1 +and at the end, this is the last file +that should go at the end of the file, +thus it should go in the third position. +EOF + +cmp file3 $tmp1 diff --git a/tests/ar/execute/0025-extract.sh b/tests/ar/execute/0025-extract.sh @@ -0,0 +1,23 @@ +#!/bin/sh + + +exec >> test.log 2>&1 +set -e + +tmp1=`mktemp` +tmp2=`mktemp` +trap "rm -f file* $tmp1 $tmp2" 0 2 3 + +############################################################################ +#extract 3rd member + +cp master.a file.a +ar -xv file.a file3 + +cat <<EOF > $tmp1 +and at the end, this is the last file +that should go at the end of the file, +thus it should go in the third position. +EOF + +cmp file3 $tmp1 diff --git a/tests/ar/execute/0026-extract.sh b/tests/ar/execute/0026-extract.sh @@ -0,0 +1,37 @@ +#!/bin/sh + + +exec >> test.log 2>&1 +set -e + +tmp1=`mktemp` +tmp2=`mktemp` +trap "rm -f file* $tmp1 $tmp2" 0 2 3 + +############################################################################ +#extract all members + +cp master.a file.a +ar -xv file.a file1 file2 file3 + +cat <<EOF > $tmp1 +This is the first file, +and it should go in the +first position in the archive. +But this other one is the second one, +and it shouldn't go in the first position +because it should go in the second position. +and at the end, this is the last file +that should go at the end of the file, +thus it should go in the third position. +EOF + +cat file1 file2 file3 > $tmp2 + +cmp $tmp1 $tmp2 + +if test `ls file? | wc -l` -ne 3 +then + echo some error extracting files + exit +fi diff --git a/tests/ar/execute/0027-extract.sh b/tests/ar/execute/0027-extract.sh @@ -0,0 +1,38 @@ +#!/bin/sh + + +exec >> test.log 2>&1 +set -e + +tmp1=`mktemp` +tmp2=`mktemp` +trap "rm -f file* $tmp1 $tmp2" 0 2 3 + + +############################################################################ +#extract without parameters + +cp master.a file.a +ar -xv file.a + +cat <<EOF > $tmp1 +This is the first file, +and it should go in the +first position in the archive. +But this other one is the second one, +and it shouldn't go in the first position +because it should go in the second position. +and at the end, this is the last file +that should go at the end of the file, +thus it should go in the third position. +EOF + +cat file1 file2 file3 > $tmp2 + +cmp $tmp1 $tmp2 + +if test `ls file? | wc -l` -ne 3 +then + echo some error extracting files + exit +fi diff --git a/tests/ar/execute/0029-move.sh b/tests/ar/execute/0029-move.sh @@ -0,0 +1,26 @@ +#!/bin/sh + + +exec >> test.log 2>&1 + +set -e + +trap "rm -f file* $tmp1 $tmp2" 0 2 3 + +tmp1=`mktemp` +tmp2=`mktemp` + +############################################################################ +#move 1st without specifier + +cp master.a file.a +ar -mv file.a file1 +ar -t file.a > $tmp1 + +cat <<EOF > $tmp2 +file2 +file3 +file1 +EOF + +cmp $tmp1 $tmp2 diff --git a/tests/ar/execute/0030-move.sh b/tests/ar/execute/0030-move.sh @@ -0,0 +1,26 @@ +#!/bin/sh + + +exec >> test.log 2>&1 + +set -e + +trap "rm -f file* $tmp1 $tmp2" 0 2 3 + +tmp1=`mktemp` +tmp2=`mktemp` + +############################################################################ +#move 1st at the end + +cp master.a file.a +ar -mv -a file3 file.a file1 +ar -t file.a > $tmp1 + +cat <<EOF > $tmp2 +file2 +file3 +file1 +EOF + +cmp $tmp1 $tmp2 diff --git a/tests/ar/execute/0031-move.sh b/tests/ar/execute/0031-move.sh @@ -0,0 +1,26 @@ +#!/bin/sh + + +exec >> test.log 2>&1 + +set -e + +trap "rm -f file* $tmp1 $tmp2" 0 2 3 + +tmp1=`mktemp` +tmp2=`mktemp` + +############################################################################ +#and now, test without parameters + +cp master.a file.a +ar -mv file.a +ar -t file.a > $tmp1 + +cat <<EOF > $tmp2 +file1 +file2 +file3 +EOF + +cmp $tmp1 $tmp2 diff --git a/tests/ar/execute/20-test-p.sh b/tests/ar/execute/20-test-p.sh @@ -1,79 +0,0 @@ -#!/bin/sh - -exec >> test.log 2>&1 - - -set -e - -tmp1=`mktemp` -tmp2=`mktemp` -trap "rm -f file.a $tmp1 $tmp2" 0 2 3 - -############################################################################ -#print 1st member - -cp master.a file.a - -ar -p file.a file1 > $tmp1 - -cat <<! > $tmp2 -This is the first file, -and it should go in the -first position in the archive. -! - -cmp $tmp1 $tmp2 - -############################################################################ -#print 3rd member - -ar -p file.a file3 > $tmp1 - -cat <<! > $tmp2 -and at the end, this is the last file -that should go at the end of the file, -thus it should go in the third position. -! - -cmp $tmp1 $tmp2 - -############################################################################ -#print 2nd member with verbose - -ar -pv file.a file2 >$tmp1 - -cat <<! > $tmp2 - -<file2> - -But this other one is the second one, -and it shouldn't go in the first position -because it should go in the second position. -! - -cmp $tmp1 $tmp2 - -############################################################################ -#print all members - -ar -p file.a file1 file2 file3 >$tmp1 - -cat <<! > $tmp2 -This is the first file, -and it should go in the -first position in the archive. -But this other one is the second one, -and it shouldn't go in the first position -because it should go in the second position. -and at the end, this is the last file -that should go at the end of the file, -thus it should go in the third position. -! - -cmp $tmp1 $tmp2 - -#and now with no members in command line - -ar -p file.a > $tmp1 - -cmp $tmp1 $tmp2 diff --git a/tests/ar/execute/40-test-x.sh b/tests/ar/execute/40-test-x.sh @@ -1,95 +0,0 @@ -#!/bin/sh - - -exec >> test.log 2>&1 -set -e - -tmp1=`mktemp` -tmp2=`mktemp` -trap "rm -f file* $tmp1 $tmp2" 0 2 3 - - -cp master.a file.a - -############################################################################ -#extract 1st member - -ar -xv file.a file1 - -cat <<EOF > $tmp1 -This is the first file, -and it should go in the -first position in the archive. -EOF - -cmp file1 $tmp1 - -############################################################################ -#extract 3rd member - -ar -xv file.a file3 - -cat <<EOF > $tmp1 -and at the end, this is the last file -that should go at the end of the file, -thus it should go in the third position. -EOF - -cmp file3 $tmp1 - -############################################################################ -#extract 3rd member - -rm -f file1 file3 -ar -xv file.a file1 file2 file3 - -cat <<EOF > $tmp1 -This is the first file, -and it should go in the -first position in the archive. -But this other one is the second one, -and it shouldn't go in the first position -because it should go in the second position. -and at the end, this is the last file -that should go at the end of the file, -thus it should go in the third position. -EOF - -cat file1 file2 file3 > $tmp2 - -cmp $tmp1 $tmp2 - -if test `ls file? | wc -l` -ne 3 -then - echo some error extracting files - exit -fi - - -############################################################################ -#extract all members - -rm -f file1 file2 file3 -ar -xv file.a - -cat <<EOF > $tmp1 -This is the first file, -and it should go in the -first position in the archive. -But this other one is the second one, -and it shouldn't go in the first position -because it should go in the second position. -and at the end, this is the last file -that should go at the end of the file, -thus it should go in the third position. -EOF - -cat file1 file2 file3 > $tmp2 - -cmp $tmp1 $tmp2 - -if test `ls file? | wc -l` -ne 3 -then - echo some error extracting files - exit -fi diff --git a/tests/ar/execute/50-test-m.sh b/tests/ar/execute/50-test-m.sh @@ -1,70 +0,0 @@ -#!/bin/sh - - -exec >> test.log 2>&1 -set -e - -tmp1=`mktemp` -tmp2=`mktemp` -trap "rm -f file* $tmp1 $tmp2" 0 2 3 - -############################################################################ -#move 1st without specifier - -cp master.a file.a -ar -mv file.a file1 -ar -t file.a > $tmp1 - -cat <<EOF > $tmp2 -file2 -file3 -file1 -EOF - -cmp $tmp1 $tmp2 - -############################################################################ -#move 1st at the end - -cp master.a file.a -ar -mv -a file3 file.a file1 -ar -t file.a > $tmp1 - -cat <<EOF > $tmp2 -file2 -file3 -file1 -EOF - -cmp $tmp1 $tmp2 - - -############################################################################ -#move 3rd at the beginning - -cp master.a file.a -ar -mv -i file1 file.a file3 -ar -t file.a > $tmp1 - -cat <<EOF > $tmp2 -file3 -file1 -file2 -EOF - -cmp $tmp1 $tmp2 - -############################################################################ -#and now, test without parameters - -cp master.a file.a -ar -mv file.a -ar -t file.a > $tmp1 - -cat <<EOF > $tmp2 -file1 -file2 -file3 -EOF - -cmp $tmp1 $tmp2 diff --git a/tests/ar/execute/Makefile b/tests/ar/execute/Makefile @@ -11,4 +11,3 @@ tests: clean: rm -f *.a test.log rm -f file* - rm -f *.dst diff --git a/tests/ar/execute/chktest.sh b/tests/ar/execute/chktest.sh @@ -29,7 +29,7 @@ that should go at the end of the file, thus it should go in the third position. EOF -for i in *-test*.sh +for i in *-*.sh do printf "Test: %s\n\n" $i >> test.log printf "%s\t" $i