diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2005-06-25 05:32:57 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2005-06-25 05:32:57 +0000 |
commit | 0b172c4b146b0ba50c4c7e17c77c4e2281dd179b (patch) | |
tree | 48841412cd11a5307ed921584bb258612b7a9492 | |
parent | cd08e62279816f1aec35a6b46cc812f3637e8cc4 (diff) | |
download | gpsd-0b172c4b146b0ba50c4c7e17c77c4e2281dd179b.tar.gz |
First version of valgrind torture test.
-rwxr-xr-x | gpsfake | 1 | ||||
-rw-r--r-- | gpsfake.py | 12 | ||||
-rwxr-xr-x | valgrind-audit | 23 | ||||
-rw-r--r-- | valgrind-suppressions | 15 |
4 files changed, 29 insertions, 22 deletions
@@ -115,6 +115,7 @@ except OSError: test.client_add("w+r+\n") test.cleanup(); +test.killall() if progress: baton.end() @@ -245,10 +245,11 @@ class TestSession: newgps.go_predicate = self.default_predicate self.fakegpslist[newgps.slave] = newgps self.daemon.add_device(newgps.slave) + return newgps.slave def gps_remove(self, name): "Remove a simulated GPS from the daeon's search list." self.fakegpslist[name].stop() - self.daemon.remove_device(newgps.slave) + self.daemon.remove_device(name) def client_add(self, commands): "Initiate a client session and force connection to a fake GPS." newclient = gps.gps() @@ -261,7 +262,7 @@ class TestSession: newclient.set_thread_hook(lambda x: self.reporter(x)) if commands: newclient.query(commands) - return newclient + return newclient.id def client_order(self, id, commands): "Ship a command down a client channel, accept a response." for client in self.clients: @@ -296,11 +297,4 @@ class TestSession: if fakegps.thread.isAlive(): fakegps.stop() -if __name__ == "__main__": - #prefix="valgrind --tool=memcheck", - test = TestSession(options="-D 4") - test.gps_add("test/bu303-moving.log") - test.client_add("w\n") - time.sleep(5) - # End diff --git a/valgrind-audit b/valgrind-audit new file mode 100755 index 00000000..f5cd56d6 --- /dev/null +++ b/valgrind-audit @@ -0,0 +1,23 @@ +#!/usr/bin/env python +# +# This is a valgrind torture test for the daemon. +# +import gpsfake + +invocation="valgrind --tool=memcheck --gen-suppressions=yes --suppressions=valgrind-suppressions" +test = gpsfake.TestSession(prefix=invocation, options="-D 3") + +try: + print "*** Add a GPS." + gps1 = test.gps_add("test/bu303-moving.log") + + print "*** Add and remove a client." + c1 = test.client_add("w\n") + test.wait(3) + test.client_remove(c1) + + print "*** Remove a GPS." + test.gps_remove(gps1) +finally: + test.cleanup(); + test.killall() diff --git a/valgrind-suppressions b/valgrind-suppressions index eee8281c..90be3a5f 100644 --- a/valgrind-suppressions +++ b/valgrind-suppressions @@ -1,14 +1,3 @@ # Suppress known C library errors in valgrind. -# This is good under gcc 3.4.2, glibc 2.3.4 -{ - strlen1 - Memcheck:Value8 - fun:vfprintf - fun:vsnprintf - fun:gpsd_report - fun:sirf_parse - fun:sirfbin_parse_input - fun:handle_packet - fun:gpsd_poll - fun:main -} +# This is good under gcc 3.4.2, glibc 2.3.4, using -g and -O2 + |