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.
29 # This test tests if a fresh peer bootstraps from a hostlist server and then
30 # successfully connects to the server
35 testname = "test_integration_bootstrap_and_connect"
48 gnunet_pyexpect_dir = os.path.join (srcdir, "contrib")
49 if gnunet_pyexpect_dir not in sys.path:
50 sys.path.append (gnunet_pyexpect_dir)
52 from gnunet_pyexpect import pexpect
55 if os.name == 'posix':
56 gnunetarm = 'gnunet-arm'
58 gnunetarm = 'gnunet-arm.exe'
61 shutil.rmtree (os.path.join (os.getenv ("TEMP"), testname), True)
63 shutil.rmtree ("/tmp/" + testname, True)
66 vprintf ("Starting bootstrap server & client")
68 server = subprocess.Popen ([gnunetarm, '-sq', '-c', './confs/c_bootstrap_server.conf'])
71 print "Can not start bootstrap server, exiting..."
74 client = subprocess.Popen ([gnunetarm, '-sq', '-c', 'confs/c_no_nat_client.conf'])
77 print "Can not start bootstrap client, exiting..."
79 vprintf ("Bootstrap server & client started")
82 vprintf ("Shutting down bootstrap server")
84 server = subprocess.Popen ([gnunetarm, '-eq', '-c', './confs/c_bootstrap_server.conf'])
87 print "Can not stop bootstrap server, exiting..."
90 client = subprocess.Popen ([gnunetarm, '-eq', '-c', 'confs/c_no_nat_client.conf'])
93 print "Can not stop bootstrap client, exiting..."
95 vprintf ("Bootstrap server & client stopped")
100 shutil.rmtree (os.path.join (os.getenv ("TEMP"), "gnunet-test-fs-py-ns"), True)
102 shutil.rmtree ("/tmp/gnunet-test-fs-py-ns", True)
109 while ((success == False) and (count < timeout)):
117 vprintf ("Running " + testname)
126 if (success == False):
127 print ('Test failed')
130 print ('Test successful')