2 # This file is part of GNUnet.
3 # (C) 2010 Christian Grothoff (and other contributing authors)
5 # GNUnet is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published
7 # by the Free Software Foundation; either version 2, or (at your
8 # option) any later version.
10 # GNUnet is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with GNUnet; see the file COPYING. If not, write to the
17 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 # Boston, MA 02111-1307, USA.
22 # This test starts 3 peers and expects bootstrap and a connected clique
24 # Conditions for successful exit:
25 # Both peers have 1 connected peer in transport, core, topology, fs
33 from gnunet_testing import Peer
34 from gnunet_testing import Test
35 from gnunet_testing import Check
36 from gnunet_testing import Condition
37 from gnunet_testing import *
40 tmp = os.getenv ("TEMP")
46 testname = "test_integration_clique"
52 shutil.rmtree (os.path.join (tmp, "c_bootstrap_server"), True)
53 shutil.rmtree (os.path.join (tmp, "c_no_nat_client"), True)
54 shutil.rmtree (os.path.join (tmp, "c_no_nat_client_2"), True)
58 def check_disconnect ():
60 check.add (StatisticsCondition (client, 'transport', '# peers connected',1))
61 check.add (StatisticsCondition (client, 'core', '# neighbour entries allocated',1))
62 check.add (StatisticsCondition (client, 'core', '# peers connected',1))
63 check.add (StatisticsCondition (client, 'topology', '# peers connected',1))
64 check.add (StatisticsCondition (client, 'fs', '# peers connected',1))
66 check.add (StatisticsCondition (server, 'transport', '# peers connected',1))
67 check.add (StatisticsCondition (server, 'core', '# neighbour entries allocated',1))
68 check.add (StatisticsCondition (server, 'core', '# peers connected',1))
69 check.add (StatisticsCondition (server, 'topology', '# peers connected',1))
70 check.add (StatisticsCondition (server, 'fs', '# peers connected',1))
72 check.run_blocking (check_timeout, None, None)
78 check.add (StatisticsCondition (client, 'transport', '# peers connected',2))
79 check.add (StatisticsCondition (client, 'core', '# neighbour entries allocated',2))
80 check.add (StatisticsCondition (client, 'core', '# peers connected',2))
81 check.add (StatisticsCondition (client, 'topology', '# peers connected',2))
82 check.add (StatisticsCondition (client, 'fs', '# peers connected',2))
84 check.add (StatisticsCondition (client2, 'transport', '# peers connected',2))
85 check.add (StatisticsCondition (client2, 'core', '# neighbour entries allocated',2))
86 check.add (StatisticsCondition (client2, 'core', '# peers connected',2))
87 check.add (StatisticsCondition (client2, 'topology', '# peers connected',2))
88 check.add (StatisticsCondition (client2, 'fs', '# peers connected',2))
90 check.add (StatisticsCondition (server, 'transport', '# peers connected',2))
91 check.add (StatisticsCondition (server, 'core', '# neighbour entries allocated',2))
92 check.add (StatisticsCondition (server, 'core', '# peers connected',2))
93 check.add (StatisticsCondition (server, 'topology', '# peers connected',2))
94 check.add (StatisticsCondition (server, 'fs', '# peers connected',2))
96 check.run_blocking (check_timeout, None, None)
111 test = Test ('test_memory_consumption', verbose)
112 server = Peer(test, './confs/c_bootstrap_server_w_massif.conf');
114 client = Peer(test, './confs/c_no_nat_client.conf');
117 while (restarts < iterations):
118 print 'Iteration #' + str (restarts) + ' of ' + str (iterations)
119 print '---------------------'
121 client2 = Peer(test, './confs/c_no_nat_client_2.conf');
123 if ((client.started == True) and (client2.started == True) and (server.started == True)):
124 test.p ('Peers started, waiting for clique connection')
126 test.p ('All peers connected, stopping client2')
129 test.p ('Peer disconnected\n')
131 print str (iterations) + " Iteration executed"
138 except (KeyboardInterrupt, SystemExit):
139 print 'Test interrupted'
144 if (success == False):