-use testing to create hostkey during peerinfo tool test
authorChristian Grothoff <christian@grothoff.org>
Tue, 19 Jun 2012 08:02:47 +0000 (08:02 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 19 Jun 2012 08:02:47 +0000 (08:02 +0000)
src/peerinfo-tool/test_gnunet_peerinfo.py.in
src/testing/gnunet-testing.c

index bff673e3b122c5695d0b63358459b34aa5c3e7ed..81acb3c8b74d0ca53a67f5e79becc6b8bda1a483 100755 (executable)
@@ -35,21 +35,27 @@ from gnunet_pyexpect import pexpect
 if os.name == 'posix':
   peerinfo = 'gnunet-peerinfo'
   gnunetarm = 'gnunet-arm'
+  gnunettesting = 'gnunet-testing'
 elif os.name == 'nt':
   peerinfo = 'gnunet-peerinfo.exe'
   gnunetarm = 'gnunet-arm.exe'
-
-
+  gnunettesting = 'gnunet-testing.exe'
 
 pinfo = pexpect ()
 pinfo.spawn (None, [peerinfo, '-i', '-c', 'test_gnunet_peerinfo_data.conf', '-L', 'ERROR'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
 pinfo.expect ("stdout", re.compile (r'Error in communication with PEERINFO service: Timeout transmitting iteration request to `PEERINFO\' service.\r?\n'))
 pinfo.expect ("stdout", "EOF")
 
+
 if os.name == "nt":
   shutil.rmtree (os.path.join (os.getenv ("TEMP"), "gnunet-test-peerinfo"), True)
 else:
   shutil.rmtree ("/tmp/gnunet-test-peerinfo", True)
+
+# create hostkey via testing lib
+hkk = subprocess.Popen ([gnunettesting, '-n 1', '-k', '/tmp/gnunet-test-peerinfo/.hostkey'])
+hkk.communicate ()
+
 arm = subprocess.Popen ([gnunetarm, '-sq', '-c', 'test_gnunet_peerinfo_data.conf'])
 arm.communicate ()
 
index bce0c75221f835d3c22162bf643d46040f46c141..fa7e8d61ea7b34bd89b4e3c7e0a4f0fb586216aa 100644 (file)
@@ -131,6 +131,7 @@ create_hostkeys (const unsigned int no)
     fprintf (stderr, _("Could not extract hostkey %u (offset too large?)\n"), create_no);
     return 1;
   }
+  (void) GNUNET_DISK_directory_create_for_file (create_hostkey);
   fd = GNUNET_DISK_file_open (create_hostkey,
                              GNUNET_DISK_OPEN_READWRITE |
                              GNUNET_DISK_OPEN_CREATE,