Merge branch 'master' of ssh://review.rcs.uwaterloo.ca:77/source/castoros

This commit is contained in:
Ali Mashtizadeh 2023-10-02 19:33:50 -04:00
commit 92c5b44114
6 changed files with 77 additions and 16 deletions

View File

@ -219,7 +219,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')

View File

@ -22,7 +22,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

View File

@ -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"])

View File

@ -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]);

28
tests/spawnmultipletest.c Normal file
View File

@ -0,0 +1,28 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
// Castor Only
#include <syscall.h>
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;
}

26
tests/spawnsingletest.c Normal file
View File

@ -0,0 +1,26 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
// Castor Only
#include <syscall.h>
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;
}