1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #11595 from cladmi/pr/tests_rng/fix_for_msp430

tests/rng: fix for msp430
This commit is contained in:
Peter Kietzmann 2019-05-28 18:44:37 +02:00 committed by GitHub
commit 3e5a00d14c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 2 deletions

View File

@ -5,6 +5,10 @@ BOARD_BLACKLIST += nucleo-f031k6 nucleo-f042k6 nucleo-l031k6 pic32-clicker
BOARD_INSUFFICIENT_MEMORY += arduino-duemilanove arduino-leonardo arduino-nano \
arduino-uno
# Default stack with printf + the tests buffer uint32_t[32]/uint8_t[256]
MAIN_THREAD_SIZE = THREAD_STACKSIZE_DEFAULT+THREAD_EXTRA_STACKSIZE_PRINTF+256
CFLAGS += -DTHREAD_STACKSIZE_MAIN=\($(MAIN_THREAD_SIZE)\)
# override PRNG if desired (see sys/random for alternatives)
# USEMODULE += prng_minstd

View File

@ -260,7 +260,7 @@ static int cmd_speed(int argc, char **argv)
int main(void)
{
puts("Starting shell...");
char line_buf[SHELL_DEFAULT_BUFSIZE];
static char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);
return 0;

View File

@ -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__":