mirror of
https://github.com/drasko/codezero.git
synced 2026-07-19 21:55:24 +02:00
test0 tests now don't fork, they compare read/write strings.
This commit is contained in:
@@ -32,24 +32,24 @@ void main(void)
|
|||||||
|
|
||||||
dirtest();
|
dirtest();
|
||||||
|
|
||||||
printf("Forking...\n");
|
// printf("Forking...\n");
|
||||||
|
|
||||||
if ((pid = fork()) < 0)
|
// if ((pid = fork()) < 0)
|
||||||
printf("Error forking...\n");
|
// printf("Error forking...\n");
|
||||||
|
|
||||||
if (pid == 0) {
|
// if (pid == 0) {
|
||||||
printf("File IO test 1, done by child:\n");
|
printf("File IO test 1, done by child:\n");
|
||||||
if (fileio() == 0)
|
if (fileio() == 0)
|
||||||
printf("-- PASSED --\n");
|
printf("-- PASSED --\n");
|
||||||
else
|
else
|
||||||
printf("-- FAILED --\n");
|
printf("-- FAILED --\n");
|
||||||
} else {
|
// } else {
|
||||||
printf("File IO test 2, done by parent, with child pid %d:\n", pid);
|
printf("File IO test 2, done by parent, with child pid %d:\n", pid);
|
||||||
if (fileio2() == 0)
|
if (fileio2() == 0)
|
||||||
printf("-- PASSED --\n");
|
printf("-- PASSED --\n");
|
||||||
else
|
else
|
||||||
printf("-- FAILED --\n");
|
printf("-- FAILED --\n");
|
||||||
}
|
// }
|
||||||
while (1)
|
while (1)
|
||||||
wait_pager(0);
|
wait_pager(0);
|
||||||
#if 0
|
#if 0
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ int fileio2(void)
|
|||||||
printf("%d: Read: %d bytes from file.\n", tid, cnt);
|
printf("%d: Read: %d bytes from file.\n", tid, cnt);
|
||||||
if (cnt) {
|
if (cnt) {
|
||||||
printf("%d: Read string: %s\n", tid, buf);
|
printf("%d: Read string: %s\n", tid, buf);
|
||||||
|
if (strcmp(buf, str))
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%d: close.\n", tid);
|
printf("%d: close.\n", tid);
|
||||||
@@ -104,6 +106,8 @@ int fileio(void)
|
|||||||
printf("%d: Read: %d bytes from file.\n", tid, cnt);
|
printf("%d: Read: %d bytes from file.\n", tid, cnt);
|
||||||
if (cnt) {
|
if (cnt) {
|
||||||
printf("%d: Read string: %s\n", tid, buf);
|
printf("%d: Read string: %s\n", tid, buf);
|
||||||
|
if (strcmp(buf, str))
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%d: close.\n", tid);
|
printf("%d: close.\n", tid);
|
||||||
|
|||||||
Reference in New Issue
Block a user