diff options
-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; } |