summaryrefslogtreecommitdiff
path: root/valgrind-audit.in
diff options
context:
space:
mode:
authorGreg Troxel <gdt@ir.bbn.com>2009-12-02 15:47:06 +0000
committerGreg Troxel <gdt@ir.bbn.com>2009-12-02 15:47:06 +0000
commit96d59fdac2b9eee55171ade78a729331a9f92197 (patch)
treea62c813a44d9e3e3ba218750adba8b017bbd77a1 /valgrind-audit.in
parent36d56a924abac976402b0ef0b72703009ab649b6 (diff)
downloadgpsd-96d59fdac2b9eee55171ade78a729331a9f92197.tar.gz
Substitute $PYTHON instead of assuming 'python' is python.
Now 'make check' runs on NetbSD, and $(prefix)/bin/gpsfake works.
Diffstat (limited to 'valgrind-audit.in')
-rw-r--r--valgrind-audit.in92
1 files changed, 92 insertions, 0 deletions
diff --git a/valgrind-audit.in b/valgrind-audit.in
new file mode 100644
index 00000000..43a191c9
--- /dev/null
+++ b/valgrind-audit.in
@@ -0,0 +1,92 @@
+#!@PYTHON@
+#
+# This is a valgrind torture test for the daemon.
+#
+import sys, gpsfake
+
+debuglevel=1
+
+invocation="valgrind --tool=memcheck --gen-suppressions=yes --leak-check=yes --suppressions=valgrind-suppressions"
+test = gpsfake.TestSession(prefix=invocation, options="-D %d" % debuglevel)
+test.progress = sys.stderr.write
+
+try:
+ test.spawn()
+ print "\n*** Test #1: Normal single-client-session behavior."
+ print "**** Add a GPS.\n"
+ gps1 = test.gps_add("test/bu303-moving.log")
+
+ print "\n**** Add and remove a client.\n"
+ c1 = test.client_add("w\n")
+ test.gather(3)
+ test.client_remove(c1)
+
+ print "\n**** Remove the GPS."
+ test.gps_remove(gps1)
+ print "*** Test #1 complete.\n"
+ test.wait(3)
+
+ ######################################################################
+
+ print "\n*** Test #2: Successive non-overlapping client sessions."
+ print "**** Add a GPS.\n"
+ gps1 = test.gps_add("test/bu303-climbing.log")
+
+ print "\n**** Add and remove first client.\n"
+ c1 = test.client_add("w\n")
+ test.gather(3)
+ test.client_remove(c1)
+ test.wait(3)
+
+ print "\n**** Add and remove second client.\n"
+ c2 = test.client_add("w\n")
+ test.gather(3)
+ test.client_remove(c2)
+ test.wait(3)
+
+ print "\n**** Remove the GPS."
+ test.gps_remove(gps1)
+ print "*** Test #2 complete.\n"
+ test.wait(3)
+
+ ######################################################################
+
+ print "\n*** Test #3: Overlapping client sessions."
+ print "**** Add a GPS.\n"
+ gps1 = test.gps_add("test/bu303-climbing.log")
+
+ print "\n**** Add first client.\n"
+ c1 = test.client_add("w\n")
+ test.gather(2)
+ print "\n**** Add second client.\n"
+ c2 = test.client_add("w\n")
+ test.gather(3)
+ print "\n**** Remove first client.\n"
+ test.client_remove(c1)
+ test.gather(2)
+ print "\n**** Remove second client.\n"
+ test.client_remove(c2)
+
+ print "\n**** Remove the GPS."
+ test.gps_remove(gps1)
+ print "*** Test #3 complete.\n"
+
+ ######################################################################
+
+ print "\n*** Test #4: GPS removed while client still active."
+ print "**** Add a GPS.\n"
+ gps1 = test.gps_add("test/bu303-moving.log")
+
+ print "\n**** Add a client.\n"
+ c1 = test.client_add("w\n")
+ test.gather(3)
+ print "\n**** Remove the GPS."
+ test.gps_remove(gps1)
+ test.wait(3)
+ print "\n**** Remove the client.\n"
+ test.client_remove(c1)
+
+ print "*** Test #4 complete.\n"
+ test.cleanup();
+finally:
+ test.killall();