Add spawntest to tests directory.

This commit is contained in:
Ali Mashtizadeh 2023-09-03 14:55:51 -04:00
parent feb45381ba
commit ed9a15e97d
4 changed files with 16 additions and 4 deletions

View File

@ -210,6 +210,7 @@ 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/threadtest")
env.Alias('bootdisk', '#build/bootdisk.img')
env.Install('$PREFIX/','#build/bootdisk.img')

View File

@ -20,6 +20,7 @@ DIR /
END
DIR tests
FILE pthreadtest build/tests/pthreadtest
FILE spawntest build/tests/spawntest
FILE threadtest build/tests/threadtest
END
FILE LICENSE LICENSE

View File

@ -15,6 +15,12 @@ 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)
pthreadtest_src = []
pthreadtest_src.append(env["CRTBEGIN"])
pthreadtest_src.append(["pthreadtest.c"])

View File

@ -13,18 +13,22 @@ main(int argc, const char *argv[])
int status[10];
printf("Spawn test: ");
for (int i = 0; i < 10; i++) {
for (int i = 0; i < 100; i++) {
status[0] = OSSpawn("/bin/echo", &argv[0]);
OSWait(status[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: ");
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++) {
OSWait(0);
status[i] = OSWait(0);
printf("wait: %lx\n", status[i]);
}
printf("Success!\n");