tests/xtimer_mutex_lock_timeout: don't assume number of threads at start

When CDC ACM is used as stdio the number of threads-in-use at the start of
the test is not always 2, as it used to be.
This commit is contained in:
Kees Bakker 2020-06-11 21:19:55 +02:00
parent 52fd00dc22
commit 2da9d200c8

View File

@ -29,14 +29,17 @@ def testfunc(child):
child.expect_exact("> ")
child.sendline("mutex_timeout_long_locked_low")
child.expect("starting test: xtimer mutex lock timeout with thread")
child.expect("threads = 2")
child.expect("threads = (\d+)")
num_threads = int(child.match.group(1))
child.expect("THREAD low prio: start")
child.expect("MAIN THREAD: calling xtimer_mutex_lock_timeout")
child.expect("OK")
child.expect("threads = 3")
child.expect("threads = (\d+)")
assert int(child.match.group(1)) == num_threads + 1
child.expect("MAIN THREAD: waiting for created thread to end")
child.expect("THREAD low prio: exiting low")
child.expect("threads = 2")
child.expect("threads = (\d+)")
assert int(child.match.group(1)) == num_threads
child.expect_exact("> ")
child.sendline("mutex_timeout_short_locked")
child.expect("starting test: xtimer mutex lock timeout with short timeout and locked mutex")