diff options
author | Mattias Andrée <maandree@kth.se> | 2023-06-25 15:20:06 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2023-06-25 15:20:06 +0200 |
commit | 665a51ce1927be44e14524491e10bb45f089d79c (patch) | |
tree | b7d7804ccdef649150e362356fc11cbaf9616a2e /tests | |
parent | Add -a and trivial improvements (diff) | |
download | sctrace-665a51ce1927be44e14524491e10bb45f089d79c.tar.gz sctrace-665a51ce1927be44e14524491e10bb45f089d79c.tar.bz2 sctrace-665a51ce1927be44e14524491e10bb45f089d79c.tar.xz |
Add more test cases
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile | 2 | ||||
-rw-r--r-- | tests/fork-many.c | 11 | ||||
-rw-r--r-- | tests/fork-sleep.c | 17 | ||||
-rw-r--r-- | tests/fork.c | 13 |
4 files changed, 32 insertions, 11 deletions
diff --git a/tests/Makefile b/tests/Makefile index 6e0d8da..7468bfa 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -6,6 +6,8 @@ BIN_64 =\ exec.64\ exit.64\ fork.64\ + fork-many.64\ + fork-sleep.64\ fork-stop.64\ kill.64\ raise.64\ diff --git a/tests/fork-many.c b/tests/fork-many.c new file mode 100644 index 0000000..b0f88ad --- /dev/null +++ b/tests/fork-many.c @@ -0,0 +1,11 @@ +#include <unistd.h> + +int +main(void) +{ + fork(); + fork(); + fork(); + fork(); + return 0; +} diff --git a/tests/fork-sleep.c b/tests/fork-sleep.c new file mode 100644 index 0000000..f48c0b1 --- /dev/null +++ b/tests/fork-sleep.c @@ -0,0 +1,17 @@ +#include <time.h> +#include <unistd.h> + +int +main(void) +{ + struct timespec ts = {0, 100000000L}; + switch (fork()) { + case -1: + return 2; + case 0: + return 0; + default: + nanosleep(&ts, NULL); + return 1; + } +} diff --git a/tests/fork.c b/tests/fork.c index 993e0d4..40eed7d 100644 --- a/tests/fork.c +++ b/tests/fork.c @@ -1,17 +1,8 @@ -#include <time.h> #include <unistd.h> int main(void) { - struct timespec ts = {0, 100000000L}; - switch (fork()) { - case -1: - return -1; - case 0: - return 2; - default: - nanosleep(&ts, NULL); - return 1; - } + fork(); + return 0; } |