TARDIS icon indicating copy to clipboard operation
TARDIS copied to clipboard

Add tests

Open maxbla opened this issue 4 years ago • 0 comments

Here's a proof of concept for how to write tests for this library.

test_nanosleep.c, a simple program that waits for 10 seconds using clock_nanosleep

#include <time.h>

int main() {
    struct timespec rqtp = (struct timespec){.tv_sec=10, .tv_nsec=0};
    clock_nanosleep(CLOCK_REALTIME, 0, &rqtp, NULL);
}

compiling test_nanosleep.c to test_nanosleep.o, and running time ./tardis 10 10 ./test_nanosleep.o gives

0.00s user 0.00s system 0% cpu 1.003 total

In other words, time is "outside" tardis, so is unaffected by the time warp.

Would a PR be welcome that adds tests using this, or a similar mechanism for all supported syscalls?

maxbla avatar Jul 06 '20 10:07 maxbla