From c9fccbc34d999d2a0f00c08e91371f28b6fac860 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Thu, 28 Nov 2019 08:05:00 +0100 Subject: [PATCH 1/2] tests/ps_schedstatistics: use lower load in background threads On slow platforms, such as AVR, the main thread could never run and the shell would remain stuck. --- tests/ps_schedstatistics/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ps_schedstatistics/main.c b/tests/ps_schedstatistics/main.c index f6f8a28301..c54b110123 100644 --- a/tests/ps_schedstatistics/main.c +++ b/tests/ps_schedstatistics/main.c @@ -47,7 +47,7 @@ static void *_thread_fn(void *arg) for (int i = 0; i < (10 * (next + 1)); ++i) { _xtimer_now64(); } - xtimer_usleep(XTIMER_BACKOFF * 3); + xtimer_usleep(XTIMER_BACKOFF * 10); msg_send(&m2, pids[next]); } From f885b90bd9b5984d5a2cb649e27cf030930a59cb Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Thu, 28 Nov 2019 08:06:46 +0100 Subject: [PATCH 2/2] tests/ps_schedstatistics: improve automatic test script - Ensure the whole ps output is displayed in the terminal before exiting the script - Escape parenthesis in line regexp --- tests/ps_schedstatistics/tests/01-run.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/tests/ps_schedstatistics/tests/01-run.py b/tests/ps_schedstatistics/tests/01-run.py index 053b357b3a..beabbfd2bb 100755 --- a/tests/ps_schedstatistics/tests/01-run.py +++ b/tests/ps_schedstatistics/tests/01-run.py @@ -10,25 +10,25 @@ import sys from testrunner import run PS_EXPECTED = ( - (r'\tpid | name | state Q | pri | stack ( used) | ' + (r'\tpid | name | state Q | pri | stack \( used\) | ' r'base addr | current | runtime | switches'), - (r'\t - | isr_stack | - - | - | \d+ ( -?\d+) | ' + (r'\t - | isr_stack | - - | - | \d+ \( -?\d+\) | ' r'0x\d+ | 0x\d+'), - (r'\t 1 | idle | pending Q | 15 | \d+ ( -?\d+) | ' + (r'\t 1 | idle | pending Q | 15 | \d+ \( -?\d+\) | ' r'0x\d+ | 0x\d+ | \d+\.\d+% | \d+'), - (r'\t 2 | main | running Q | 7 | \d+ ( -?\d+) | ' + (r'\t 2 | main | running Q | 7 | \d+ \( -?\d+\) | ' r'0x\d+ | 0x\d+ | \d+\.\d+% | \d+'), - (r'\t 3 | thread | bl rx _ | 6 | \d+ ( -?\d+) | ' + (r'\t 3 | thread | bl rx _ | 6 | \d+ \( -?\d+\) | ' r'0x\d+ | 0x\d+ | \d+\.\d+% | \d+'), - (r'\t 4 | thread | bl rx _ | 6 | \d+ ( -?\d+) | ' + (r'\t 4 | thread | bl rx _ | 6 | \d+ \( -?\d+\) | ' r'0x\d+ | 0x\d+ | \d+\.\d+% | \d+'), - (r'\t 5 | thread | bl rx _ | 6 | \d+ ( -?\d+) | ' + (r'\t 5 | thread | bl rx _ | 6 | \d+ \( -?\d+\) | ' r'0x\d+ | 0x\d+ | \d+\.\d+% | \d+'), - (r'\t 6 | thread | bl mutex _ | 6 | \d+ ( -?\d+) | ' + (r'\t 6 | thread | bl mutex _ | 6 | \d+ \( -?\d+\) | ' r'0x\d+ | 0x\d+ | \d+\.\d+% | \d+'), - (r'\t 7 | thread | bl rx _ | 6 | \d+ ( -?\d+) | ' + (r'\t 7 | thread | bl rx _ | 6 | \d+ \( -?\d+\) | ' r'0x\d+ | 0x\d+ | \d+\.\d+% | \d+'), - (r'\t | SUM | | | \d+ (\d+)') + (r'\t | SUM | | | \d+ \(\d+\)') ) @@ -40,7 +40,7 @@ def _check_startup(child): def _check_help(child): child.sendline('') - child.expect('>') + child.expect_exact('>') child.sendline('help') child.expect_exact('Command Description') child.expect_exact('---------------------------------------') @@ -53,6 +53,8 @@ def _check_ps(child): child.sendline('ps') for line in PS_EXPECTED: child.expect(line) + # Wait for all lines of the ps output to be displayed + child.expect_exact('>') def testfunc(child):