3 # This is a valgrind torture test for the gpsd daemon.
4 # It's not really expected to spot anything as long as we aren't using
5 # malloc and friends in the daemon.
7 # This file is Copyright (c) 2010 by the GPSD project
8 # BSD terms apply: see the file COPYING in the distribution root for details.
14 invocation="valgrind --tool=memcheck --gen-suppressions=yes --leak-check=yes --suppressions=valgrind-suppressions"
15 test = gps.fake.TestSession(prefix=invocation, options="-D %d" % debuglevel)
16 test.progress = sys.stderr.write
20 print "\n*** Test #1: Normal single-client-session behavior."
21 print "**** Add a GPS.\n"
22 gps1 = test.gps_add("test/daemon/bu303-moving.log")
24 print "\n**** Add and remove a client.\n"
25 c1 = test.client_add("w\n")
27 test.client_remove(c1)
29 print "\n**** Remove the GPS."
31 print "*** Test #1 complete.\n"
34 ######################################################################
36 print "\n*** Test #2: Successive non-overlapping client sessions."
37 print "**** Add a GPS.\n"
38 gps1 = test.gps_add("test/daemon/bu303-climbing.log")
40 print "\n**** Add and remove first client.\n"
41 c1 = test.client_add("w\n")
43 test.client_remove(c1)
46 print "\n**** Add and remove second client.\n"
47 c2 = test.client_add("w\n")
49 test.client_remove(c2)
52 print "\n**** Remove the GPS."
54 print "*** Test #2 complete.\n"
57 ######################################################################
59 print "\n*** Test #3: Overlapping client sessions."
60 print "**** Add a GPS.\n"
61 gps1 = test.gps_add("test/daemon/bu303-climbing.log")
63 print "\n**** Add first client.\n"
64 c1 = test.client_add("w\n")
66 print "\n**** Add second client.\n"
67 c2 = test.client_add("w\n")
69 print "\n**** Remove first client.\n"
70 test.client_remove(c1)
72 print "\n**** Remove second client.\n"
73 test.client_remove(c2)
75 print "\n**** Remove the GPS."
77 print "*** Test #3 complete.\n"
79 ######################################################################
81 print "\n*** Test #4: GPS removed while client still active."
82 print "**** Add a GPS.\n"
83 gps1 = test.gps_add("test/daemon/bu303-moving.log")
85 print "\n**** Add a client.\n"
86 c1 = test.client_add("w\n")
88 print "\n**** Remove the GPS."
91 print "\n**** Remove the client.\n"
92 test.client_remove(c1)
94 print "*** Test #4 complete.\n"
98 # The following sets edit modes for GNU EMACS