From 0e66b18f0cf893d4f95a96cde7b4d0a1b2aba939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Tue, 19 Feb 2019 11:30:09 +0100 Subject: [PATCH] tests/rng: expect shell prompt in test Be more pedantic in expected output for shell commands. For slow boards, `ws430-v1_3b/arduino-mega2560/msba2`, some commands were sent before the output of the previous command. --- tests/rng/tests/01-run.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/rng/tests/01-run.py b/tests/rng/tests/01-run.py index e6313058c8..e0009378af 100755 --- a/tests/rng/tests/01-run.py +++ b/tests/rng/tests/01-run.py @@ -14,16 +14,21 @@ from testrunner import run def testfunc(child): # RNG source child.sendline("source 0") + child.expect_exact("> ") child.sendline("seed 1337") + child.expect_exact("Seed set to 1337") + child.expect_exact("> ") child.sendline("fips") - child.expect("Running FIPS 140-2 test, with seed 1337 using Tiny Mersenne Twister PRNG.") + child.expect_exact("Running FIPS 140-2 test, with seed 1337 using Tiny Mersenne Twister PRNG.") child.expect("Monobit test: passed") child.expect("Poker test: passed") child.expect("Run test: passed") child.expect("Longrun test: passed") + child.expect_exact("> ") child.sendline("dump 10") + child.expect_exact("Running dump test, with seed 1337 using Tiny Mersenne Twister PRNG.") child.expect("1555530734") child.expect("2178333451") child.expect("2272913641") @@ -34,13 +39,18 @@ def testfunc(child): child.expect("1550167154") child.expect("3454972398") child.expect("1034066532") + child.expect_exact("> ") child.sendline("entropy") child.expect(re.compile(r"Calculated 7\.994\d{3} bits of entropy from 10000 samples\.")) + child.expect_exact("> ") # Constant source child.sendline("source 1") + child.expect_exact("> ") child.sendline("seed 1337") + child.expect_exact("Seed set to 1337") + child.expect_exact("> ") child.sendline("fips") child.expect("Running FIPS 140-2 test, with seed 1337 using constant value.") @@ -48,6 +58,7 @@ def testfunc(child): child.expect("- Poker test: failed") child.expect("- Run test: failed") child.expect("- Longrun test: passed") + child.expect_exact("> ") child.sendline("dump 10") child.expect("1337") @@ -60,9 +71,12 @@ def testfunc(child): child.expect("1337") child.expect("1337") child.expect("1337") + child.expect_exact("> ") child.sendline("entropy") + child.expect_exact("Running entropy test, with seed 1337 using constant value.") child.expect(re.compile(r"Calculated 0\.017\d{3} bits of entropy from 10000 samples\.")) + child.expect_exact("> ") if __name__ == "__main__":