[SCM] Lisaac compiler branch, stable, updated. lisaac-0.12-596-g866a2a2
Mildred Ki'Lya
silkensedai at online.fr
Wed Nov 11 14:25:51 UTC 2009
The following commit has been merged in the stable branch:
commit 866a2a2bcebf055a4d7442f2e4d1c12fbd0a712c
Author: Mildred Ki'Lya <silkensedai at online.fr>
Date: Wed Nov 11 15:17:40 2009 +0100
Add bootstrap test in unified test suite
diff --git a/run-tests.sh b/run-tests.sh
index 5e6759b..e7be8fd 100755
--- a/run-tests.sh
+++ b/run-tests.sh
@@ -4,6 +4,8 @@ self="$(cd "$(dirname "$0")"; pwd)/$(basename "$0")"
op_default=true
op_runcwd=false
op_testname="`pwd`"
+op_importance=0
+op_importance_max=-1
while [ $# -gt 0 ]; do
case "$1" in
@@ -14,6 +16,37 @@ while [ $# -gt 0 ]; do
op_runcwd=true
shift 2
;;
+ -i)
+ op_importance="$2"
+ shift 2
+ ;;
+ -I)
+ op_importance_max="$2"
+ shift 2
+ ;;
+ -h|-help|--help)
+ echo "NAME"
+ echo " run-tests.sh - automatically run tests for the Lisaac compiler"
+ echo
+ echo "SYNOPSIS"
+ echo " run-tests.sh [OPTIONS]"
+ echo
+ echo "OPTIONS"
+ echo
+ echo " -h, -help, --help"
+ echo " Show this help"
+ echo
+ echo " -i IMPORTANCE"
+ echo " Run only tests that have an importance greater or equal to"
+ echo " IMPORTANCE"
+ echo
+ echo " -I IMPORTANCE"
+ echo " Run only tests that have an importance less than IMPORTANCE"
+ echo
+ echo " -d DIR"
+ echo " Run test in DIR"
+ exit 0
+ ;;
*)
shift
break
@@ -21,41 +54,6 @@ while [ $# -gt 0 ]; do
esac
done
-if $op_default; then
- cd "`dirname "$0"`"
- if [ -x bin/lisaac -o -x shorter ]; then
- echo "Add to PATH: `pwd`/bin"
- export PATH="`pwd`/bin:$PATH"
- fi
- if [ -x lisaac -o -x shorter ]; then
- echo "Add to PATH: `pwd`"
- export PATH="`pwd`:$PATH"
- fi
- n=0
- failed=()
- for f in tests/*; do
- if [ -d "$f" ]; then
- "$self" -d "$f"
- res=$?
- if [ $res != 0 ]; then
- failed=("${failed[@]}" $f)
- fi
- n=$(($n+$res))
- fi
- done
- echo
- if [ $n = 0 ]; then
- echo "*** SUCCESS ***"
- else
- echo "*** FAILURE ***"
- for f in "${failed[@]}"; do
- echo " - $f"
- done
- echo
- fi
- exit $n
-fi
-
header(){
local max="$1"
local char="$2"
@@ -93,10 +91,22 @@ test-patterns(){
return 0
}
-if $op_runcwd; then
+run_test(){
+ local oldcwd="`pwd`"
+ local res
+ if [ -n "$1" ]; then
+ cd "$1"
+ fi
+ imp="`lisaac -test-importance`"
+ if [ "0$imp" -lt "0$op_importance" ] || ( \
+ [ 0 -le "$op_importance_max" ] && [ "0$imp" -ge "0$op_importance_max" ] )
+ then
+ cd "$oldcwd"
+ return 0
+ fi
res=1
echo
- header 80 '*' "$op_testname"
+ header 80 '*' "$(basename "`pwd`") ($imp)"
if [ -f test.sh -a -x test.sh ]; then
./test.sh
res=$?
@@ -150,6 +160,19 @@ if $op_runcwd; then
echo "$compile"
fi
fi
+ if [ $res = 0 ]; then
+ local test_execute=$(lisaac -test-execute)
+ if [ -n "$test_execute" ]; then
+ echo $test_execute
+ $test_execute
+ echo
+ if [ $res != 0 ]; then
+ echo " - Execution: $res"
+ else
+ echo " - Execution: ok"
+ fi
+ fi
+ fi
else
echo "Unknown test: $op_testname"
fi
@@ -160,7 +183,48 @@ if $op_runcwd; then
fi
header 80 '*'
echo
- exit $res
+ cd "$oldcwd"
+ return $res
+}
+
+
+if $op_default; then
+ cd "`dirname "$0"`"
+ if [ -x bin/lisaac -o -x shorter ]; then
+ echo "Add to PATH: `pwd`/bin"
+ export PATH="`pwd`/bin:$PATH"
+ fi
+ if [ -x lisaac -o -x shorter ]; then
+ echo "Add to PATH: `pwd`"
+ export PATH="`pwd`:$PATH"
+ fi
+ n=0
+ failed=()
+ for f in tests/*; do
+ if [ -d "$f" ]; then
+ run_test "$f"
+ res=$?
+ if [ $res != 0 ]; then
+ failed=("${failed[@]}" $f)
+ fi
+ n=$(($n+$res))
+ fi
+ done
+ echo
+ if [ $n = 0 ]; then
+ echo "*** SUCCESS ***"
+ else
+ echo "*** FAILURE ***"
+ for f in "${failed[@]}"; do
+ echo " - $f"
+ done
+ echo
+ fi
+ exit $n
+fi
+
+if $op_runcwd; then
+ run_test
fi
exit 0
diff --git a/tests/expanded_global2/make.lip b/tests/bootstrap/make.lip
similarity index 89%
copy from tests/expanded_global2/make.lip
copy to tests/bootstrap/make.lip
index 2ac6ef7..e02067f 100644
--- a/tests/expanded_global2/make.lip
+++ b/tests/bootstrap/make.lip
@@ -27,14 +27,14 @@ Section Inherit
Section Private
+ + m_test_importance :INTEGER := 10;
+ + m_test_description :STRING := "Boostrap test\n";
+ + m_test_run :BOOLEAN := FALSE;
+ + m_test_execute :STRING := "../bootstrap.sh";
+
- front_end <-
(
- general_front_end;
- path "./*";
- input_file := "main";
+ exit_true;
);
+
- + m_test_description :STRING :=
- "Test that Expanded globals are compiled correctly\n";
-
- + m_test_run_pattern :STRING := "0";
diff --git a/tests/test.lip b/tests/test.lip
index ff8d4b4..5a8aed3 100644
--- a/tests/test.lip
+++ b/tests/test.lip
@@ -31,11 +31,13 @@ Section Private
die_with_code 1;
);
- + m_test_description :STRING := "<NO DESCRIPTION>\n";
- + m_test_compile :BOOLEAN := TRUE;
- + m_test_run :BOOLEAN := TRUE;
- + m_test_compile_pattern :STRING := "";
- + m_test_run_pattern :STRING := "";
+ + m_test_description :STRING := "<NO DESCRIPTION>\n";
+ + m_test_importance :INTEGER := 0;
+ + m_test_compile :BOOLEAN := TRUE;
+ + m_test_run :BOOLEAN := TRUE;
+ + m_test_execute :STRING := "";
+ + m_test_compile_pattern :STRING := "";
+ + m_test_run_pattern :STRING := "";
Section Public
@@ -51,6 +53,13 @@ Section Public
exit_true;
);
+ - test_importance <-
+ // How important is the test (integer)
+ (
+ m_test_importance.print;
+ exit_true;
+ );
+
- test_compile <-
// Exit successfully if the compilation must succeed
(
@@ -71,6 +80,13 @@ Section Public
};
);
+ - test_execute <-
+ // Command to execute for the test to succeed
+ (
+ m_test_execute.print;
+ exit_true;
+ );
+
- test_compile_patterns <-
// Regular expressions that must be found in the result of the compilation for
// the test to succeed
--
Lisaac compiler
More information about the Lisaac-commits
mailing list