Shell tests now complain more loudly.
Adding the bomb function which takes as a parameter a string to be printed, print it, cleans up and exits with an error code. It also means they will exit after the first error, unlike previous behaviour. Change-Id: Id0ffdf3938da43586c9dae7c566ee130533c5577
This commit is contained in:
parent
8aeac26999
commit
2dc480bd58
131
test/testsh1.sh
131
test/testsh1.sh
@ -2,15 +2,30 @@
|
|||||||
|
|
||||||
# Shell script used to test MINIX.
|
# Shell script used to test MINIX.
|
||||||
|
|
||||||
|
# Helper function
|
||||||
|
bomb() {
|
||||||
|
echo $*
|
||||||
|
cd ..
|
||||||
|
rm -rf $TESTDIR
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PATH=:/bin:/usr/bin
|
PATH=:/bin:/usr/bin
|
||||||
export PATH
|
export PATH
|
||||||
|
|
||||||
echo -n "Shell test 1 "
|
TESTDIR=DIR_SH1
|
||||||
rm -rf DIR_SH1
|
export TESTDIR
|
||||||
mkdir DIR_SH1
|
|
||||||
cd DIR_SH1
|
|
||||||
|
|
||||||
f=../test1.c
|
OLDPWD=`pwd`
|
||||||
|
export OLDPWD
|
||||||
|
|
||||||
|
echo -n "Shell test 1 "
|
||||||
|
rm -rf $TESTDIR
|
||||||
|
mkdir $TESTDIR
|
||||||
|
cd $TESTDIR
|
||||||
|
|
||||||
|
f=$OLDPWD/test1.c
|
||||||
if test -r $f; then : ; else echo sh1 cannot read $f; exit 1; fi
|
if test -r $f; then : ; else echo sh1 cannot read $f; exit 1; fi
|
||||||
|
|
||||||
#Initial setup
|
#Initial setup
|
||||||
@ -27,24 +42,24 @@ cat tmp tmp tmp >f1
|
|||||||
#Test cp
|
#Test cp
|
||||||
mkdir foo
|
mkdir foo
|
||||||
cp /etc/rc /etc/passwd foo
|
cp /etc/rc /etc/passwd foo
|
||||||
if cmp -s foo/rc /etc/rc ; then : ; else echo Error on cp test 1; fi
|
if cmp -s foo/rc /etc/rc ; then : ; else bomb "Error on cp test 1"; fi
|
||||||
if cmp -s foo/passwd /etc/passwd ; then : ; else echo Error on cp test 2; fi
|
if cmp -s foo/passwd /etc/passwd ; then : ; else bomb "Error on cp test 2"; fi
|
||||||
rm -rf foo
|
rm -rf foo
|
||||||
|
|
||||||
#Test cat
|
#Test cat
|
||||||
cat num num num num num >y
|
cat num num num num num >y
|
||||||
wc -c y >x1
|
wc -c y >x1
|
||||||
echo " 55 y" >x2
|
echo " 55 y" >x2
|
||||||
if cmp -s x1 x2; then : ; else echo Error on cat test 1; fi
|
if cmp -s x1 x2; then : ; else bomb "Error on cat test 1"; fi
|
||||||
cat <y >z
|
cat <y >z
|
||||||
if cmp -s y z; then : ; else echo Error on cat test 2; fi
|
if cmp -s y z; then : ; else bomb "Error on cat test 2"; fi
|
||||||
|
|
||||||
#Test basename
|
#Test basename
|
||||||
if test `basename /usr/ast/foo.c .c` != 'foo'
|
if test `basename /usr/ast/foo.c .c` != 'foo'
|
||||||
then echo Error on basename test 1
|
then bomb "Error on basename test 1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test `basename a/b/c/d` != 'd'; then Error on basename test 2; fi
|
if test `basename a/b/c/d` != 'd'; then bomb "Error on basename test 2"; fi
|
||||||
|
|
||||||
#Test cdiff, sed, and patch
|
#Test cdiff, sed, and patch
|
||||||
cp $f x.c # x.c is a copy $f
|
cp $f x.c # x.c is a copy $f
|
||||||
@ -52,7 +67,7 @@ echo "/a/s//#####/g" >s # create sed script
|
|||||||
sed -f s <x.c >y.c # y.c is new version of x.c
|
sed -f s <x.c >y.c # y.c is new version of x.c
|
||||||
diff -c x.c y.c >y # y is cdiff listing
|
diff -c x.c y.c >y # y is cdiff listing
|
||||||
patch x.c y 2>/dev/null # z should be y.c
|
patch x.c y 2>/dev/null # z should be y.c
|
||||||
if cmp -s x.c y.c; then : ; else echo Error in cdiff test; fi
|
if cmp -s x.c y.c; then : ; else bomb "Error in cdiff test"; fi
|
||||||
rm x.c* y.c s y
|
rm x.c* y.c s y
|
||||||
|
|
||||||
#Test comm, grep -v
|
#Test comm, grep -v
|
||||||
@ -60,16 +75,16 @@ ls /etc >x # x = list of /etc
|
|||||||
grep -v "passwd" x >y # y = x except for /etc/passwd
|
grep -v "passwd" x >y # y = x except for /etc/passwd
|
||||||
comm -3 x y >z # should only be 1 line, /etc/passwd
|
comm -3 x y >z # should only be 1 line, /etc/passwd
|
||||||
echo "passwd" >w
|
echo "passwd" >w
|
||||||
if cmp -s w z; then : else echo Error on comm test 1; fi
|
if cmp -s w z; then : else bomb "Error on comm test 1"; fi
|
||||||
|
|
||||||
comm -13 x y >z # should be empty
|
comm -13 x y >z # should be empty
|
||||||
if test -s z; then echo Error on comm test 2; fi
|
if test -s z; then bomb "Error on comm test 2"; fi
|
||||||
rm -rf w x y z
|
rm -rf w x y z
|
||||||
|
|
||||||
#Test compress
|
#Test compress
|
||||||
compress -fc $f >x.c.Z # compress the test file
|
compress -fc $f >x.c.Z # compress the test file
|
||||||
compress -cd x.c.Z >y # uncompress it
|
compress -cd x.c.Z >y # uncompress it
|
||||||
if cmp -s $f y; then : else echo Error in compress test 1; fi
|
if cmp -s $f y; then : else bomb "Error in compress test 1"; fi
|
||||||
rm -rf x.c.Z y
|
rm -rf x.c.Z y
|
||||||
|
|
||||||
#Test ed
|
#Test ed
|
||||||
@ -90,56 +105,56 @@ w
|
|||||||
q
|
q
|
||||||
END
|
END
|
||||||
ed 2>/dev/null x <y >/dev/null
|
ed 2>/dev/null x <y >/dev/null
|
||||||
if cmp -s x $f; then : ; else echo Error in ed test 1; fi
|
if cmp -s x $f; then : ; else bomb "Error in ed test 1"; fi
|
||||||
rm x y
|
rm x y
|
||||||
|
|
||||||
#Test expr
|
#Test expr
|
||||||
if test `expr 1 + 1` != 2; then echo Error on expr test 1; fi
|
if test `expr 1 + 1` != 2; then bomb "Error on expr test 1"; fi
|
||||||
if test `expr 10000 - 1` != 9999; then echo Error on expr test 2; fi
|
if test `expr 10000 - 1` != 9999; then bomb "Error on expr test 2"; fi
|
||||||
if test `expr 100 '*' 50` != 5000; then echo Error on expr test 3; fi
|
if test `expr 100 '*' 50` != 5000; then bomb "Error on expr test 3"; fi
|
||||||
if test `expr 120 / 5` != 24; then echo Error on expr test 4; fi
|
if test `expr 120 / 5` != 24; then bomb "Error on expr test 4"; fi
|
||||||
if test `expr 143 % 7` != 3; then echo Error on expr test 5; fi
|
if test `expr 143 % 7` != 3; then bomb "Error on expr test 5"; fi
|
||||||
a=100
|
a=100
|
||||||
a=`expr $a + 1`
|
a=`expr $a + 1`
|
||||||
if test $a != '101'; then echo Error on expr test 6; fi
|
if test $a != '101'; then bomb "Error on expr test 6"; fi
|
||||||
|
|
||||||
#Test fgrep
|
#Test fgrep
|
||||||
fgrep "abc" alpha >z
|
fgrep "abc" alpha >z
|
||||||
if cmp -s alpha z ; then : else echo Error on fgrep test 1; fi
|
if cmp -s alpha z ; then : else bomb "Error on fgrep test 1"; fi
|
||||||
fgrep "abc" num >z
|
fgrep "abc" num >z
|
||||||
if test -s z; then echo Error on fgrep test 2; fi
|
if test -s z; then bomb "Error on fgrep test 2"; fi
|
||||||
cat alpha num >z
|
cat alpha num >z
|
||||||
fgrep "012" z >w
|
fgrep "012" z >w
|
||||||
if cmp -s w num; then : ; else echo Error fgrep test 3; fi
|
if cmp -s w num; then : ; else bomb "Error fgrep test 3"; fi
|
||||||
|
|
||||||
|
|
||||||
#Test find
|
#Test find
|
||||||
date >Rabbit
|
date >Rabbit
|
||||||
echo "Rabbit" >y
|
echo "Rabbit" >y
|
||||||
find . -name Rabbit -print >z
|
find . -name Rabbit -print >z
|
||||||
if cmp -s y z; then : else echo Error on find test 1; fi
|
if cmp -s y z; then : else bomb "Error on find test 1"; fi
|
||||||
find . -name Bunny -print >z
|
find . -name Bunny -print >z
|
||||||
if test -s z; then echo Error on find test 2; fi
|
if test -s z; then bomb "Error on find test 2"; fi
|
||||||
rm Rabbit y z
|
rm Rabbit y z
|
||||||
|
|
||||||
#Test grep
|
#Test grep
|
||||||
grep "a" alpha >x
|
grep "a" alpha >x
|
||||||
if cmp -s x alpha; then : ; else echo Error on grep test 1; fi
|
if cmp -s x alpha; then : ; else bomb "Error on grep test 1"; fi
|
||||||
grep "a" ALPHA >x
|
grep "a" ALPHA >x
|
||||||
if test -s x; then echo Error on grep test 2; fi
|
if test -s x; then bomb "Error on grep test 2"; fi
|
||||||
grep -v "0" alpha >x
|
grep -v "0" alpha >x
|
||||||
if cmp -s x alpha; then : ; else echo Error on grep test 3; fi
|
if cmp -s x alpha; then : ; else bomb "Error on grep test 3"; fi
|
||||||
grep -s "a" XXX_nonexistent_file_XXX >x
|
grep -s "a" XXX_nonexistent_file_XXX >x
|
||||||
if test -s x; then echo "Error on grep test 4"; fi
|
if test -s x; then echo "Error on grep test 4"; fi
|
||||||
if grep -s "a" alpha >x; then : else echo Error on grep test 5; fi
|
if grep -s "a" alpha >x; then : else bomb "Error on grep test 5"; fi
|
||||||
if grep -s "a" ALPHA >x; then echo Error on grep test 6; fi
|
if grep -s "a" ALPHA >x; then bomb "Error on grep test 6"; fi
|
||||||
|
|
||||||
#Test head
|
#Test head
|
||||||
head -1 f1 >x
|
head -1 f1 >x
|
||||||
if cmp -s x alpha; then : else echo Error on head test 1; fi
|
if cmp -s x alpha; then : else bomb "Error on head test 1"; fi
|
||||||
head -2 f1 >x
|
head -2 f1 >x
|
||||||
cat alpha ALPHA >y
|
cat alpha ALPHA >y
|
||||||
if cmp -s x y; then : else echo Error on head test 2; fi
|
if cmp -s x y; then : else bomb "Error on head test 2"; fi
|
||||||
|
|
||||||
#Test ls
|
#Test ls
|
||||||
mkdir FOO
|
mkdir FOO
|
||||||
@ -154,37 +169,37 @@ x
|
|||||||
y
|
y
|
||||||
z
|
z
|
||||||
END
|
END
|
||||||
if cmp -s w w1; then : ; else echo Error on ls test 1; fi
|
if cmp -s w w1; then : ; else bomb "Error on ls test 1"; fi
|
||||||
rm *
|
rm *
|
||||||
cd ..
|
cd ..
|
||||||
rmdir FOO
|
rmdir FOO
|
||||||
|
|
||||||
#Test mkdir/rmdir
|
#Test mkdir/rmdir
|
||||||
mkdir Foo Bar
|
mkdir Foo Bar
|
||||||
if test -d Foo; then : ; else echo Error on mkdir test 1; fi
|
if test -d Foo; then : ; else bomb "Error on mkdir test 1"; fi
|
||||||
if test -d Bar; then : ; else echo Error on mkdir test 2; fi
|
if test -d Bar; then : ; else bomb "Error on mkdir test 2"; fi
|
||||||
rmdir Foo Bar
|
rmdir Foo Bar
|
||||||
if test -d Foo; then echo Error on mkdir test 3; fi
|
if test -d Foo; then bomb "Error on mkdir test 3"; fi
|
||||||
if test -d Foo; then echo Error on rmdir test 4; fi
|
if test -d Foo; then bomb "Error on rmdir test 4"; fi
|
||||||
|
|
||||||
#Test mv
|
#Test mv
|
||||||
mkdir MVDIR
|
mkdir MVDIR
|
||||||
cp $f x
|
cp $f x
|
||||||
mv x y
|
mv x y
|
||||||
mv y z
|
mv y z
|
||||||
if cmp -s $f z; then : ; else echo Error on mv test 1; fi
|
if cmp -s $f z; then : ; else bomb "Error on mv test 1"; fi
|
||||||
cp $f x
|
cp $f x
|
||||||
mv x MVDIR/y
|
mv x MVDIR/y
|
||||||
if cmp -s $f MVDIR/y; then : ; else echo Error on mv test 2; fi
|
if cmp -s $f MVDIR/y; then : ; else bomb "Error on mv test 2"; fi
|
||||||
|
|
||||||
#Test rev
|
#Test rev
|
||||||
rev <f1 | head -1 >ahpla
|
rev <f1 | head -1 >ahpla
|
||||||
echo "zyxwvutsrqponmlkjihgfedcba" >x
|
echo "zyxwvutsrqponmlkjihgfedcba" >x
|
||||||
if cmp -s x ahpla; then : ; else echo Error on rev test 1; fi
|
if cmp -s x ahpla; then : ; else bomb "Error on rev test 1"; fi
|
||||||
rev <$f >x
|
rev <$f >x
|
||||||
rev <x >y
|
rev <x >y
|
||||||
if cmp -s $f x; then echo Error on rev test 2; fi
|
if cmp -s $f x; then bomb "Error on rev test 2"; fi
|
||||||
if cmp -s $f y; then : ; else echo error on rev test 3; fi
|
if cmp -s $f y; then : ; else bomb "Error on rev test 3"; fi
|
||||||
|
|
||||||
#Test shar
|
#Test shar
|
||||||
cp $f w
|
cp $f w
|
||||||
@ -194,16 +209,16 @@ cp num z
|
|||||||
shar w x y z >x1
|
shar w x y z >x1
|
||||||
rm w x y z
|
rm w x y z
|
||||||
sh <x1 >/dev/null
|
sh <x1 >/dev/null
|
||||||
if cmp -s w $f; then : ; else echo Error on shar test 1; fi
|
if cmp -s w $f; then : ; else bomb "Error on shar test 1"; fi
|
||||||
if cmp -s x alpha; then : ; else echo Error on shar test 2; fi
|
if cmp -s x alpha; then : ; else bomb "Error on shar test 2"; fi
|
||||||
if cmp -s y ALPHA; then : ; else echo Error on shar test 3; fi
|
if cmp -s y ALPHA; then : ; else bomb "Error on shar test 3"; fi
|
||||||
if cmp -s z num; then : ; else echo Error on shar test 4; fi
|
if cmp -s z num; then : ; else bomb "Error on shar test 4"; fi
|
||||||
|
|
||||||
#Test sort
|
#Test sort
|
||||||
sort <$f >x
|
sort <$f >x
|
||||||
wc <$f >x1
|
wc <$f >x1
|
||||||
wc <x >x2
|
wc <x >x2
|
||||||
if cmp -s x1 x2; then : ; else echo Error on sort test 1; fi
|
if cmp -s x1 x2; then : ; else bomb "Error on sort test 1"; fi
|
||||||
cat >x <<END
|
cat >x <<END
|
||||||
demit 10
|
demit 10
|
||||||
epitonic 40
|
epitonic 40
|
||||||
@ -226,16 +241,16 @@ bibelot 3
|
|||||||
apoop 20
|
apoop 20
|
||||||
END
|
END
|
||||||
sort <x >x1
|
sort <x >x1
|
||||||
if cmp -s y x1; then : ; else echo Error on sort test 2; fi
|
if cmp -s y x1; then : ; else bomb "Error on sort test 2"; fi
|
||||||
sort -r <x1 >x2
|
sort -r <x1 >x2
|
||||||
if cmp -s x2 z; then : ; else echo Error on sort test 3; fi
|
if cmp -s x2 z; then : ; else bomb "Error on sort test 3"; fi
|
||||||
sort -k 2n <x |head -1 >y
|
sort -k 2n <x |head -1 >y
|
||||||
echo "bibelot 3" >z
|
echo "bibelot 3" >z
|
||||||
if cmp -s y z; then : ; else echo Error on sort test 4; fi
|
if cmp -s y z; then : ; else bomb "Error on sort test 4"; fi
|
||||||
|
|
||||||
#Test tail
|
#Test tail
|
||||||
tail -1 f1 >x
|
tail -1 f1 >x
|
||||||
if cmp -s x special; then : ; else echo Error on tail test 1; fi
|
if cmp -s x special; then : ; else bomb "Error on tail test 1"; fi
|
||||||
|
|
||||||
#Test tsort
|
#Test tsort
|
||||||
cat >x <<END
|
cat >x <<END
|
||||||
@ -265,24 +280,24 @@ p
|
|||||||
z
|
z
|
||||||
END
|
END
|
||||||
tsort <x >y
|
tsort <x >y
|
||||||
if cmp -s y answer; then : ; else echo Error on tsort test 1; fi
|
if cmp -s y answer; then : ; else bomb "Error on tsort test 1"; fi
|
||||||
|
|
||||||
#Test uue/uud
|
#Test uue/uud
|
||||||
cp $f x
|
cp $f x
|
||||||
uue x
|
uue x
|
||||||
if test -s x.uue; then : ; else echo Error on uue/uud test 1; fi
|
if test -s x.uue; then : ; else bomb "Error on uue/uud test 1"; fi
|
||||||
rm x
|
rm x
|
||||||
uud x.uue
|
uud x.uue
|
||||||
if cmp -s x $f; then : ; else echo Error on uue/uud test 2; fi
|
if cmp -s x $f; then : ; else bomb "Error on uue/uud test 2"; fi
|
||||||
|
|
||||||
compress -fc x >x.Z 2>/dev/null
|
compress -fc x >x.Z 2>/dev/null
|
||||||
uue x.Z
|
uue x.Z
|
||||||
rm x x.Z
|
rm x x.Z
|
||||||
uud x.uue
|
uud x.uue
|
||||||
compress -cd x.Z >x
|
compress -cd x.Z >x
|
||||||
if cmp -s x $f; then : ; else echo Error on uue/uud test 3; fi
|
if cmp -s x $f; then : ; else bomb "Error on uue/uud test 3"; fi
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
rm -rf DIR_SH1
|
rm -rf $TESTDIR
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
@ -2,18 +2,32 @@
|
|||||||
|
|
||||||
# Shell script #2 used to test MINIX.
|
# Shell script #2 used to test MINIX.
|
||||||
|
|
||||||
|
# Helper function
|
||||||
|
bomb() {
|
||||||
|
echo $*
|
||||||
|
cd ..
|
||||||
|
rm -rf $TESTDIR
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
PATH=:/bin:/usr/bin:/usr/pkg/bin
|
PATH=:/bin:/usr/bin:/usr/pkg/bin
|
||||||
export PATH
|
export PATH
|
||||||
|
|
||||||
|
TESTDIR=DIR_SH2
|
||||||
|
export TESTDIR
|
||||||
|
|
||||||
|
OLDPWD=`pwd`
|
||||||
|
export OLDPWD
|
||||||
|
|
||||||
# CC="exec cc -wo -F" # nonstandard flags for ACK :-(
|
# CC="exec cc -wo -F" # nonstandard flags for ACK :-(
|
||||||
CC=clang
|
CC=clang
|
||||||
|
|
||||||
ARCH=`arch`
|
ARCH=`arch`
|
||||||
|
|
||||||
echo -n "Shell test 2 "
|
echo -n "Shell test 2 "
|
||||||
rm -rf DIR_SH2
|
rm -rf $TESTDIR
|
||||||
mkdir DIR_SH2 # all files are created here
|
mkdir $TESTDIR # all files are created here
|
||||||
cd DIR_SH2
|
cd $TESTDIR
|
||||||
|
|
||||||
cat >file <<END
|
cat >file <<END
|
||||||
The time has come the walrus said to talk of many things
|
The time has come the walrus said to talk of many things
|
||||||
@ -43,18 +57,18 @@ cat >answer <<END # C program should produce these results
|
|||||||
END
|
END
|
||||||
|
|
||||||
make
|
make
|
||||||
if test -f a.out; then : ; else echo Compilation failed; fi
|
if test -f a.out; then : ; else bomb "Compilation failed"; fi
|
||||||
a.out >x
|
a.out >x
|
||||||
if test -f x; then : ; else echo No compiler output; fi
|
if test -f x; then : ; else bomb "No compiler output"; fi
|
||||||
if cmp -s x answer; then : ; else echo Error in cc test 1; fi
|
if cmp -s x answer; then : ; else bomb "Error in cc test 1"; fi
|
||||||
|
|
||||||
#Test chmod
|
#Test chmod
|
||||||
echo Hi there folks >x
|
echo "Hi there folks" >x
|
||||||
if test -r x; then : ; else echo Error on chmod test 1; fi
|
if test -r x; then : ; else bomb "Error on chmod test 1"; fi
|
||||||
chmod 377 x
|
chmod 377 x
|
||||||
if test -r x; then test -w / || echo Error on chmod test 2; fi
|
if test -r x; then test -w / || bomb "Error on chmod test 2"; fi
|
||||||
chmod 700 x
|
chmod 700 x
|
||||||
if test -r x; then : ; else echo Error on chmod test 3; fi
|
if test -r x; then : ; else bomb "Error on chmod test 3"; fi
|
||||||
|
|
||||||
#Test cut
|
#Test cut
|
||||||
cat >x <<END # x is a test file with 3 columns
|
cat >x <<END # x is a test file with 3 columns
|
||||||
@ -72,24 +86,24 @@ black
|
|||||||
END
|
END
|
||||||
|
|
||||||
cut -c 3-7 x >y # extract columns 3-7
|
cut -c 3-7 x >y # extract columns 3-7
|
||||||
if cmp -s y answer; then : ; else echo Error in cut test 1; fi
|
if cmp -s y answer; then : ; else bomb "Error in cut test 1"; fi
|
||||||
|
|
||||||
#Test dd
|
#Test dd
|
||||||
dd if=$f of=x bs=12 count=1 2>/dev/null # x = bytes 0-11
|
dd if=$f of=x bs=12 count=1 2>/dev/null # x = bytes 0-11
|
||||||
dd if=$f of=y bs=6 count=4 skip=2 2>/dev/null # y = bytes 11-35
|
dd if=$f of=y bs=6 count=4 skip=2 2>/dev/null # y = bytes 11-35
|
||||||
cat x y >z # z = bytes 0-35
|
cat x y >z # z = bytes 0-35
|
||||||
dd if=$f of=answer bs=9 count=4 2>/dev/null # answer = bytes 0-35
|
dd if=$f of=answer bs=9 count=4 2>/dev/null # answer = bytes 0-35
|
||||||
if cmp -s z answer; then : ; else echo Error in dd test 1; fi
|
if cmp -s z answer; then : ; else bomb "Error in dd test 1"; fi
|
||||||
|
|
||||||
#Test df # hard to make a sensible Test here
|
#Test df # hard to make a sensible Test here
|
||||||
rm ?
|
rm ?
|
||||||
df >x
|
df >x
|
||||||
if test -r x; then : ; else echo Error in df Test 1; fi
|
if test -r x; then : ; else bomb "Error in df Test 1"; fi
|
||||||
|
|
||||||
#Test du # see df
|
#Test du # see df
|
||||||
rm ?
|
rm ?
|
||||||
du >x
|
du >x
|
||||||
if test -r x; then : ; else echo Error in du Test 1; fi
|
if test -r x; then : ; else bomb "Error in du Test 1"; fi
|
||||||
|
|
||||||
#Test od
|
#Test od
|
||||||
head -1 $f |od >x # see if od converts ascii to octal ok
|
head -1 $f |od >x # see if od converts ascii to octal ok
|
||||||
@ -112,7 +126,7 @@ cat >answer <<END
|
|||||||
END
|
END
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if cmp -s x answer; then : ; else echo Error in od test 1; fi
|
if cmp -s x answer; then : ; else bomb "Error in od test 1"; fi
|
||||||
|
|
||||||
head -1 $f |od -d >x # see if od converts ascii to decimal ok
|
head -1 $f |od -d >x # see if od converts ascii to decimal ok
|
||||||
if [ $ARCH = i86 -o $ARCH = i386 ]
|
if [ $ARCH = i86 -o $ARCH = i386 ]
|
||||||
@ -134,7 +148,7 @@ cat >answer <<END
|
|||||||
END
|
END
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if cmp -s x answer; then : ; else echo Error in od test 2; fi
|
if cmp -s x answer; then : ; else bomb "Error in od test 2"; fi
|
||||||
|
|
||||||
#Test paste
|
#Test paste
|
||||||
cat >x <<END
|
cat >x <<END
|
||||||
@ -155,14 +169,14 @@ blue blauw
|
|||||||
END
|
END
|
||||||
|
|
||||||
paste x y >z
|
paste x y >z
|
||||||
if cmp -s z answer; then : ; else echo Error in paste test 1; fi
|
if cmp -s z answer; then : ; else bomb "Error in paste test 1"; fi
|
||||||
|
|
||||||
#Test prep
|
#Test prep
|
||||||
echo >x <<END
|
prep >x <<END
|
||||||
"Hi," said Carol, laughing, "How's life?"
|
"Hi," said Carol, laughing, "How's life?"
|
||||||
END
|
END
|
||||||
|
|
||||||
echo >answer <<END
|
cat >answer <<END
|
||||||
hi
|
hi
|
||||||
said
|
said
|
||||||
carol
|
carol
|
||||||
@ -171,21 +185,21 @@ how's
|
|||||||
life
|
life
|
||||||
END
|
END
|
||||||
|
|
||||||
if cmp -s x answer; then : ; else echo Error in prep test 1; fi
|
if cmp -s x answer; then : ; else bomb "Error in prep test 1"; fi
|
||||||
|
|
||||||
#Test printenv
|
#Test printenv
|
||||||
printenv >x
|
printenv >x
|
||||||
if grep HOME x >/dev/null; then : ; else echo Error in printenv test 1; fi
|
if grep HOME x >/dev/null; then : ; else bomb "Error in printenv test 1"; fi
|
||||||
if grep PATH x >/dev/null; then : ; else echo Error in printenv test 2; fi
|
if grep PATH x >/dev/null; then : ; else bomb "Error in printenv test 2"; fi
|
||||||
if grep SHELL x >/dev/null; then : ; else echo Error in printenv test 3; fi
|
if grep SHELL x >/dev/null; then : ; else bomb "Error in printenv test 3"; fi
|
||||||
if grep USER x >/dev/null; then : ; else echo Error in printenv test 4; fi
|
if grep USER x >/dev/null; then : ; else bomb "Error in printenv test 4"; fi
|
||||||
|
|
||||||
#Test pwd
|
#Test pwd
|
||||||
pwd >Pwd_file
|
pwd >Pwd_file
|
||||||
cd `pwd`
|
cd `pwd`
|
||||||
pwd >x
|
pwd >x
|
||||||
if test -s Pwd_file; then : ; else echo Error in pwd test 1; fi
|
if test -s Pwd_file; then : ; else bomb "Error in pwd test 1"; fi
|
||||||
if cmp -s Pwd_file x; then : ; else echo Error in pwd test 2; fi
|
if cmp -s Pwd_file x; then : ; else bomb "Error in pwd test 2"; fi
|
||||||
|
|
||||||
#Test strings
|
#Test strings
|
||||||
strings a.out | grep "MS-DOS" >x
|
strings a.out | grep "MS-DOS" >x
|
||||||
@ -193,7 +207,7 @@ cat >answer <<END
|
|||||||
MS-DOS: Just say no
|
MS-DOS: Just say no
|
||||||
END
|
END
|
||||||
|
|
||||||
if cmp -s x answer; then : ; else echo Error in strings test 1; fi
|
if cmp -s x answer; then : ; else bomb "Error in strings test 1"; fi
|
||||||
|
|
||||||
#Test sum
|
#Test sum
|
||||||
sum $f >x
|
sum $f >x
|
||||||
@ -201,14 +215,14 @@ cat >answer <<END
|
|||||||
29904 1 $f
|
29904 1 $f
|
||||||
END
|
END
|
||||||
|
|
||||||
if cmp -s x answer; then : ; else echo Error in sum test 1; fi
|
if cmp -s x answer; then : ; else bomb "Error in sum test 1"; fi
|
||||||
|
|
||||||
#Test tee
|
#Test tee
|
||||||
cat $f | tee x >/dev/null
|
cat $f | tee x >/dev/null
|
||||||
if cmp -s x $f; then : ; else echo Error in tee test 1; fi
|
if cmp -s x $f; then : ; else bomb "Error in tee test 1"; fi
|
||||||
|
|
||||||
#Test true
|
#Test true
|
||||||
if true ; then : ; else echo Error in true test 1; fi
|
if true ; then : ; else bomb "Error in true test 1"; fi
|
||||||
|
|
||||||
#Test uniq
|
#Test uniq
|
||||||
cat >x <<END
|
cat >x <<END
|
||||||
@ -225,7 +239,7 @@ cat >answer <<END
|
|||||||
END
|
END
|
||||||
|
|
||||||
uniq <x >y
|
uniq <x >y
|
||||||
if cmp -s y answer; then : ; else echo Error in uniq test 1; fi
|
if cmp -s y answer; then : ; else bomb "Error in uniq test 1"; fi
|
||||||
|
|
||||||
#Test pipelines
|
#Test pipelines
|
||||||
cat >x <<END
|
cat >x <<END
|
||||||
@ -248,13 +262,13 @@ END
|
|||||||
|
|
||||||
prep x | sort | uniq -c >y1
|
prep x | sort | uniq -c >y1
|
||||||
sort <y1 >y
|
sort <y1 >y
|
||||||
if cmp -s y answer; then : ; else echo Error in pipeline test 1; fi
|
if cmp -s y answer; then : ; else bomb "Error in pipeline test 1"; fi
|
||||||
|
|
||||||
cat $f $f $f | sort | uniq >x
|
cat $f $f $f | sort | uniq >x
|
||||||
sort <$f >y
|
sort <$f >y
|
||||||
if cmp -s x y; then : ; else echo Error in pipeline test 2; fi
|
if cmp -s x y; then : ; else bomb "Error in pipeline test 2"; fi
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
rm -rf DIR_SH2
|
rm -rf $TESTDIR
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
Loading…
x
Reference in New Issue
Block a user