Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: fix posix_semaphore output and for timer error [2016.10-backport] #6088

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/posix_semaphore/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ BOARD_INSUFFICIENT_MEMORY := msb-430 msb-430h mbed_lpc1768 chronos stm32f0discov
pca10000 pca10005 weio yunjia-nrf51822 nrf6310 spark-core \
nucleo-f334 nucleo-f030

USEMODULE += fmt
USEMODULE += posix_semaphore

DISABLE_MODULE += auto_init
Expand Down
12 changes: 9 additions & 3 deletions tests/posix_semaphore/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <stdio.h>
#include <semaphore.h>

#include "fmt.h"
#include "msg.h"
#include "timex.h"
#include "thread.h"
Expand Down Expand Up @@ -237,6 +238,7 @@ void test3(void)

void test4(void)
{
char uint64_str[20];
struct timespec abs;
uint64_t now, start, stop;
const uint64_t exp = 1000000;
Expand All @@ -259,10 +261,14 @@ void test4(void)
}
}
stop = xtimer_now64() - start;
if (stop < exp) {
printf("first: waited only %" PRIu64 " usec => FAILED\n", stop);
if ((stop < (exp - 100)) || (stop > (exp + 100))) {
fmt_u64_dec(uint64_str, stop);
printf("first: waited only %s usec => FAILED\n", uint64_str);
}
else {
fmt_u64_dec(uint64_str, stop);
printf("first: waited %s usec\n", uint64_str);
}
printf("first: waited %" PRIu64 " usec\n", stop);
}

int main(void)
Expand Down