From 79016dc2b3d11f38003722fbec30d54a3cd9b7fa Mon Sep 17 00:00:00 2001 From: Emil Tsalapatis Date: Mon, 2 Oct 2023 18:16:15 -0400 Subject: [PATCH] break up spawntest into seperate tests --- SConstruct | 4 +++- release/bootdisk.manifest | 4 +++- tests/SConscript | 22 ++++++++++++++++----- tests/{spawntest.c => spawnanytest.c} | 9 --------- tests/spawnmultipletest.c | 28 +++++++++++++++++++++++++++ tests/spawnsingletest.c | 26 +++++++++++++++++++++++++ 6 files changed, 77 insertions(+), 16 deletions(-) rename tests/{spawntest.c => spawnanytest.c} (66%) create mode 100644 tests/spawnmultipletest.c create mode 100644 tests/spawnsingletest.c diff --git a/SConstruct b/SConstruct index 0fc6261..6be0530 100644 --- a/SConstruct +++ b/SConstruct @@ -215,7 +215,9 @@ if env["BOOTDISK"] == "1": Depends(bootdisk, "#build/sys/castor") #Depends(bootdisk, "#build/tests/lwiptest") Depends(bootdisk, "#build/tests/pthreadtest") - Depends(bootdisk, "#build/tests/spawntest") + Depends(bootdisk, "#build/tests/spawnanytest") + Depends(bootdisk, "#build/tests/spawnmultipletest") + Depends(bootdisk, "#build/tests/spawnsingletest") Depends(bootdisk, "#build/tests/threadtest") env.Alias('bootdisk', '#build/bootdisk.img') env.Install('$PREFIX/','#build/bootdisk.img') diff --git a/release/bootdisk.manifest b/release/bootdisk.manifest index bf827bb..26431da 100644 --- a/release/bootdisk.manifest +++ b/release/bootdisk.manifest @@ -20,7 +20,9 @@ DIR / END DIR tests FILE pthreadtest build/tests/pthreadtest - FILE spawntest build/tests/spawntest + FILE spawnsingletest build/tests/spawnsingletest + FILE spawnmultipletest build/tests/spawnmultipletest + FILE spawnanytest build/tests/spawnanytest FILE threadtest build/tests/threadtest END FILE LICENSE LICENSE diff --git a/tests/SConscript b/tests/SConscript index 8183fa8..7bb73d6 100644 --- a/tests/SConscript +++ b/tests/SConscript @@ -15,11 +15,23 @@ threadtest_src.append(["threadtest.c"]) threadtest_src.append(env["CRTEND"]) test_env.Program("threadtest", threadtest_src) -spawntest_src = [] -spawntest_src.append(env["CRTBEGIN"]) -spawntest_src.append(["spawntest.c"]) -spawntest_src.append(env["CRTEND"]) -test_env.Program("spawntest", spawntest_src) +spawnanytest_src = [] +spawnanytest_src.append(env["CRTBEGIN"]) +spawnanytest_src.append(["spawnanytest.c"]) +spawnanytest_src.append(env["CRTEND"]) +test_env.Program("spawnanytest", spawnanytest_src) + +spawnmultipletest_src = [] +spawnmultipletest_src.append(env["CRTBEGIN"]) +spawnmultipletest_src.append(["spawnmultipletest.c"]) +spawnmultipletest_src.append(env["CRTEND"]) +test_env.Program("spawnmultipletest", spawnmultipletest_src) + +spawnsingletest_src = [] +spawnsingletest_src.append(env["CRTBEGIN"]) +spawnsingletest_src.append(["spawnsingletest.c"]) +spawnsingletest_src.append(env["CRTEND"]) +test_env.Program("spawnsingletest", spawnsingletest_src) pthreadtest_src = [] pthreadtest_src.append(env["CRTBEGIN"]) diff --git a/tests/spawntest.c b/tests/spawnanytest.c similarity index 66% rename from tests/spawntest.c rename to tests/spawnanytest.c index fa4e7c7..1e78719 100644 --- a/tests/spawntest.c +++ b/tests/spawnanytest.c @@ -12,15 +12,6 @@ main(int argc, const char *argv[]) { int status[10]; - printf("Spawn test: "); - for (int i = 0; i < 100; i++) { - status[0] = OSSpawn("/bin/echo", &argv[0]); - printf("spawn: %lx\n", status[0]); - status[0] = OSWait(status[0]); - printf("wait: %lx\n", status[0]); - } - printf("Success!\n"); - printf("Spawn parallel test wait any: "); for (int i = 0; i < 10; i++) { status[i] = OSSpawn("/bin/echo", &argv[0]); diff --git a/tests/spawnmultipletest.c b/tests/spawnmultipletest.c new file mode 100644 index 0000000..bc6888c --- /dev/null +++ b/tests/spawnmultipletest.c @@ -0,0 +1,28 @@ + +#include +#include +#include +#include + +// Castor Only +#include + +int +main(int argc, const char *argv[]) +{ + int status[10]; + + printf("Spawn parallel test wait any: "); + for (int i = 0; i < 10; i++) { + status[i] = OSSpawn("/bin/echo", &argv[0]); + printf("spawn: %lx\n", status[i]); + } + for (int i = 0; i < 10; i++) { + status[i] = OSWait(status[i]); + printf("wait: %lx\n", status[i]); + } + printf("Success!\n"); + + return 0; +} + diff --git a/tests/spawnsingletest.c b/tests/spawnsingletest.c new file mode 100644 index 0000000..01f5938 --- /dev/null +++ b/tests/spawnsingletest.c @@ -0,0 +1,26 @@ + +#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 < 100; i++) { + status[0] = OSSpawn("/bin/echo", &argv[0]); + printf("spawn: %lx\n", status[0]); + status[0] = OSWait(status[0]); + printf("wait: %lx\n", status[0]); + } + printf("Success!\n"); + + return 0; +} +