From 875406c4e671ceb900cedf60f2d1a0f3f2eb8a94 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Wed, 3 Jun 2009 11:32:01 -0400 Subject: [PATCH] tests: remove broken HTML output Signed-off-by: Jean Privat --- tests/tests.sh | 140 ++++++++++++++++++++++---------------------------------- 1 file changed, 55 insertions(+), 85 deletions(-) diff --git a/tests/tests.sh b/tests/tests.sh index 1b45228..5b4de38 100755 --- a/tests/tests.sh +++ b/tests/tests.sh @@ -24,111 +24,81 @@ # Options to use with the ruby compiler # OPT= -# Mark to distinguish files among tests +# Mark to distinguish files among tests # MARK= if [ $# = 0 ]; then echo "usage: $0 file.nit ..." fi -if [ -z "$HTM" ]; then - HTM=/dev/null -elif [ ! -f "$HTM" ]; then - echo "" > $HTM - echo "" >> $HTM - for i in "$@"; do - f=`echo $i | cut -f1 -d.` - echo -n "" >> $HTM - done - echo "" >> $HTM -fi - ok="" nok="" -echo "" >> $HTM for ii in "$@"; do - for alt in "" `sed -n 's/.*#!*\(alt[0-9]*\)#.*/\1/p' "$ii" | sort -u`; do - f=`basename "$ii" .nit` - d=`dirname "$ii"` - ff="$f" - i="$ii" - if [ "x$alt" != "x" ]; then - test -d alt || mkdir -p alt - i="alt/${f}_$alt.nit" - ff="${ff}_$alt" - sed "s/#$alt#//g;/#!$alt#/d" "$ii" > "$i" - fi - ff="$ff$MARK" + for alt in "" `sed -n 's/.*#!*\(alt[0-9]*\)#.*/\1/p' "$ii" | sort -u`; do + f=`basename "$ii" .nit` + d=`dirname "$ii"` + ff="$f" + i="$ii" + if [ "x$alt" != "x" ]; then + test -d alt || mkdir -p alt + i="alt/${f}_$alt.nit" + ff="${ff}_$alt" + sed "s/#$alt#//g;/#!$alt#/d" "$ii" > "$i" + fi + ff="$ff$MARK" - echo -n "=> $i: " - - rm "$ff.res" "$ff.err" "$ff.write" 2> /dev/null + echo -n "=> $i: " - # Compile - $NITC $OPT -o "$f.bin" "$i" -I . -I alt -I ../lib/standard 2> "$ff.cmp.err" > "$ff.compile.log" - ERR=$? - mv "$f.bin" "$ff.bin" 2> /dev/null - egrep '^[A-Z0-9_]*$' "$ff.compile.log" > "$ff.res" - echo -n "" >> $HTM - done + done done echo "ok: " `echo $ok | wc -w` "/" `echo $ok $nok $nos | wc -w` -echo "" >> $HTM if [ -n "$nok" ]; then echo "fail: $nok" -- 1.7.9.5
Mode$f" >> $HTM - if [ -r "sav/$f.sav" ]; then - echo -n " - sav" >> $HTM - fi - if [ -f "$f.inputs" ]; then - echo -n " - inputs" >> $HTM - fi - echo "okfails
$MARKcompil " >> $HTM - if [ "$ERR" != 0 ]; then - echo -n "! " - echo -n "fail - " >> $HTM - cp "$ff.cmp.err" "$ff.res" - else - echo -n ". " - echo -n "ok - " >> $HTM - # Execute - if [ -f "$f.args" ]; then - args=`cat "$f.args"` - else - args="" - fi - if [ -f "$f.inputs" ]; then - "./$ff.bin" $args < "$f.inputs" > "$ff.res" 2>"$ff.err" + rm "$ff.res" "$ff.err" "$ff.write" 2> /dev/null + + # Compile + $NITC $OPT -o "$f.bin" "$i" -I . -I alt -I ../lib/standard 2> "$ff.cmp.err" > "$ff.compile.log" + ERR=$? + mv "$f.bin" "$ff.bin" 2> /dev/null + egrep '^[A-Z0-9_]*$' "$ff.compile.log" > "$ff.res" + if [ "$ERR" != 0 ]; then + echo -n "! " + cp "$ff.cmp.err" "$ff.res" else - "./$ff.bin" $args > "$ff.res" 2>"$ff.err" + echo -n ". " + # Execute + if [ -f "$f.args" ]; then + args=`cat "$f.args"` + else + args="" + fi + if [ -f "$f.inputs" ]; then + "./$ff.bin" $args < "$f.inputs" > "$ff.res" 2>"$ff.err" + else + "./$ff.bin" $args > "$ff.res" 2>"$ff.err" + fi + if [ -f "$ff.write" ]; then + cat "$ff.write" >> "$ff.res" + fi + if [ -s "$ff.err" ]; then + cat "$ff.err" >> "$ff.res" + fi fi - if [ -f "$ff.write" ]; then - cat "$ff.write" >> "$ff.res" - echo -n "write - " >> $HTM - fi - if [ -s "$ff.err" ]; then - cat "$ff.err" >> "$ff.res" - echo -n "err - " >> $HTM - fi - fi - # Result - if [ -r "sav/$ff.sav" ]; then - diff "$ff.res" "sav/$ff.sav" > "$ff.diff.log" - if [ "$?" == 0 ]; then - echo "[ok] $ff.res" - ok="$ok $ff" - echo -n "res ok" >> $HTM + # Result + if [ -r "sav/$ff.sav" ]; then + diff -u "$ff.res" "sav/$ff.sav" > "$ff.diff.log" + if [ "$?" == 0 ]; then + echo "[ok] $ff.res" + ok="$ok $ff" + else + echo "[======= fail $ff.res sav/$ff.sav =======]" + nok="$nok $ff" + fi else - echo "[======= fail $ff.res sav/$ff.sav =======]" - nok="$nok $ff" - echo -n "res fail - diff" >> $HTM + echo "[=== no sav ===] $ff.res" + nos="$nos $ff" fi - else - echo "[=== no sav ===] $ff.res" - echo -n "res" >> $HTM - nos="$nos $ff" - fi - echo "" `echo $ok | wc -w` "" `echo $nok | wc -w` "