X-Git-Url: http://nitlanguage.org diff --git a/tests/tests.sh b/tests/tests.sh index 19b278c..02ae121 100755 --- a/tests/tests.sh +++ b/tests/tests.sh @@ -89,6 +89,42 @@ find_nitc() NITC=$recent } +make_alts0() +{ + ii="$1" + xalt="$2" + fs="" + for alt in `sed -n "s/.*#!*\($xalt[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" + fs="$fs $i" + done + echo "$fs" +} +make_alts() +{ + ii="$1" + fs="$1" + for xalt in `sed -n 's/.*#!*\([0-9]*alt\)[0-9]*#.*/\1/p' "$ii" | sort -u`; do + fs2="" + for f in $fs; do + fs2="$fs2 `make_alts0 $f $xalt`" + done + fs="$fs $fs2" + done + echo "$fs" +} + # The default nitc compiler [ -z "$NITC" ] && find_nitc @@ -127,6 +163,7 @@ fi ok="" nok="" + for ii in "$@"; do if [ ! -f $ii ]; then echo "File '$ii' does not exist." @@ -135,37 +172,24 @@ for ii in "$@"; do tmp=${ii/../AA} if [ "x$tmp" = "x$ii" ]; then - oincludes="-I . -I ../lib/standard" + includes="-I . -I ../lib/standard -I ../lib/standard/collection -I alt" else - oincludes="" + includes="-I alt" fi - 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" - includes="$oincludes" - - 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" - includes="$includes -I alt" - fi - ff="$ff$MARK" - - echo -n "=> $i: " + f=`basename "$ii" .nit` + for i in `make_alts $ii`; do + ff=`basename $i .nit` + echo -n "=> $ff: " rm -rf "$ff.res" "$ff.err" "$ff.write" "$ff.bin" 2> /dev/null # Compile if [ "x$verbose" = "xtrue" ]; then echo "" - echo $NITC $OPT -o "$ff.bin" "$i" "$includes" + echo $NITC --no-color $OPT -o "$ff.bin" "$i" "$includes" fi - $NITC $OPT -o "$ff.bin" "$i" $includes 2> "$ff.cmp.err" > "$ff.compile.log" + $NITC --no-color $OPT -o "$ff.bin" "$i" $includes 2> "$ff.cmp.err" > "$ff.compile.log" ERR=$? if [ "x$verbose" = "xtrue" ]; then cat "$ff.compile.log" @@ -182,12 +206,12 @@ for ii in "$@"; do args="" if [ "x$verbose" = "xtrue" ]; then echo "" - echo "./$ff.bin" $args + echo "NIT_NO_STACK=1 ./$ff.bin" $args fi if [ -f "$f.inputs" ]; then - "./$ff.bin" $args < "$f.inputs" > "$ff.res" 2>"$ff.err" + NIT_NO_STACK=1 "./$ff.bin" $args < "$f.inputs" > "$ff.res" 2>"$ff.err" else - "./$ff.bin" $args > "$ff.res" 2>"$ff.err" + NIT_NO_STACK=1 "./$ff.bin" $args > "$ff.res" 2>"$ff.err" fi if [ "x$verbose" = "xtrue" ]; then cat "$ff.res" @@ -212,13 +236,13 @@ for ii in "$@"; do fff=$ff"_args"$cptr if [ "x$verbose" = "xtrue" ]; then echo "" - echo "./$ff.bin" $args + echo "NIT_NO_STACK=1 ./$ff.bin" $args fi echo -n "==> args #"$cptr " " if [ -f "$f.inputs" ]; then - "./$ff.bin" $args < "$f.inputs" > "$fff.res" 2>"$fff.err" + NIT_NO_STACK=1 "./$ff.bin" $args < "$f.inputs" > "$fff.res" 2>"$fff.err" else - sh -c "./$ff.bin ''$args > $fff.res 2>$fff.err" + sh -c "NIT_NO_STACK=1 ./$ff.bin ''$args > $fff.res 2>$fff.err" fi if [ "x$verbose" = "xtrue" ]; then cat "$fff.res"