aboutsummaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorNils Gillmann <ng0@n0.is>2018-05-23 17:31:01 +0000
committerNils Gillmann <ng0@n0.is>2018-05-23 17:31:01 +0000
commit454935bd76a9106ad6eda4d5c3d0861d6e559777 (patch)
tree90d716dc77ba50292cd509e1331c4fc68296f008 /src/fs
parent4d34c5de8369158f903f2b709e7999cd7b9340c2 (diff)
downloadgnunet-454935bd76a9106ad6eda4d5c3d0861d6e559777.tar.gz
gnunet-454935bd76a9106ad6eda4d5c3d0861d6e559777.zip
more flakes.
Signed-off-by: Nils Gillmann <ng0@n0.is>
Diffstat (limited to 'src/fs')
-rwxr-xr-xsrc/fs/test_gnunet_fs_idx.py.in60
-rwxr-xr-xsrc/fs/test_gnunet_fs_psd.py.in2
-rwxr-xr-xsrc/fs/test_gnunet_fs_rec.py.in134
3 files changed, 99 insertions, 97 deletions
diff --git a/src/fs/test_gnunet_fs_idx.py.in b/src/fs/test_gnunet_fs_idx.py.in
index 30592c2e4..a669998fb 100755
--- a/src/fs/test_gnunet_fs_idx.py.in
+++ b/src/fs/test_gnunet_fs_idx.py.in
@@ -25,50 +25,50 @@ import re
25import shutil 25import shutil
26 26
27srcdir = "../.." 27srcdir = "../.."
28gnunet_pyexpect_dir = os.path.join (srcdir, "contrib/scripts") 28gnunet_pyexpect_dir = os.path.join(srcdir, "contrib/scripts")
29if gnunet_pyexpect_dir not in sys.path: 29if gnunet_pyexpect_dir not in sys.path:
30 sys.path.append (gnunet_pyexpect_dir) 30 sys.path.append(gnunet_pyexpect_dir)
31 31
32from gnunet_pyexpect import pexpect 32from gnunet_pyexpect import pexpect
33 33
34if os.name == 'posix': 34if os.name == 'posix':
35 download = './gnunet-download' 35 download = './gnunet-download'
36 gnunetarm = 'gnunet-arm' 36 gnunetarm = 'gnunet-arm'
37 publish = './gnunet-publish' 37 publish = './gnunet-publish'
38 unindex = './gnunet-unindex' 38 unindex = './gnunet-unindex'
39elif os.name == 'nt': 39elif os.name == 'nt':
40 download = './gnunet-download.exe' 40 download = './gnunet-download.exe'
41 gnunetarm = 'gnunet-arm.exe' 41 gnunetarm = 'gnunet-arm.exe'
42 publish = './gnunet-publish.exe' 42 publish = './gnunet-publish.exe'
43 unindex = './gnunet-unindex.exe' 43 unindex = './gnunet-unindex.exe'
44 44
45if os.name == "nt": 45if os.name == "nt":
46 shutil.rmtree (os.path.join (os.getenv ("TEMP"), "gnunet-test-fs-py-idx"), True) 46 shutil.rmtree(os.path.join(os.getenv("TEMP"), "gnunet-test-fs-py-idx"), True)
47else: 47else:
48 shutil.rmtree ("/tmp/gnunet-test-fs-py-idx", True) 48 shutil.rmtree("/tmp/gnunet-test-fs-py-idx", True)
49 49
50arm = subprocess.Popen ([gnunetarm, '-sq', '-c', 'test_gnunet_fs_idx_data.conf']) 50arm = subprocess.Popen([gnunetarm, '-sq', '-c', 'test_gnunet_fs_idx_data.conf'])
51arm.communicate () 51arm.communicate()
52 52
53try: 53try:
54 pub = pexpect () 54 pub = pexpect()
55 55
56 pub.spawn (None, [publish, '-c', 'test_gnunet_fs_idx_data.conf', '-m', "description:Test archive", '-k', 'tst', 'test_gnunet_fs_rec_data.tgz'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 56 pub.spawn(None, [publish, '-c', 'test_gnunet_fs_idx_data.conf', '-m', "description:Test archive", '-k', 'tst', 'test_gnunet_fs_rec_data.tgz'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
57 pub.expect ("stdout", re.compile (r"URI is `gnunet://fs/chk/2ZMHKPV74CB6GB1GFKQRR95BXJQA2SER25FN48GAW7WSBPA0GDEM5Y74V1ZJHM0NA6919TVW376BHTFDRE3RYS0KRY92M1QJVKPHFCR\.49BT3V5C10KA1695JF71FCT8ZZG4JMJSH04BD9CT22R6KEM915A7CEST17RD0QYTHXV5M4HHEGJMEZSFRDB7JAYC0EMJAN2V781E9DG\.17822'\.\r?\n")) 57 pub.expect("stdout", re.compile(r"URI is `gnunet://fs/chk/2ZMHKPV74CB6GB1GFKQRR95BXJQA2SER25FN48GAW7WSBPA0GDEM5Y74V1ZJHM0NA6919TVW376BHTFDRE3RYS0KRY92M1QJVKPHFCR\.49BT3V5C10KA1695JF71FCT8ZZG4JMJSH04BD9CT22R6KEM915A7CEST17RD0QYTHXV5M4HHEGJMEZSFRDB7JAYC0EMJAN2V781E9DG\.17822'\.\r?\n"))
58 58
59 down = pexpect () 59 down = pexpect()
60 down.spawn (None, [download, '-c', 'test_gnunet_fs_idx_data.conf', '-o', 'test_gnunet_fs_rec_data.tar.gz', 'gnunet://fs/chk/2ZMHKPV74CB6GB1GFKQRR95BXJQA2SER25FN48GAW7WSBPA0GDEM5Y74V1ZJHM0NA6919TVW376BHTFDRE3RYS0KRY92M1QJVKPHFCR.49BT3V5C10KA1695JF71FCT8ZZG4JMJSH04BD9CT22R6KEM915A7CEST17RD0QYTHXV5M4HHEGJMEZSFRDB7JAYC0EMJAN2V781E9DG.17822'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 60 down.spawn(None, [download, '-c', 'test_gnunet_fs_idx_data.conf', '-o', 'test_gnunet_fs_rec_data.tar.gz', 'gnunet://fs/chk/2ZMHKPV74CB6GB1GFKQRR95BXJQA2SER25FN48GAW7WSBPA0GDEM5Y74V1ZJHM0NA6919TVW376BHTFDRE3RYS0KRY92M1QJVKPHFCR.49BT3V5C10KA1695JF71FCT8ZZG4JMJSH04BD9CT22R6KEM915A7CEST17RD0QYTHXV5M4HHEGJMEZSFRDB7JAYC0EMJAN2V781E9DG.17822'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
61 down.expect ("stdout", re.compile (r"Downloading `test_gnunet_fs_rec_data.tar.gz' done (.*).\r?\n")) 61 down.expect("stdout", re.compile(r"Downloading `test_gnunet_fs_rec_data.tar.gz' done (.*).\r?\n"))
62 os.remove ("test_gnunet_fs_rec_data.tar.gz") 62 os.remove("test_gnunet_fs_rec_data.tar.gz")
63 63
64 un = pexpect () 64 un = pexpect()
65 un.spawn (None, [unindex, '-c', 'test_gnunet_fs_idx_data.conf', 'test_gnunet_fs_rec_data.tgz'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 65 un.spawn(None, [unindex, '-c', 'test_gnunet_fs_idx_data.conf', 'test_gnunet_fs_rec_data.tgz'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
66 un.expect ("stdout", re.compile (r'Unindexing done\.\r?\n')) 66 un.expect("stdout", re.compile(r'Unindexing done\.\r?\n'))
67 67
68finally: 68finally:
69 arm = subprocess.Popen ([gnunetarm, '-eq', '-c', 'test_gnunet_fs_idx_data.conf']) 69 arm = subprocess.Popen([gnunetarm, '-eq', '-c', 'test_gnunet_fs_idx_data.conf'])
70 arm.communicate () 70 arm.communicate()
71 if os.name == "nt": 71 if os.name == "nt":
72 shutil.rmtree (os.path.join (os.getenv ("TEMP"), "gnunet-test-fs-py-idx"), True) 72 shutil.rmtree(os.path.join(os.getenv("TEMP"), "gnunet-test-fs-py-idx"), True)
73 else: 73 else:
74 shutil.rmtree ("/tmp/gnunet-test-fs-py-idx", True) 74 shutil.rmtree("/tmp/gnunet-test-fs-py-idx", True)
diff --git a/src/fs/test_gnunet_fs_psd.py.in b/src/fs/test_gnunet_fs_psd.py.in
index b27a24c84..4b27b4532 100755
--- a/src/fs/test_gnunet_fs_psd.py.in
+++ b/src/fs/test_gnunet_fs_psd.py.in
@@ -36,7 +36,7 @@ reload(sys)
36sys.setdefaultencoding('utf8') 36sys.setdefaultencoding('utf8')
37 37
38srcdir = "../.." 38srcdir = "../.."
39gnunet_pyexpect_dir = os.path.join (srcdir, "contrib/scripts") 39gnunet_pyexpect_dir = os.path.join(srcdir, "contrib/scripts")
40if gnunet_pyexpect_dir not in sys.path: 40if gnunet_pyexpect_dir not in sys.path:
41 sys.path.append(gnunet_pyexpect_dir) 41 sys.path.append(gnunet_pyexpect_dir)
42 42
diff --git a/src/fs/test_gnunet_fs_rec.py.in b/src/fs/test_gnunet_fs_rec.py.in
index e20a9ff78..aa9b7b461 100755
--- a/src/fs/test_gnunet_fs_rec.py.in
+++ b/src/fs/test_gnunet_fs_rec.py.in
@@ -27,88 +27,90 @@ import tarfile
27import filecmp 27import filecmp
28 28
29srcdir = "../.." 29srcdir = "../.."
30gnunet_pyexpect_dir = os.path.join (srcdir, "contrib/scripts") 30gnunet_pyexpect_dir = os.path.join(srcdir, "contrib/scripts")
31if gnunet_pyexpect_dir not in sys.path: 31if gnunet_pyexpect_dir not in sys.path:
32 sys.path.append (gnunet_pyexpect_dir) 32 sys.path.append(gnunet_pyexpect_dir)
33 33
34from gnunet_pyexpect import pexpect 34from gnunet_pyexpect import pexpect
35from pydiffer import dcdiff 35from pydiffer import dcdiff
36 36
37if os.name == 'posix': 37if os.name == 'posix':
38 download = './gnunet-download' 38 download = './gnunet-download'
39 gnunetarm = 'gnunet-arm' 39 gnunetarm = 'gnunet-arm'
40 publish = './gnunet-publish' 40 publish = './gnunet-publish'
41 unindex = './gnunet-unindex' 41 unindex = './gnunet-unindex'
42 search = './gnunet-search' 42 search = './gnunet-search'
43 directory = './gnunet-directory' 43 directory = './gnunet-directory'
44elif os.name == 'nt': 44elif os.name == 'nt':
45 download = './gnunet-download.exe' 45 download = './gnunet-download.exe'
46 gnunetarm = 'gnunet-arm.exe' 46 gnunetarm = 'gnunet-arm.exe'
47 publish = './gnunet-publish.exe' 47 publish = './gnunet-publish.exe'
48 unindex = './gnunet-unindex.exe' 48 unindex = './gnunet-unindex.exe'
49 search = './gnunet-search.exe' 49 search = './gnunet-search.exe'
50 directory = './gnunet-directory.exe' 50 directory = './gnunet-directory.exe'
51 51
52if os.name == "nt": 52if os.name == "nt":
53 shutil.rmtree (os.path.join (os.getenv ("TEMP"), "gnunet-test-fs-py-rec"), True) 53 shutil.rmtree(os.path.join(os.getenv("TEMP"), "gnunet-test-fs-py-rec"), True)
54else: 54else:
55 shutil.rmtree ("/tmp/gnunet-test-fs-py-rec", True) 55 shutil.rmtree("/tmp/gnunet-test-fs-py-rec", True)
56 56
57arm = subprocess.Popen ([gnunetarm, '-sq', '-c', 'test_gnunet_fs_rec_data.conf']) 57arm = subprocess.Popen([gnunetarm, '-sq', '-c', 'test_gnunet_fs_rec_data.conf'])
58arm.communicate () 58arm.communicate()
59 59
60# pray that `tar' is in PATH 60# pray that `tar' is in PATH.
61tar = tarfile.open ('test_gnunet_fs_rec_data.tgz') 61# FIXME: Actually we should check for that and output
62tar.extractall () 62# a message if it isn't found.
63tar = tarfile.open('test_gnunet_fs_rec_data.tgz')
64tar.extractall()
63# first, basic publish-search-download run 65# first, basic publish-search-download run
64try: 66try:
65 pub = pexpect () 67 pub = pexpect()
66 pub.spawn (None, [publish, '-c', 'test_gnunet_fs_rec_data.conf', '-d', '-k', 'testdir', 'dir/'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 68 pub.spawn(None, [publish, '-c', 'test_gnunet_fs_rec_data.conf', '-d', '-k', 'testdir', 'dir/'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
67 # Can't say much for publishing, except that the last one is the toplevel directory 69 # Can't say much for publishing, except that the last one is the toplevel directory
68 pub.expect ("stdout", re.compile (r"Publishing `.+' done\.\r?\n")) 70 pub.expect("stdout", re.compile(r"Publishing `.+' done\.\r?\n"))
69 pub.expect ("stdout", re.compile (r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n")) 71 pub.expect("stdout", re.compile(r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n"))
70 pub.expect ("stdout", re.compile (r"Publishing `.+' done\.\r?\n")) 72 pub.expect("stdout", re.compile(r"Publishing `.+' done\.\r?\n"))
71 pub.expect ("stdout", re.compile (r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n")) 73 pub.expect("stdout", re.compile(r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n"))
72 pub.expect ("stdout", re.compile (r"Publishing `.+' done\.\r?\n")) 74 pub.expect("stdout", re.compile(r"Publishing `.+' done\.\r?\n"))
73 pub.expect ("stdout", re.compile (r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n")) 75 pub.expect("stdout", re.compile(r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n"))
74 pub.expect ("stdout", re.compile (r"Publishing `.+' done\.\r?\n")) 76 pub.expect("stdout", re.compile(r"Publishing `.+' done\.\r?\n"))
75 pub.expect ("stdout", re.compile (r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n")) 77 pub.expect("stdout", re.compile(r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n"))
76 pub.expect ("stdout", re.compile (r"Publishing `.+' done\.\r?\n")) 78 pub.expect("stdout", re.compile(r"Publishing `.+' done\.\r?\n"))
77 pub.expect ("stdout", re.compile (r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n")) 79 pub.expect("stdout", re.compile(r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n"))
78 pub.expect ("stdout", re.compile (r"Publishing `.+' done\.\r?\n")) 80 pub.expect("stdout", re.compile(r"Publishing `.+' done\.\r?\n"))
79 pub.expect ("stdout", re.compile (r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n")) 81 pub.expect("stdout", re.compile(r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n"))
80 pub.expect ("stdout", re.compile (r"Publishing `.+[\\/]dir[\\/]' done\.\r?\n")) 82 pub.expect("stdout", re.compile(r"Publishing `.+[\\/]dir[\\/]' done\.\r?\n"))
81 m = pub.expect ("stdout", re.compile (r".+\r?\n")) 83 m = pub.expect("stdout", re.compile(r".+\r?\n"))
82 if not m: 84 if not m:
83 sys.exit (3) 85 sys.exit(3)
84 output = m.string 86 output = m.string
85 url = output[output.find ("`")+1:output.find("'")] 87 url = output[output.find("`")+1:output.find("'")]
86 88
87 down = pexpect () 89 down = pexpect()
88 down.spawn (None, [download, '-c', 'test_gnunet_fs_rec_data.conf', '-R', '-o', 'rdir.gnd', url], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 90 down.spawn(None, [download, '-c', 'test_gnunet_fs_rec_data.conf', '-R', '-o', 'rdir.gnd', url], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
89 down.expect ("stdout", re.compile (r"Downloading `rdir.gnd' done (.*).\r?\n")) 91 down.expect("stdout", re.compile(r"Downloading `rdir.gnd' done (.*).\r?\n"))
90 92
91 d = pexpect () 93 d = pexpect()
92 d.spawn (None, [directory, '-c', 'test_gnunet_fs_rec_data.conf', 'rdir/a.gnd'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 94 d.spawn(None, [directory, '-c', 'test_gnunet_fs_rec_data.conf', 'rdir/a.gnd'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
93 d.expect ("stdout", re.compile (r"Directory `a/' meta data:\r?\n")) 95 d.expect("stdout", re.compile(r"Directory `a/' meta data:\r?\n"))
94 d.expect ("stdout", re.compile (r"Directory `a/' contents:\r?\n")) 96 d.expect("stdout", re.compile(r"Directory `a/' contents:\r?\n"))
95 d.expect ("stdout", re.compile (r"COPYING (.*)\r?\n")) 97 d.expect("stdout", re.compile(r"COPYING (.*)\r?\n"))
96 d.expect ("stdout", re.compile (r"INSTALL (.*)\r?\n")) 98 d.expect("stdout", re.compile(r"INSTALL (.*)\r?\n"))
99
100 os.remove("rdir/b.gnd")
101 os.remove("rdir/a.gnd")
102 diff = dcdiff('dir', 'rdir')
103 if len(diff) != 0:
104 raise Exception("Unexpected difference between source directory and downloaded result:\n{}".format(diff))
97 105
98 os.remove ("rdir/b.gnd")
99 os.remove ("rdir/a.gnd")
100 diff = dcdiff ('dir', 'rdir')
101 if len (diff) != 0:
102 raise Exception ("Unexpected difference between source directory and downloaded result:\n{}".format (diff))
103
104 106
105finally: 107finally:
106 arm = subprocess.Popen ([gnunetarm, '-eq', '-c', 'test_gnunet_fs_rec_data.conf']) 108 arm = subprocess.Popen([gnunetarm, '-eq', '-c', 'test_gnunet_fs_rec_data.conf'])
107 arm.communicate () 109 arm.communicate()
108 if os.name == "nt": 110 if os.name == "nt":
109 shutil.rmtree (os.path.join (os.getenv ("TEMP"), "gnunet-test-fs-py-rec"), True) 111 shutil.rmtree(os.path.join(os.getenv("TEMP"), "gnunet-test-fs-py-rec"), True)
110 else: 112 else:
111 shutil.rmtree ("/tmp/gnunet-test-fs-py-rec", True) 113 shutil.rmtree("/tmp/gnunet-test-fs-py-rec", True)
112 shutil.rmtree ("dir", True) 114 shutil.rmtree("dir", True)
113 shutil.rmtree ("rdir", True) 115 shutil.rmtree("rdir", True)
114 shutil.rmtree ("rdir.gnd", True) 116 shutil.rmtree("rdir.gnd", True)