diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2016-03-26 15:01:14 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2016-03-26 15:01:14 -0400 |
commit | 8847ab5bd742c484ea32df0547d60f3c09be872c (patch) | |
tree | 2595a755ff7ddac2b9b58b222add12578c53e13a /valgrind-audit.py | |
parent | 3b9830cfb4bba61bd805435b31274ab1f95a2372 (diff) | |
download | gpsd-8847ab5bd742c484ea32df0547d60f3c09be872c.tar.gz |
De-templatize three files that didn't need it.
Diffstat (limited to 'valgrind-audit.py')
-rwxr-xr-x | valgrind-audit.py | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/valgrind-audit.py b/valgrind-audit.py new file mode 100755 index 00000000..caa56c0a --- /dev/null +++ b/valgrind-audit.py @@ -0,0 +1,103 @@ +#!/usr/bin/env python +# +# This is a valgrind torture test for the gpsd daemon. +# It's not really expected to spot anything as long as we aren't using +# malloc and friends in the daemon. +# +# This file is Copyright (c) 2010 by the GPSD project +# BSD terms apply: see the file COPYING in the distribution root for details. +# +from __future__ import print_function + +import sys, gps.fake + +debuglevel = 1 + +invocation = "valgrind --tool=memcheck --gen-suppressions=yes --leak-check=yes --suppressions=valgrind-suppressions" +test = gps.fake.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/daemon/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/daemon/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/daemon/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/daemon/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") +finally: + test.cleanup() + +# The following sets edit modes for GNU EMACS +# Local Variables: +# mode:python +# End: |