diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-06-19 08:02:47 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-06-19 08:02:47 +0000 |
commit | ebd2cf0e07c0dca2cc81282e8d7d1eb2a9dcffb0 (patch) | |
tree | 2107c29be1b9e7c31f9ed002f8fb6c7622bbd51b | |
parent | 92ab0a2e11b3b3c5dec664383370d0dab3c30974 (diff) | |
download | gnunet-ebd2cf0e07c0dca2cc81282e8d7d1eb2a9dcffb0.tar.gz gnunet-ebd2cf0e07c0dca2cc81282e8d7d1eb2a9dcffb0.zip |
-use testing to create hostkey during peerinfo tool test
-rwxr-xr-x | src/peerinfo-tool/test_gnunet_peerinfo.py.in | 10 | ||||
-rw-r--r-- | src/testing/gnunet-testing.c | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/peerinfo-tool/test_gnunet_peerinfo.py.in b/src/peerinfo-tool/test_gnunet_peerinfo.py.in index bff673e3b..81acb3c8b 100755 --- a/src/peerinfo-tool/test_gnunet_peerinfo.py.in +++ b/src/peerinfo-tool/test_gnunet_peerinfo.py.in | |||
@@ -35,21 +35,27 @@ from gnunet_pyexpect import pexpect | |||
35 | if os.name == 'posix': | 35 | if os.name == 'posix': |
36 | peerinfo = 'gnunet-peerinfo' | 36 | peerinfo = 'gnunet-peerinfo' |
37 | gnunetarm = 'gnunet-arm' | 37 | gnunetarm = 'gnunet-arm' |
38 | gnunettesting = 'gnunet-testing' | ||
38 | elif os.name == 'nt': | 39 | elif os.name == 'nt': |
39 | peerinfo = 'gnunet-peerinfo.exe' | 40 | peerinfo = 'gnunet-peerinfo.exe' |
40 | gnunetarm = 'gnunet-arm.exe' | 41 | gnunetarm = 'gnunet-arm.exe' |
41 | 42 | gnunettesting = 'gnunet-testing.exe' | |
42 | |||
43 | 43 | ||
44 | pinfo = pexpect () | 44 | pinfo = pexpect () |
45 | pinfo.spawn (None, [peerinfo, '-i', '-c', 'test_gnunet_peerinfo_data.conf', '-L', 'ERROR'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | 45 | pinfo.spawn (None, [peerinfo, '-i', '-c', 'test_gnunet_peerinfo_data.conf', '-L', 'ERROR'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
46 | pinfo.expect ("stdout", re.compile (r'Error in communication with PEERINFO service: Timeout transmitting iteration request to `PEERINFO\' service.\r?\n')) | 46 | pinfo.expect ("stdout", re.compile (r'Error in communication with PEERINFO service: Timeout transmitting iteration request to `PEERINFO\' service.\r?\n')) |
47 | pinfo.expect ("stdout", "EOF") | 47 | pinfo.expect ("stdout", "EOF") |
48 | 48 | ||
49 | |||
49 | if os.name == "nt": | 50 | if os.name == "nt": |
50 | shutil.rmtree (os.path.join (os.getenv ("TEMP"), "gnunet-test-peerinfo"), True) | 51 | shutil.rmtree (os.path.join (os.getenv ("TEMP"), "gnunet-test-peerinfo"), True) |
51 | else: | 52 | else: |
52 | shutil.rmtree ("/tmp/gnunet-test-peerinfo", True) | 53 | shutil.rmtree ("/tmp/gnunet-test-peerinfo", True) |
54 | |||
55 | # create hostkey via testing lib | ||
56 | hkk = subprocess.Popen ([gnunettesting, '-n 1', '-k', '/tmp/gnunet-test-peerinfo/.hostkey']) | ||
57 | hkk.communicate () | ||
58 | |||
53 | arm = subprocess.Popen ([gnunetarm, '-sq', '-c', 'test_gnunet_peerinfo_data.conf']) | 59 | arm = subprocess.Popen ([gnunetarm, '-sq', '-c', 'test_gnunet_peerinfo_data.conf']) |
54 | arm.communicate () | 60 | arm.communicate () |
55 | 61 | ||
diff --git a/src/testing/gnunet-testing.c b/src/testing/gnunet-testing.c index bce0c7522..fa7e8d61e 100644 --- a/src/testing/gnunet-testing.c +++ b/src/testing/gnunet-testing.c | |||
@@ -131,6 +131,7 @@ create_hostkeys (const unsigned int no) | |||
131 | fprintf (stderr, _("Could not extract hostkey %u (offset too large?)\n"), create_no); | 131 | fprintf (stderr, _("Could not extract hostkey %u (offset too large?)\n"), create_no); |
132 | return 1; | 132 | return 1; |
133 | } | 133 | } |
134 | (void) GNUNET_DISK_directory_create_for_file (create_hostkey); | ||
134 | fd = GNUNET_DISK_file_open (create_hostkey, | 135 | fd = GNUNET_DISK_file_open (create_hostkey, |
135 | GNUNET_DISK_OPEN_READWRITE | | 136 | GNUNET_DISK_OPEN_READWRITE | |
136 | GNUNET_DISK_OPEN_CREATE, | 137 | GNUNET_DISK_OPEN_CREATE, |