From 6178e378c1201f9b0e7d934969e4e416bb93d219 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Fri, 19 Oct 2018 15:39:36 +0200 Subject: [PATCH] Test libc sleep and gettime in run/libc Ref #3018 --- repos/libports/run/libc.run | 11 +++++++---- repos/libports/src/test/libc/main.cc | 9 +++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/repos/libports/run/libc.run b/repos/libports/run/libc.run index d58e43b472..48d328019a 100644 --- a/repos/libports/run/libc.run +++ b/repos/libports/run/libc.run @@ -1,4 +1,4 @@ -build "core init test/libc" +build "core init drivers/timer test/libc" create_boot_directory @@ -18,6 +18,10 @@ install_config { + + + + @@ -29,11 +33,10 @@ install_config { } build_boot_image { - core init test-libc + core init timer test-libc ld.lib.so libc.lib.so vfs.lib.so libm.lib.so posix.lib.so } append qemu_args " -nographic " -run_genode_until "child .* exited with exit value 0.*\n" 10 - +run_genode_until "child .* exited with exit value 0.*\n" 13 diff --git a/repos/libports/src/test/libc/main.cc b/repos/libports/src/test/libc/main.cc index c52bcebd5b..c0ef4604d2 100644 --- a/repos/libports/src/test/libc/main.cc +++ b/repos/libports/src/test/libc/main.cc @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -148,5 +149,13 @@ int main(int argc, char **argv) perror("perror"); + struct timespec ts; + for (int i = 0; i < 3; ++i) { + sleep(1); + ts.tv_sec = ts.tv_nsec = 0; + clock_gettime(CLOCK_MONOTONIC, &ts); + printf("sleep/gettime: %.09f\n", ts.tv_sec + ts.tv_nsec / 1000000000.0); + } + exit(error_count); }