Add spawntest to tests directory.
This commit is contained in:
parent
feb45381ba
commit
ed9a15e97d
@ -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')
|
||||
|
@ -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
|
||||
|
@ -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"])
|
||||
|
@ -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");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user