3 # Execute DAS' test-suite
5 # Luiz Fernando N. Capitulino
6 # <lcapitulino@gmail.com>
15 echo "usage: $PNAME [ options ]"
18 echo " -h,--help this text"
19 echo " -p1,--pass1 run only first pass tests"
20 echo " -p2,--pass2 run only second pass tests"
21 echo " -err,--error run only error tests"
22 echo " -p,--program run only programs tests"
31 cmp -s $expected $output
43 local input
=${file}.asm
44 local output
=${file}.out
45 local expected
=${file}.
${ext}
47 $DAS -o /dev
/null
$input &> $output
52 compare_files
$expected $output
62 local input
=${file}.asm
63 local output
=${file}.out
64 local expected
=${file}.
${ext}
66 $DAS $opt -o $output $input
71 compare_files
$expected $output
83 passed_per
=$
(expr 100 \
* $nr_passed)
84 passed_per
=$
(expr $passed_per / $nr_tests)
86 printf "\n -> %d%% passed" $passed_per
87 printf " [ %d tests %d pass %d error ]\n" $nr_tests \
104 if [ "$ext" = "p1" ]; then
105 # das should only execute
110 printf "* %s tests\n\n" "$message"
112 for file in $asm_files; do
114 printf "\t%-10s " $file
115 $testfunc "$file" "$ext" "$opt"
117 if [ $ret -eq 0 ]; then
121 printf "FAILED [ %d ]\n" $ret
126 report_results
$nr_tests $nr_passed $nr_failed
129 # Collect command-line options
131 while [ $# -gt 0 ]; do
158 echo "ERROR: unknown option '$1'" > /dev
/stderr
169 if [ $P1_TESTS -eq 1 ]; then
170 run_test
"$P1_NAME" "$P1_FILES" "$P1_EXT" "$P1_TEST"
173 if [ $P2_TESTS -eq 1 ]; then
174 run_test
"$P2_NAME" "$P2_FILES" "$P2_EXT" "$P2_TEST"
177 if [ $ERR_TESTS -eq 1 ]; then
178 run_test
"$ERR_NAME" "$ERR_FILES" "$ERR_EXT" "$ERR_TEST"
181 if [ $PROG_TESTS -eq 1 ]; then
182 run_test
"$PROG_NAME" "$PROG_FILES" "$PROG_EXT" "$PROG_TEST"