aboutsummaryrefslogtreecommitdiffstats
path: root/libs/bigint/run-testsuite
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2013-02-27 09:32:19 +0100
committerClifford Wolf <clifford@clifford.at>2013-02-27 09:32:19 +0100
commita321a5c412090d04dfaea4b4876c4901c42cfe44 (patch)
treeb08d286e0aea76be9aab7a543df0b51e76b6ede4 /libs/bigint/run-testsuite
parent4f0c2862a0d7e1ca247e0a4d54301c7f8cc92fd8 (diff)
downloadyosys-a321a5c412090d04dfaea4b4876c4901c42cfe44.tar.gz
yosys-a321a5c412090d04dfaea4b4876c4901c42cfe44.tar.bz2
yosys-a321a5c412090d04dfaea4b4876c4901c42cfe44.zip
Moved stand-alone libs to libs/ directory and added libs/subcircuit
Diffstat (limited to 'libs/bigint/run-testsuite')
-rwxr-xr-xlibs/bigint/run-testsuite37
1 files changed, 37 insertions, 0 deletions
diff --git a/libs/bigint/run-testsuite b/libs/bigint/run-testsuite
new file mode 100755
index 000000000..ff7372916
--- /dev/null
+++ b/libs/bigint/run-testsuite
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+bad=
+
+# If you encounter the following problem with Valgrind like I did:
+# https://bugzilla.redhat.com/show_bug.cgi?id=455644
+# you can pass the environment variable NO_VALGRIND=1 to run the testsuite
+# without it.
+if [ "$NO_VALGRIND" ]; then
+ cmd=(./testsuite)
+else
+ cmd=(valgrind --error-exitcode=1 --leak-check=full ./testsuite)
+fi
+
+set -o pipefail
+# Stdout goes directly to testsuite.out; stderr goes down the pipe.
+if ! "${cmd[@]}" 2>&1 >testsuite.out | tee testsuite.err; then
+ echo >&2 'Memory errors!'
+ bad=1
+fi
+
+if grep 'LEAK SUMMARY' testsuite.err >/dev/null; then
+ echo >&2 'Memory leaks!'
+ bad=1
+fi
+
+if ! diff -u testsuite.expected testsuite.out; then
+ echo >&2 'Output is incorrect!'
+ bad=1
+fi
+
+if [ $bad ]; then
+ echo >&2 'Test suite failed!'
+ exit 1
+else
+ echo 'Test suite passed.'
+fi