From: Matthias Wachs Date: Thu, 8 Dec 2011 17:22:03 +0000 (+0000) Subject: -more X-Git-Tag: initial-import-from-subversion-38251~15683 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1ff3fa2d954f9d1e74585ee6652339bb8a1aff4a;p=oweals%2Fgnunet.git -more --- diff --git a/src/integration-tests/confs/c_no_nat_client.conf b/src/integration-tests/confs/c_no_nat_client.conf index 908212c18..e103ba8fe 100644 --- a/src/integration-tests/confs/c_no_nat_client.conf +++ b/src/integration-tests/confs/c_no_nat_client.conf @@ -132,6 +132,7 @@ ATS_MIN_INTERVAL = 15000 ATS_EXEC_INTERVAL = 30000 [transport] +#DEBUG = YES AUTOSTART = YES PORT = 20029 HOSTNAME = localhost @@ -274,7 +275,7 @@ HOSTLISTFILE = $SERVICEHOME/hostlist/learned.data CONFIG = $DEFAULTCONFIG BINARY = gnunet-daemon-hostlist OPTIONS = -b -SERVERS = http://v9.gnunet.org:58080/ +SERVERS = http://localhost:8080/ HTTP-PROXY = [core] diff --git a/src/integration-tests/hostkeys/0000-hostkey b/src/integration-tests/hostkeys/0000-hostkey new file mode 100644 index 000000000..c3c212386 Binary files /dev/null and b/src/integration-tests/hostkeys/0000-hostkey differ diff --git a/src/integration-tests/hostkeys/0001-hostkey b/src/integration-tests/hostkeys/0001-hostkey new file mode 100644 index 000000000..871fc90ed Binary files /dev/null and b/src/integration-tests/hostkeys/0001-hostkey differ diff --git a/src/integration-tests/test_integration_bootstrap_and_connect.py.in b/src/integration-tests/test_integration_bootstrap_and_connect.py.in index 44e8df3df..e88c2988a 100755 --- a/src/integration-tests/test_integration_bootstrap_and_connect.py.in +++ b/src/integration-tests/test_integration_bootstrap_and_connect.py.in @@ -23,6 +23,7 @@ import os import subprocess import re import shutil +import time # # This test tests if a fresh peer bootstraps from a hostlist server and then @@ -31,80 +32,102 @@ import shutil #definitions -def vpfrint (msg): - if verbose == True: - print msg - - testname = "test_integration_bootstrap_and_connect" verbose = True +gnunetarm = "" +#fix this! +success = True +timeout = 2 -# setup - -srcdir = "../.." -gnunet_pyexpect_dir = os.path.join (srcdir, "contrib") -if gnunet_pyexpect_dir not in sys.path: - sys.path.append (gnunet_pyexpect_dir) - -from gnunet_pyexpect import pexpect - -if os.name == 'posix': - gnunetarm = 'gnunet-arm' -elif os.name == 'nt': - gnunetarm = 'gnunet-arm.exe' - -if os.name == "nt": - shutil.rmtree (os.path.join (os.getenv ("TEMP"), testname), True) -else: - shutil.rmtree ("/tmp/" + testname, True) - -vpfrint ("Running " + testname) +def vprintf (msg): + if verbose == True: + print msg +def setup (): + srcdir = "../.." + gnunet_pyexpect_dir = os.path.join (srcdir, "contrib") + if gnunet_pyexpect_dir not in sys.path: + sys.path.append (gnunet_pyexpect_dir) + + from gnunet_pyexpect import pexpect + + global gnunetarm + if os.name == 'posix': + gnunetarm = 'gnunet-arm' + elif os.name == 'nt': + gnunetarm = 'gnunet-arm.exe' + + if os.name == "nt": + shutil.rmtree (os.path.join (os.getenv ("TEMP"), testname), True) + else: + shutil.rmtree ("/tmp/" + testname, True) + +def start (): + vprintf ("Starting bootstrap server & client") + try: + server = subprocess.Popen ([gnunetarm, '-sq', '-c', './confs/c_bootstrap_server.conf']) + server.communicate () + except OSError: + print "Can not start bootstrap server, exiting..." + exit (1) + try: + client = subprocess.Popen ([gnunetarm, '-sq', '-c', 'confs/c_no_nat_client.conf']) + client.communicate () + except OSError: + print "Can not start bootstrap client, exiting..." + exit (1) + vprintf ("Bootstrap server & client started") + +def stop (): + vprintf ("Shutting down bootstrap server") + try: + server = subprocess.Popen ([gnunetarm, '-eq', '-c', './confs/c_bootstrap_server.conf']) + server.communicate () + except OSError: + print "Can not stop bootstrap server, exiting..." + exit (1) + try: + client = subprocess.Popen ([gnunetarm, '-eq', '-c', 'confs/c_no_nat_client.conf']) + client.communicate () + except OSError: + print "Can not stop bootstrap client, exiting..." + exit (1) + vprintf ("Bootstrap server & client stopped") + + +def cleanup (): + if os.name == "nt": + shutil.rmtree (os.path.join (os.getenv ("TEMP"), "gnunet-test-fs-py-ns"), True) + else: + shutil.rmtree ("/tmp/gnunet-test-fs-py-ns", True) + +def check (): + global success + global timeout + count = 1 + + while ((success == False) and (count < timeout)): + time.sleep(1) + count += 1 +# +# Test execution +# -# start nodes +vprintf ("Running " + testname) +setup () +start () -vpfrint ("Starting bootstrap server & client") -try: - server = subprocess.Popen ([gnunetarm, '-sq', '-c', './confs/c_bootstrap_server.conf']) - server.communicate () -except OSError: - print "Can not start bootstrap server, exiting..." - exit (1) -try: - client = subprocess.Popen ([gnunetarm, '-sq', '-c', 'confs/c_no_nat_client.conf']) - client.communicate () -except OSError: - print "Can not start bootstrap client, exiting..." - exit (1) -vpfrint ("Bootstrap server & client started") +check () +stop () +cleanup () -import time -time.sleep(5) - -# shutdown -vpfrint ("Shutting down bootstrap server") -try: - server = subprocess.Popen ([gnunetarm, '-eq', '-c', './confs/c_bootstrap_server.conf']) - server.communicate () -except OSError: - print "Can not stop bootstrap server, exiting..." - exit (1) -try: - client = subprocess.Popen ([gnunetarm, '-eq', '-c', 'confs/c_no_nat_client.conf']) - client.communicate () -except OSError: - print "Can not stop bootstrap client, exiting..." - exit (1) -vpfrint ("Bootstrap server & client stopped") - -# clean up - -if os.name == "nt": - shutil.rmtree (os.path.join (os.getenv ("TEMP"), "gnunet-test-fs-py-ns"), True) +if (success == False): + print ('Test failed') + exit (1) else: - shutil.rmtree ("/tmp/gnunet-test-fs-py-ns", True) + print ('Test successful') + exit (0) -exit (0)