From 05e9b437227a07476953bc6b86d1c6674e69dfbe Mon Sep 17 00:00:00 2001 From: Bahadir Balban Date: Wed, 17 Sep 2008 09:51:52 +0300 Subject: [PATCH] test0 tests now don't fork, they compare read/write strings. --- tasks/test0/main.c | 12 ++++++------ tasks/test0/src/fileio.c | 4 ++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/tasks/test0/main.c b/tasks/test0/main.c index a1d3304..ef0caf4 100644 --- a/tasks/test0/main.c +++ b/tasks/test0/main.c @@ -32,24 +32,24 @@ void main(void) dirtest(); - printf("Forking...\n"); +// printf("Forking...\n"); - if ((pid = fork()) < 0) - printf("Error forking...\n"); +// if ((pid = fork()) < 0) +// printf("Error forking...\n"); - if (pid == 0) { +// if (pid == 0) { printf("File IO test 1, done by child:\n"); if (fileio() == 0) printf("-- PASSED --\n"); else printf("-- FAILED --\n"); - } else { +// } else { printf("File IO test 2, done by parent, with child pid %d:\n", pid); if (fileio2() == 0) printf("-- PASSED --\n"); else printf("-- FAILED --\n"); - } +// } while (1) wait_pager(0); #if 0 diff --git a/tasks/test0/src/fileio.c b/tasks/test0/src/fileio.c index 8168ead..c0e6812 100644 --- a/tasks/test0/src/fileio.c +++ b/tasks/test0/src/fileio.c @@ -56,6 +56,8 @@ int fileio2(void) printf("%d: Read: %d bytes from file.\n", tid, cnt); if (cnt) { printf("%d: Read string: %s\n", tid, buf); + if (strcmp(buf, str)) + return -1; } printf("%d: close.\n", tid); @@ -104,6 +106,8 @@ int fileio(void) printf("%d: Read: %d bytes from file.\n", tid, cnt); if (cnt) { printf("%d: Read string: %s\n", tid, buf); + if (strcmp(buf, str)) + return -1; } printf("%d: close.\n", tid);