tests/xtimer_usleep: use test_utils_interactive_sync
Use test_utils_interactive_sync for synchronizing test instead of the custom 'getchar' handling.
This commit is contained in:
parent
f193ffd604
commit
1172ca9f93
@ -6,8 +6,7 @@ TEST_ON_CI_WHITELIST += all
|
|||||||
# This test randomly fails on `native` so disable it from CI
|
# This test randomly fails on `native` so disable it from CI
|
||||||
TEST_ON_CI_BLACKLIST += native
|
TEST_ON_CI_BLACKLIST += native
|
||||||
|
|
||||||
# This application uses getchar and thus expects input from stdio
|
USEMODULE += test_utils_interactive_sync
|
||||||
USEMODULE += stdin
|
|
||||||
|
|
||||||
# Port and pin configuration for probing with oscilloscope
|
# Port and pin configuration for probing with oscilloscope
|
||||||
# Port number should be found in port enum e.g in cpu/include/periph_cpu.h
|
# Port number should be found in port enum e.g in cpu/include/periph_cpu.h
|
||||||
|
|||||||
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include "xtimer.h"
|
#include "xtimer.h"
|
||||||
#include "timex.h"
|
#include "timex.h"
|
||||||
|
#include "test_utils/interactive_sync.h"
|
||||||
|
|
||||||
#define RUNS (5U)
|
#define RUNS (5U)
|
||||||
#define SLEEP_TIMES_NUMOF ARRAY_SIZE(sleep_times)
|
#define SLEEP_TIMES_NUMOF ARRAY_SIZE(sleep_times)
|
||||||
@ -61,8 +62,7 @@ int main(void)
|
|||||||
|
|
||||||
printf("Running test %u times with %u distinct sleep times\n", RUNS,
|
printf("Running test %u times with %u distinct sleep times\n", RUNS,
|
||||||
(unsigned)SLEEP_TIMES_NUMOF);
|
(unsigned)SLEEP_TIMES_NUMOF);
|
||||||
puts("Please hit any key and then ENTER to continue");
|
test_utils_interactive_sync();
|
||||||
getchar();
|
|
||||||
start_test = xtimer_now_usec();
|
start_test = xtimer_now_usec();
|
||||||
for (unsigned m = 0; m < RUNS; m++) {
|
for (unsigned m = 0; m < RUNS; m++) {
|
||||||
for (unsigned n = 0;
|
for (unsigned n = 0;
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from testrunner import run
|
from testrunner import run, test_utils_interactive_sync
|
||||||
|
|
||||||
|
|
||||||
US_PER_SEC = 1000000
|
US_PER_SEC = 1000000
|
||||||
@ -28,8 +28,7 @@ def testfunc(child):
|
|||||||
RUNS = int(child.match.group(1))
|
RUNS = int(child.match.group(1))
|
||||||
SLEEP_TIMES_NUMOF = int(child.match.group(2))
|
SLEEP_TIMES_NUMOF = int(child.match.group(2))
|
||||||
try:
|
try:
|
||||||
child.expect_exact(u"Please hit any key and then ENTER to continue")
|
test_utils_interactive_sync(child)
|
||||||
child.sendline(u"a")
|
|
||||||
start_test = time.time()
|
start_test = time.time()
|
||||||
for m in range(RUNS):
|
for m in range(RUNS):
|
||||||
for n in range(SLEEP_TIMES_NUMOF):
|
for n in range(SLEEP_TIMES_NUMOF):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user