From 179c862c5165951c5c198adb5e0ab8cbb3d331c6 Mon Sep 17 00:00:00 2001 From: Ali Mashtizadeh Date: Sat, 2 Sep 2023 18:42:00 -0400 Subject: [PATCH] Add spawntest --- tests/spawntest.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/spawntest.c diff --git a/tests/spawntest.c b/tests/spawntest.c new file mode 100644 index 0000000..51555a7 --- /dev/null +++ b/tests/spawntest.c @@ -0,0 +1,33 @@ + +#include +#include +#include +#include + +// Castor Only +#include + +int +main(int argc, const char *argv[]) +{ + int status[10]; + + printf("Spawn test: "); + for (int i = 0; i < 10; i++) { + status[0] = OSSpawn("/bin/echo", &argv[0]); + OSWait(status[0]); + } + printf("Success!\n"); + + printf("Spawn parallel test: "); + for (int i = 0; i < 10; i++) { + status[i] = OSSpawn("/bin/echo", &argv[0]); + } + for (int i = 0; i < 10; i++) { + OSWait(0); + } + printf("Success!\n"); + + return 0; +} +