summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlasdair Armstrong2017-07-03 18:46:46 +0100
committerAlasdair Armstrong2017-07-03 18:46:46 +0100
commit8b8f868fc585ce94a9dbe6c39d9b14288f3a6611 (patch)
treefbc8e46caa4f21307f20871c46682949a1911273
parentf9e0b95b220cff4c7d2fafb578342644fe6c9ebd (diff)
Added test suite XML output for jenkins
-rwxr-xr-xtest/typecheck/run_tests.sh62
1 files changed, 49 insertions, 13 deletions
diff --git a/test/typecheck/run_tests.sh b/test/typecheck/run_tests.sh
index a333901b..8a5bc01b 100755
--- a/test/typecheck/run_tests.sh
+++ b/test/typecheck/run_tests.sh
@@ -13,53 +13,84 @@ mkdir -p $DIR/rtpass
mkdir -p $DIR/lem
mkdir -p $DIR/rtfail
+rm $DIR/tests.xml
+
pass=0
fail=0
+XML=""
+
+function green {
+ printf "$1: ${GREEN}$2${NC}\n"
+ XML+=" <testcase name=\"$1\"/>\n"
+}
+
+function yellow {
+ printf "$1: ${YELLOW}$2${NC}\n"
+ XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n"
+}
+
+function red {
+ printf "$1: ${RED}$2${NC}\n"
+ XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n"
+}
+
+function finish_suite {
+ printf "$1: Passed ${pass} out of $(( pass + fail ))\n"
+ XML=" <testsuite name=\"$1\" tests=\"$(( pass + fail ))\" failures=\"${fail}\" timestamp=\"$(date)\">\n$XML </testsuite>\n"
+ printf "$XML" >> $DIR/tests.xml
+ XML=""
+ pass=0
+ fail=0
+}
+
+printf "<testsuites>\n" >> $DIR/tests.xml
+
for i in `ls $DIR/pass/`;
do
- printf "testing $i expecting pass: "
if $SAILDIR/sail -ddump_tc_ast -just_check $DIR/pass/$i 2> /dev/null 1> $DIR/rtpass/$i;
then
if $SAILDIR/sail -dno_cast -just_check $DIR/rtpass/$i 2> /dev/null;
then
(( pass += 2))
- printf "${GREEN}pass${NC}\n"
+ green "tested $i expecting pass" "pass"
else
(( fail += 1 ))
(( pass += 1 ))
- printf "${YELLOW}pass but failed re-check${NC}\n"
+ yellow "tested $i expecting pass" "pass but failed re-check"
fi
else
(( fail += 2 ))
- printf "${RED}fail${NC}\n"
+ red "tested $i expecting pass" "fail"
fi
done
+finish_suite "Expecting pass"
+
for i in `ls $DIR/fail/`;
do
- printf "testing $i expecting fail: "
if $SAILDIR/sail -ddump_tc_ast -just_check $DIR/fail/$i 2> /dev/null 1> $DIR/rtfail/$i;
then
(( fail += 2 ))
- printf "${RED}pass${NC}\n"
+ red "tested $i expecting fail" "pass"
else
if $SAILDIR/sail -dno_cast -just_check $DIR/rtfail/$i 2> /dev/null;
then
(( fail += 1 ))
(( pass += 1 ))
- printf "${YELLOW}fail but passed re-check${NC}\n"
+ yellow "tested $i expecting fail" "failed but passed re-check"
else
(( pass += 2 ))
- printf "${GREEN}fail${NC}\n"
+ green "tested $i expecting fail" "fail"
fi
fi
done
+finish_suite "Expecting fail"
+
function test_lem {
for i in `ls $DIR/pass/`;
do
- printf "generating lem for $1/$i: "
if $SAILDIR/sail -lem $DIR/$1/$i 2> /dev/null
then
mv $SAILDIR/${i%%.*}_embed_types.lem $DIR/lem/
@@ -68,19 +99,24 @@ function test_lem {
if lem -lib $SAILDIR/src/lem_interp -lib $SAILDIR/src/gen_lib/ $DIR/lem/${i%%.*}_embed_types.lem $DIR/lem/${i%%.*}_embed.lem 2> /dev/null
then
(( pass += 1 ))
- printf "${GREEN}pass${NC}\n"
+ green "generated lem for $1/$i" "pass"
else
(( fail += 1 ))
- printf "${RED}fail${NC}\n"
+ red "generated lem for $1/$i" "failed to typecheck lem"
fi
else
(( fail += 1 ))
- printf "${RED}failed to generate lem!${NC}\n"
+ red "generated lem for $1/$i" "failed to generate lem"
fi
done
}
test_lem pass
+
+finish_suite "Lem generation 1"
+
test_lem rtpass
-printf "Passed ${pass} out of $(( pass + fail ))\n"
+finish_suite "Lem generation 2"
+
+printf "</testsuites>\n" >> $DIR/tests.xml