diff --git a/tests/ztimer_overhead/main.c b/tests/ztimer_overhead/main.c index 9e2723e2a8..03f258e635 100644 --- a/tests/ztimer_overhead/main.c +++ b/tests/ztimer_overhead/main.c @@ -20,6 +20,7 @@ #include #include +#include #include #include "ztimer.h" @@ -32,16 +33,17 @@ int main(void) { uint32_t total = 0; - uint16_t min = 0xFFFF; - uint16_t max = 0; + int32_t min = INT32_MAX; + int32_t max = INT32_MIN; /* unset configured adjustment */ /* ZTIMER_USEC->adjust = 0; */ + printf("ZTIMER_USEC->adjust = %" PRIu32 "\n", ZTIMER_USEC->adjust); unsigned n = SAMPLES; while (n--) { - unsigned overhead = ztimer_overhead(ZTIMER_USEC, BASE); - total += overhead; + int32_t overhead = ztimer_overhead(ZTIMER_USEC, BASE); + total += labs(overhead); if (overhead < min) { min = overhead; } @@ -50,7 +52,8 @@ int main(void) } } - printf("min=%u max=%u avg=%" PRIu32 "\n", min, max, (total / SAMPLES)); + printf("min=%" PRIi32 " max=%" PRIi32 " avg_diff=%" PRIi32 "\n", min, max, + (total / SAMPLES)); return 0; } diff --git a/tests/ztimer_overhead/tests/01-run.py b/tests/ztimer_overhead/tests/01-run.py index 8430a94fea..d838f7a72d 100755 --- a/tests/ztimer_overhead/tests/01-run.py +++ b/tests/ztimer_overhead/tests/01-run.py @@ -11,7 +11,7 @@ from testrunner import run def testfunc(child): - child.expect(r"min=\d+ max=\d+ avg=\d+\r\n") + child.expect(r"min=-?\d+ max=-?\d+ avg_diff=\d+\r\n") if __name__ == "__main__":