+arm = subprocess.Popen ([gnunetarm, '-sq', '-c', 'test_gnunet_fs_rec_data.conf'])
+arm.communicate ()
+
+# pray that `tar' is in PATH
+tar = tarfile.open ('test_gnunet_fs_rec_data.tgz')
+tar.extractall ()
+# first, basic publish-search-download run
+try:
+ pub = pexpect ()
+ pub.spawn (None, [publish, '-c', 'test_gnunet_fs_rec_data.conf', '-d', '-k', 'testdir', 'dir/'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ # Can't say much for publishing, except that the last one is the toplevel directory
+ pub.expect ("stdout", re.compile (r"Publishing `.+' done\.\r?\n"))
+ pub.expect ("stdout", re.compile (r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n"))
+ pub.expect ("stdout", re.compile (r"Publishing `.+' done\.\r?\n"))
+ pub.expect ("stdout", re.compile (r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n"))
+ pub.expect ("stdout", re.compile (r"Publishing `.+' done\.\r?\n"))
+ pub.expect ("stdout", re.compile (r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n"))
+ pub.expect ("stdout", re.compile (r"Publishing `.+' done\.\r?\n"))
+ pub.expect ("stdout", re.compile (r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n"))
+ pub.expect ("stdout", re.compile (r"Publishing `.+' done\.\r?\n"))
+ pub.expect ("stdout", re.compile (r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n"))
+ pub.expect ("stdout", re.compile (r"Publishing `.+' done\.\r?\n"))
+ pub.expect ("stdout", re.compile (r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n"))
+ pub.expect ("stdout", re.compile (r"Publishing `.+[\\/]dir[\\/]' done\.\r?\n"))
+ m = pub.expect ("stdout", re.compile (r".+\r?\n"))
+ if not m:
+ sys.exit (3)
+ output = m.string
+ url = output[output.find ("`")+1:output.find("'")]