summaryrefslogtreecommitdiffstats
path: root/bigint/run-testsuite
diff options
context:
space:
mode:
authorKyle K <kylek389@gmail.com>2011-02-18 19:10:16 -0600
committerKamil Kaminski <kamilkss@gmail.com>2011-02-18 19:10:16 -0600
commit2d1eb462fe119d34568e1652b8107fd552c15025 (patch)
tree807211ec709b45b2339149adb6fbb5f51d47e569 /bigint/run-testsuite
parentec58cdb26cc89df9b9bbb0e33fe843e5b4284955 (diff)
downloadrsacrypt-2d1eb462fe119d34568e1652b8107fd552c15025.tar.gz
rsacrypt-2d1eb462fe119d34568e1652b8107fd552c15025.tar.bz2
rsacrypt-2d1eb462fe119d34568e1652b8107fd552c15025.zip
begin crypt
Diffstat (limited to 'bigint/run-testsuite')
-rwxr-xr-xbigint/run-testsuite37
1 files changed, 37 insertions, 0 deletions
diff --git a/bigint/run-testsuite b/bigint/run-testsuite
new file mode 100755
index 0000000..ff73729
--- /dev/null
+++ b/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