aboutsummaryrefslogtreecommitdiff
path: root/src/integration-tests/test_integration_bootstrap_and_connect.py.in
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-12-08 16:16:24 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-12-08 16:16:24 +0000
commit3ec5e14c7071bfb39ad7af8f98365d6e81cbe026 (patch)
tree65033020d74224fe25ece852c2daf35fec104c26 /src/integration-tests/test_integration_bootstrap_and_connect.py.in
parentcbd09ba94fde1331cb4fe6ea29f5f164adc8db25 (diff)
downloadgnunet-3ec5e14c7071bfb39ad7af8f98365d6e81cbe026.tar.gz
gnunet-3ec5e14c7071bfb39ad7af8f98365d6e81cbe026.zip
step by step
Diffstat (limited to 'src/integration-tests/test_integration_bootstrap_and_connect.py.in')
-rwxr-xr-xsrc/integration-tests/test_integration_bootstrap_and_connect.py.in110
1 files changed, 110 insertions, 0 deletions
diff --git a/src/integration-tests/test_integration_bootstrap_and_connect.py.in b/src/integration-tests/test_integration_bootstrap_and_connect.py.in
new file mode 100755
index 000000000..44e8df3df
--- /dev/null
+++ b/src/integration-tests/test_integration_bootstrap_and_connect.py.in
@@ -0,0 +1,110 @@
1#!@PYTHON@
2# This file is part of GNUnet.
3# (C) 2010 Christian Grothoff (and other contributing authors)
4#
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.
9#
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.
14#
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.
19#
20#
21import sys
22import os
23import subprocess
24import re
25import shutil
26
27#
28# This test tests if a fresh peer bootstraps from a hostlist server and then
29# successfully connects to the server
30#
31
32#definitions
33
34def vpfrint (msg):
35 if verbose == True:
36 print msg
37
38
39testname = "test_integration_bootstrap_and_connect"
40verbose = True
41
42# setup
43
44srcdir = "../.."
45gnunet_pyexpect_dir = os.path.join (srcdir, "contrib")
46if gnunet_pyexpect_dir not in sys.path:
47 sys.path.append (gnunet_pyexpect_dir)
48
49from gnunet_pyexpect import pexpect
50
51if os.name == 'posix':
52 gnunetarm = 'gnunet-arm'
53elif os.name == 'nt':
54 gnunetarm = 'gnunet-arm.exe'
55
56if os.name == "nt":
57 shutil.rmtree (os.path.join (os.getenv ("TEMP"), testname), True)
58else:
59 shutil.rmtree ("/tmp/" + testname, True)
60
61vpfrint ("Running " + testname)
62
63
64
65# start nodes
66
67vpfrint ("Starting bootstrap server & client")
68try:
69 server = subprocess.Popen ([gnunetarm, '-sq', '-c', './confs/c_bootstrap_server.conf'])
70 server.communicate ()
71except OSError:
72 print "Can not start bootstrap server, exiting..."
73 exit (1)
74try:
75 client = subprocess.Popen ([gnunetarm, '-sq', '-c', 'confs/c_no_nat_client.conf'])
76 client.communicate ()
77except OSError:
78 print "Can not start bootstrap client, exiting..."
79 exit (1)
80vpfrint ("Bootstrap server & client started")
81
82
83import time
84time.sleep(5)
85
86# shutdown
87vpfrint ("Shutting down bootstrap server")
88try:
89 server = subprocess.Popen ([gnunetarm, '-eq', '-c', './confs/c_bootstrap_server.conf'])
90 server.communicate ()
91except OSError:
92 print "Can not stop bootstrap server, exiting..."
93 exit (1)
94try:
95 client = subprocess.Popen ([gnunetarm, '-eq', '-c', 'confs/c_no_nat_client.conf'])
96 client.communicate ()
97except OSError:
98 print "Can not stop bootstrap client, exiting..."
99 exit (1)
100vpfrint ("Bootstrap server & client stopped")
101
102# clean up
103
104if os.name == "nt":
105 shutil.rmtree (os.path.join (os.getenv ("TEMP"), "gnunet-test-fs-py-ns"), True)
106else:
107 shutil.rmtree ("/tmp/gnunet-test-fs-py-ns", True)
108
109exit (0)
110