From 665a51ce1927be44e14524491e10bb45f089d79c Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 25 Jun 2023 15:20:06 +0200 Subject: Add more test cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- tests/Makefile | 2 ++ tests/fork-many.c | 11 +++++++++++ tests/fork-sleep.c | 17 +++++++++++++++++ tests/fork.c | 13 ++----------- 4 files changed, 32 insertions(+), 11 deletions(-) create mode 100644 tests/fork-many.c create mode 100644 tests/fork-sleep.c (limited to 'tests') 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 + +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 +#include + +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 #include 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; } -- cgit v1.2.3-70-g09d2