From 6b982045801c85b3a15ae5d63da8752be87d3d26 Mon Sep 17 00:00:00 2001 From: Volker Birk Date: Thu, 25 Apr 2019 14:16:29 +0200 Subject: [PATCH] add Pad as third device --- test/sync_handshake.py | 2 +- test/sync_test.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/test/sync_handshake.py b/test/sync_handshake.py index 7e28a2d..b11c742 100644 --- a/test/sync_handshake.py +++ b/test/sync_handshake.py @@ -60,7 +60,7 @@ def print_msg(p): elif p.name[:6] == "Laptop": color = "green" else: - color = "lightblue" + color = "cyan" with open(p, "r") as f: t = f.read(-1) msg = pEp.Message(t) diff --git a/test/sync_test.py b/test/sync_test.py index 3401767..26322c3 100644 --- a/test/sync_test.py +++ b/test/sync_test.py @@ -89,6 +89,8 @@ if __name__ == "__main__": help="print sync message trace in inbox") optParser.add_option("-E", "--end-on", dest="notifications", help="end test on these notifications") + optParser.add_option("-3", "--third-device", action="store_true", dest="third", + help="start Pad as third device") options, args = optParser.parse_args() if options.cleanall: @@ -98,6 +100,7 @@ if __name__ == "__main__": rmrf("TestInbox") rmrf("Phone") rmrf("Laptop") + rmrf("Pad") if options.cleanall: rmrf("Backup") @@ -112,15 +115,18 @@ if __name__ == "__main__": shutil.copytree("Phone", "Backup/Phone", symlinks=True, copy_function=shutil.copy2) shutil.copytree("Laptop", "Backup/Laptop", symlinks=True, copy_function=shutil.copy2) + shutil.copytree("Pad", "Backup/Pad", symlinks=True, copy_function=shutil.copy2) shutil.copytree("TestInbox", "Backup/TestInbox", symlinks=True, copy_function=shutil.copy2) elif options.restore: rmrf("TestInbox") rmrf("Phone") rmrf("Laptop") + rmrf("Pad") shutil.copytree("Backup/Phone", "Phone", symlinks=True, copy_function=shutil.copy2) shutil.copytree("Backup/Laptop", "Laptop", symlinks=True, copy_function=shutil.copy2) + shutil.copytree("Backup/Pad", "Pad", symlinks=True, copy_function=shutil.copy2) shutil.copytree("Backup/TestInbox", "TestInbox", symlinks=True, copy_function=shutil.copy2) elif options.print: @@ -138,6 +144,8 @@ if __name__ == "__main__": os.makedirs("TestInbox", exist_ok=True) setup("Phone") setup("Laptop") + if options.third: + setup("Pad") if not options.setup_only: end_on = None @@ -148,10 +156,16 @@ if __name__ == "__main__": end_on = (end_on,) Phone = Process(target=test_for, args=("Phone", "red", end_on)) Laptop = Process(target=test_for, args=("Laptop", "green", end_on)) + if options.third: + Pad = Process(target=test_for, args=("Pad", "cyan", end_on)) Phone.start() Laptop.start() + if options.third: + Pad.start() Phone.join() Laptop.join() + if options.third: + Pad.join()