updated tester to add post-exec state for clean-up; added a few more tests for reverse
This commit is contained in:
@@ -1 +1 @@
|
|||||||
First simple test of reversing
|
input and output are actually the same file (hardlinked)
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
reverse: input and output file must differ
|
||||||
|
|||||||
1
initial-reverse/tests/5.post
Normal file
1
initial-reverse/tests/5.post
Normal file
@@ -0,0 +1 @@
|
|||||||
|
rm -f tests-out/5.in
|
||||||
1
initial-reverse/tests/5.pre
Normal file
1
initial-reverse/tests/5.pre
Normal file
@@ -0,0 +1 @@
|
|||||||
|
rm -f tests-out/5.in; ln tests/5.in tests-out/5.in
|
||||||
@@ -1 +1 @@
|
|||||||
0
|
1
|
||||||
|
|||||||
@@ -1,2 +1 @@
|
|||||||
./reverse tests/5.in tests-out/5.other
|
./reverse tests/5.in tests-out/5.in
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1 @@
|
|||||||
Standard input test
|
First simple test of reversing
|
||||||
|
|
||||||
|
|||||||
5
initial-reverse/tests/6.in
Normal file
5
initial-reverse/tests/6.in
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
hello
|
||||||
|
this
|
||||||
|
is
|
||||||
|
a
|
||||||
|
test
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
test
|
|
||||||
a
|
|
||||||
is
|
|
||||||
this
|
|
||||||
hello
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
./reverse < tests/5.in
|
./reverse tests/6.in tests-out/6.other
|
||||||
|
|||||||
1
initial-reverse/tests/7.desc
Normal file
1
initial-reverse/tests/7.desc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
standard input test
|
||||||
0
initial-reverse/tests/7.err
Normal file
0
initial-reverse/tests/7.err
Normal file
5
initial-reverse/tests/7.in
Normal file
5
initial-reverse/tests/7.in
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
hello
|
||||||
|
this
|
||||||
|
is
|
||||||
|
a
|
||||||
|
test
|
||||||
5
initial-reverse/tests/7.out
Normal file
5
initial-reverse/tests/7.out
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
test
|
||||||
|
a
|
||||||
|
is
|
||||||
|
this
|
||||||
|
hello
|
||||||
1
initial-reverse/tests/7.rc
Normal file
1
initial-reverse/tests/7.rc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
0
|
||||||
1
initial-reverse/tests/7.run
Normal file
1
initial-reverse/tests/7.run
Normal file
@@ -0,0 +1 @@
|
|||||||
|
./reverse < tests/7.in
|
||||||
@@ -4,13 +4,34 @@
|
|||||||
run_test () {
|
run_test () {
|
||||||
local testdir=$1
|
local testdir=$1
|
||||||
local testnum=$2
|
local testnum=$2
|
||||||
|
local verbose=$3
|
||||||
|
|
||||||
|
# pre: execute this after before the test is done, to set up
|
||||||
local prefile=$testdir/$testnum.pre
|
local prefile=$testdir/$testnum.pre
|
||||||
if [[ -f $prefile ]]; then
|
if [[ -f $prefile ]]; then
|
||||||
eval $(cat $prefile)
|
eval $(cat $prefile)
|
||||||
|
if (( $verbose == 1 )); then
|
||||||
|
echo -n "pre-test: "
|
||||||
|
cat $prefile
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
local testfile=$testdir/$testnum.run
|
local testfile=$testdir/$testnum.run
|
||||||
|
if (( $verbose == 1 )); then
|
||||||
|
echo -n "test: "
|
||||||
|
cat $testfile
|
||||||
|
fi
|
||||||
eval $(cat $testfile) > tests-out/$testnum.out 2> tests-out/$testnum.err
|
eval $(cat $testfile) > tests-out/$testnum.out 2> tests-out/$testnum.err
|
||||||
echo $? > tests-out/$testnum.rc
|
echo $? > tests-out/$testnum.rc
|
||||||
|
|
||||||
|
# post: execute this after the test is done, to clean up
|
||||||
|
local postfile=$testdir/$testnum.post
|
||||||
|
if [[ -f $postfile ]]; then
|
||||||
|
eval $(cat $postfile)
|
||||||
|
if (( $verbose == 1 )); then
|
||||||
|
echo -n "post-test: "
|
||||||
|
cat $postfile
|
||||||
|
fi
|
||||||
|
fi
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +85,7 @@ run_and_check () {
|
|||||||
echo "running test $testnum"
|
echo "running test $testnum"
|
||||||
cat $testdir/$testnum.desc
|
cat $testdir/$testnum.desc
|
||||||
fi
|
fi
|
||||||
run_test $testdir $testnum
|
run_test $testdir $testnum $verbose
|
||||||
rccheck=$(check_test $testdir $testnum $contrunning rc)
|
rccheck=$(check_test $testdir $testnum $contrunning rc)
|
||||||
outcheck=$(check_test $testdir $testnum $contrunning out)
|
outcheck=$(check_test $testdir $testnum $contrunning out)
|
||||||
errcheck=$(check_test $testdir $testnum $contrunning err)
|
errcheck=$(check_test $testdir $testnum $contrunning err)
|
||||||
|
|||||||
Reference in New Issue
Block a user