X-Git-Url: http://nitlanguage.org
diff --git a/tests/tests.sh b/tests/tests.sh
index ead5484..3fd5510 100755
--- a/tests/tests.sh
+++ b/tests/tests.sh
@@ -21,7 +21,7 @@
export LANG=C
export LC_ALL=C
export NIT_TESTING=true
-export MNIT_SRAND=0
+export NIT_SRAND=0
unset NIT_DIR
@@ -35,7 +35,7 @@ JNI_LIB_PATH=`dirname ${paths[0]}`
shopt -u nullglob
outdir="out"
-compdir=".nit_compile"
+compdir="nit_compile"
usage()
{
@@ -48,8 +48,9 @@ Usage: $e [options] modulenames
--engine Use a specific engine (default=nitc)
--noskip Do not skip a test even if the .skip file matches
--outdir Use a specific output folder (default=out/)
---compdir Use a specific temporary compilation folder (default=.nit_compile)
+--compdir Use a specific temporary compilation folder (default=$compdir)
--node Run as a node in parallel, will not output context information
+--autosav Copy the .res files directly in the sav folder overriding existing .res files
END
}
@@ -234,6 +235,7 @@ function process_result()
echo "[*ok*] $outdir/$pattern.res $SAV - but $OLD remains!"
echo >>$xml ""
remains="$remains $OLD"
+ test "$autosav" = "true" && rm "$OLD"
else
echo "[ok] $outdir/$pattern.res $SAV"
fi
@@ -243,6 +245,7 @@ function process_result()
echo "[*fixme*] $outdir/$pattern.res $FIXME - but $OLD remains!"
echo >>$xml ""
remains="$remains $OLD"
+ test "$autosav" = "true" && rm "$OLD"
else
echo "[fixme] $outdir/$pattern.res $FIXME"
echo >>$xml ""
@@ -260,6 +263,7 @@ function process_result()
echo >>$xml "]]>"
nok="$nok $pattern"
echo "$ii" >> "$ERRLIST"
+ test "$autosav" = "true" && cp "$outdir/$pattern.res" "$SOSO"
elif [ -n "$SOSOF" ]; then
echo "[======= fixme soso $outdir/$pattern.res $SOSOF =======]"
echo >>$xml ""
@@ -268,6 +272,7 @@ function process_result()
echo >>$xml "]]>"
nok="$nok $pattern"
echo "$ii" >> "$ERRLIST"
+ test "$autosav" = "true" && cp "$outdir/$pattern.res" && "$SOSO"
elif [ -n "$NSAV" ]; then
echo "[======= fail $outdir/$pattern.res $NSAV =======]"
echo >>$xml ""
@@ -276,6 +281,7 @@ function process_result()
echo >>$xml "]]>"
nok="$nok $pattern"
echo "$ii" >> "$ERRLIST"
+ test "$autosav" = "true" && cp "$outdir/$pattern.res" "$NSAV"
elif [ -n "$NFIXME" ]; then
echo "[======= changed $outdir/$pattern.res $NFIXME ======]"
echo >>$xml ""
@@ -284,6 +290,7 @@ function process_result()
echo >>$xml "]]>"
nok="$nok $pattern"
echo "$ii" >> "$ERRLIST"
+ test "$autosav" = "true" && cp "$outdir/$pattern.res" "$NFIXME"
elif [ -s "$outdir/$pattern.res" ]; then
echo "[=== no sav ===] $outdir/$pattern.res is not empty"
echo >>$xml ""
@@ -292,6 +299,7 @@ function process_result()
echo >>$xml "]]>"
nos="$nos $pattern"
echo "$ii" >> "$ERRLIST"
+ test "$autosav" = "true" && cp "$outdir/$pattern.res" "sav/"
else
# no sav but empty res
echo "[0k] $outdir/$pattern.res is empty"
@@ -364,6 +372,7 @@ find_nitc()
verbose=false
isnode=false
+autosav=false
stop=false
engine=nitc
noskip=
@@ -378,6 +387,7 @@ while [ $stop = false ]; do
--outdir) outdir="$2"; shift; shift;;
--compdir) compdir="$2"; shift; shift;;
--node) isnode=true; shift;;
+ --autosav) autosav=true; shift;;
*) stop=true
esac
done
@@ -554,6 +564,8 @@ END
cat -- "$ff.compile.log"
cat >&2 -- "$ff.cmp.err"
fi
+ # Clean
+ rm -r "$compdir" 2>/dev/null
fi
if [ "$engine" = "emscripten" ]; then
echo > "$ff.bin" "nodejs $ffout \"\$@\""