aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test-runner.h
diff options
context:
space:
mode:
authorMarek Chalupa <mchqwerty@gmail.com>2014-11-12 13:14:46 +0100
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2014-11-17 16:48:14 +0200
commit6ebe55060e6337f56e295032cc776fce694acbdb (patch)
tree686e80bc077b17487edc0e3c79ab2aab47c8cc34 /tests/test-runner.h
parenttests: add timeout (diff)
downloadwayland-6ebe55060e6337f56e295032cc776fce694acbdb.tar
wayland-6ebe55060e6337f56e295032cc776fce694acbdb.tar.gz
wayland-6ebe55060e6337f56e295032cc776fce694acbdb.tar.bz2
wayland-6ebe55060e6337f56e295032cc776fce694acbdb.tar.lz
wayland-6ebe55060e6337f56e295032cc776fce694acbdb.tar.xz
wayland-6ebe55060e6337f56e295032cc776fce694acbdb.tar.zst
wayland-6ebe55060e6337f56e295032cc776fce694acbdb.zip
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>
Diffstat (limited to 'tests/test-runner.h')
-rw-r--r--tests/test-runner.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test-runner.h b/tests/test-runner.h
index 3295e1c..0e03530 100644
--- a/tests/test-runner.h
+++ b/tests/test-runner.h
@@ -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