|
|
@@ -1576,19 +1576,36 @@ class TestLORAmain(unittest.TestCase): |
|
|
|
init_key = X25519.gen() |
|
|
|
resp_key = X25519.gen() |
|
|
|
|
|
|
|
f = {} |
|
|
|
for i in [ 'init', 'resp' ]: |
|
|
|
key = locals()['%s_key' % i] |
|
|
|
|
|
|
|
for j in [ 'pub', 'priv' ]: |
|
|
|
data = getattr(key, 'get%s' % j)().hex() |
|
|
|
file = self.basetempdir / ('%s_%s.key' % (i, j)) |
|
|
|
f['%s_%s_key_file' % (i, j)] = file |
|
|
|
|
|
|
|
with file.open('w') as fp: |
|
|
|
fp.write(data) |
|
|
|
|
|
|
|
keys.append(('pk', ( |
|
|
|
[ '-k', f['init_priv_key_file'], |
|
|
|
'-p', f['resp_pub_key_file'] ], |
|
|
|
[ '-k', f['resp_priv_key_file'], |
|
|
|
'-p', f['init_pub_key_file'] ] |
|
|
|
))) |
|
|
|
for name, (initargs, respargs) in keys: |
|
|
|
with self.subTest(name=name): |
|
|
|
# XXX - macosx specific library path var |
|
|
|
with self.subTest(name=name), patch.dict(os.environ, |
|
|
|
dict(DYLD_LIBRARY_PATH=self.origcwd)): |
|
|
|
self.run_program_keyargs(initargs, respargs) |
|
|
|
|
|
|
|
def run_program_keyargs(self, initargs, respargs): |
|
|
|
try: |
|
|
|
# XXX - macosx specific library path var |
|
|
|
with patch.dict(os.environ, |
|
|
|
dict(DYLD_LIBRARY_PATH=self.origcwd)): |
|
|
|
resp = subprocess.Popen([ 'python', __file__, |
|
|
|
'-r', 'dummy:TestAttr.dummy_func' ] + |
|
|
|
respargs, stdin=DEVNULL, stderr=PIPE, |
|
|
|
stdout=PIPE) |
|
|
|
resp = subprocess.Popen([ 'python', __file__, |
|
|
|
'-r', 'dummy:TestAttr.dummy_func' ] + |
|
|
|
respargs, stdin=DEVNULL, stderr=PIPE, |
|
|
|
stdout=PIPE) |
|
|
|
|
|
|
|
init = subprocess.Popen([ 'python', __file__ ] + |
|
|
|
initargs + [ 'ping' ], stdin=DEVNULL, stderr=PIPE, |
|
|
@@ -1608,10 +1625,12 @@ class TestLORAmain(unittest.TestCase): |
|
|
|
self.assertEqual(errout, b'') |
|
|
|
|
|
|
|
finally: |
|
|
|
init.terminate() |
|
|
|
init.kill() |
|
|
|
_, errout = init.communicate() |
|
|
|
#print(repr(errout)) |
|
|
|
#sys.stdout.flush() |
|
|
|
self.assertEqual(errout, b'') |
|
|
|
|
|
|
|
resp.terminate() |
|
|
|
resp.kill() |
|
|
|
_, errout = resp.communicate() |
|
|
|
self.assertEqual(errout, b'') |