summaryrefslogtreecommitdiff
path: root/scripts/run-test
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2025-08-22 15:27:17 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2025-08-22 15:27:17 +0300
commitb0d619e2c9595f4ec05463e87be9d0d3423c0a70 (patch)
treedfcda5da356b660fadb8b133772c926c08908cbb /scripts/run-test
parent7774ae2f8c2dca9ab2d93082856f031e78a1b5f0 (diff)
downloadconts-b0d619e2c9595f4ec05463e87be9d0d3423c0a70.tar.gz
conts-b0d619e2c9595f4ec05463e87be9d0d3423c0a70.zip
use covsrv for coverage testing
Diffstat (limited to 'scripts/run-test')
-rwxr-xr-xscripts/run-test31
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/run-test b/scripts/run-test
new file mode 100755
index 0000000..05ddfe1
--- /dev/null
+++ b/scripts/run-test
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+TEST="$1"
+NAME=$(basename "$TEST")
+
+mkdir -p "reports/$NAME"
+
+I=0
+while :; do
+ # if no error happened, consider it a pass
+ if valgrind -q --leak-check=full --error-exitcode=1 \
+ "./$TEST" > "reports/$NAME/run-$I" 2>&1
+ then
+ echo "$NAME: PASSED"
+ exit 0
+ fi
+
+ if grep 'loss record' "reports/$NAME/run-$I" >/dev/null; then
+ echo "$NAME: MEM FAILED"
+ exit 1
+ fi
+
+ # an error occured, was it handled properly?
+ if grep 'COVSRV: EXIT' "reports/$NAME/run-$I" >/dev/null; then
+ I=$((I+1))
+ continue
+ fi
+
+ echo "$NAME: FAILED"
+ exit 1
+done