Test libc sleep and gettime in run/libc

Ref #3018
This commit is contained in:
Emery Hemingway 2018-10-19 15:39:36 +02:00 committed by Christian Helmuth
parent 3e31e2ba53
commit 6178e378c1
2 changed files with 16 additions and 4 deletions

View File

@ -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 {
<any-service> <parent/> <any-child/> </any-service>
</default-route>
<default caps="200"/>
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides> <service name="Timer"/> </provides>
</start>
<start name="test-libc">
<resource name="RAM" quantum="400M"/>
<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

View File

@ -26,6 +26,7 @@
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <time.h>
#include <sys/syscall.h>
@ -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);
}