tests: add test_usleep and test_sleep functions

The former one was already used in tests, but was private.
These functions can be shared across the tests, so make them
public.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
Marek Chalupa 2014-11-12 13:14:46 +01:00 committed by Pekka Paalanen
parent 7bf8049c48
commit 6ebe55060e
3 changed files with 44 additions and 15 deletions

View file

@ -5,6 +5,8 @@
#error "Tests must not be built with NDEBUG defined, they rely on assert()."
#endif
#include <unistd.h>
struct test {
const char *name;
void (*run)(void);
@ -44,4 +46,14 @@ exec_fd_leak_check(int nr_expected_fds); /* never returns */
void
test_set_timeout(unsigned int);
/* test-runner uses alarm() and SIGALRM, so we can not
* use usleep and sleep functions in tests (see 'man usleep'
* or 'man sleep', respectively). Following functions are safe
* to use in tests */
void
test_usleep(useconds_t);
void
test_sleep(unsigned int);
#endif