From e33d7c26b76443533e94283f2fc0ea8eafae6174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolphe=20Br=C3=A9ard?= Date: Sun, 30 Apr 2023 17:08:22 +0200 Subject: [PATCH] Prevent an infinite loop --- tests/start_test.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/start_test.py b/tests/start_test.py index 1dce508..30ce2ec 100755 --- a/tests/start_test.py +++ b/tests/start_test.py @@ -163,8 +163,13 @@ def start_tests(test_dir, maildir, smtp_port): nb_dkim_ok = 0 nb_dkim_total = 0 maildir_glob = f"{maildir.name}/Maildir/new/*" + nb_sleep = 0 while len(glob.glob(maildir_glob)) < nb_total: - time.sleep(1) + nb_sleep += 1 + if nb_sleep > 6: + print("Some messages have not been received.", file=sys.stderr) + sys.exit(1) + time.sleep(nb_sleep) for test_msg in glob.glob(maildir_glob): nb_dkim_total += 1 nb_dkim_ok += test_dkim(test_msg)