summaryrefslogtreecommitdiff
path: root/CC/test/test_runner.sh
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2022-02-22 17:03:21 +0100
committerKlaus Aehlig <klaus.aehlig@huawei.com>2022-02-22 17:03:21 +0100
commit86c4f55b6f578bfae74ab35151c1e4425b7e1fd1 (patch)
treea0eb1319d6449726f345b7c2f237c3fbffa71096 /CC/test/test_runner.sh
downloadrules-cc-86c4f55b6f578bfae74ab35151c1e4425b7e1fd1.tar.gz
Initial self-hosting commit
This is the initial version of our tool that is able to build itself. In can be bootstrapped by ./bin/bootstrap.py Co-authored-by: Oliver Reiche <oliver.reiche@huawei.com> Co-authored-by: Victor Moreno <victor.moreno1@huawei.com>
Diffstat (limited to 'CC/test/test_runner.sh')
-rw-r--r--CC/test/test_runner.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/CC/test/test_runner.sh b/CC/test/test_runner.sh
new file mode 100644
index 0000000..ed9f48a
--- /dev/null
+++ b/CC/test/test_runner.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+# ensure all required outputs are present
+touch stdout
+touch stderr
+RESULT=UNKNOWN
+echo "${RESULT}" > result
+echo UNKNOWN > time-start
+echo UNKNOWN > time-stop
+
+mkdir scratch
+export TEST_TMPDIR=$(realpath scratch)
+# Change to the working directory; note: the test might not
+# have test data, so we have to ensure the presence of the work
+# directory.
+
+mkdir -p work
+cd work
+
+date +%s > ../time-start
+# TODO:
+# - proper wrapping with timeout
+# - test arguments to select specific test cases
+if ../test > ../stdout 2> ../stderr
+then
+ RESULT=PASS
+else
+ RESULT=FAIL
+fi
+date +%s > ../time-stop
+echo "${RESULT}" > result
+
+if [ "${RESULT}" '!=' PASS ]
+then
+ exit 1;
+fi