Add spawntest
This commit is contained in:
parent
72341c3c8b
commit
179c862c51
33
tests/spawntest.c
Normal file
33
tests/spawntest.c
Normal file
@ -0,0 +1,33 @@
|
||||
|
||||
#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 < 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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user