From ab9e036cb7b3f2a7278b29fae79dcae31e28f0f9 Mon Sep 17 00:00:00 2001 From: Bahadir Balban Date: Thu, 28 May 2009 13:23:44 +0300 Subject: [PATCH] Updated test pass/fail print messages for test0 --- src/api/ipc.c | 29 +++++---------------------- tasks/test0/main.c | 8 ++++---- tasks/test0/src/clonetest.c | 4 ++-- tasks/test0/src/dirtest.c | 4 ++-- tasks/test0/src/exectest.c | 2 +- tasks/test0/src/fileio.c | 4 ++-- tasks/test0/src/forktest.c | 4 ++-- tasks/test0/src/ipctest.c | 22 ++++++++++---------- tasks/test0/src/mmaptest.c | 4 ++-- tasks/test0/src/shmtest.c | 4 ++-- tasks/test0/src/test_exec/test_exec.c | 4 ++-- 11 files changed, 35 insertions(+), 54 deletions(-) diff --git a/src/api/ipc.c b/src/api/ipc.c index c3a8856..a2c55c4 100644 --- a/src/api/ipc.c +++ b/src/api/ipc.c @@ -64,6 +64,7 @@ int ipc_full_copy(struct ktcb *to, struct ktcb *from) return 0; } + /* * Extended copy is asymmetric in that the copying always occurs from * the sender's kernel stack to receivers userspace buffers. @@ -353,11 +354,9 @@ int ipc_sendrecv(l4id_t to, l4id_t from, unsigned int flags) /* Send ipc request */ if ((ret = ipc_send(to, flags)) < 0) return ret; - /* - * Get reply. - * A client would block its server only very briefly - * between these calls. + * Get reply. A client would block its server + * only very briefly between these calls. */ if ((ret = ipc_recv(from, flags)) < 0) return ret; @@ -411,12 +410,6 @@ int ipc_recv_extended(l4id_t sendertid, unsigned int flags) if ((err = ipc_recv(sendertid, flags)) < 0) return err; - /* - * NOTE: After this point primary mrs may be trashed. - * We need to save them here if we want to retain their values - * after a page fault ipc. Currently they're not needed. - */ - /* Page fault user pages if needed */ if ((err = check_access(ipc_address, size, MAP_USR_RW_FLAGS, 1)) < 0) @@ -467,12 +460,6 @@ int ipc_send_extended(l4id_t recv_tid, unsigned int flags) /* Set extended ipc copy size */ current->extended_ipc_size = size; - /* - * NOTE: After this point primary mrs may be trashed. - * We need to save them here if we want to retain their values - * after a page fault ipc. Currently they're not needed. - */ - /* Page fault those pages on the current task if needed */ if ((err = check_access(ipc_address, size, MAP_USR_RW_FLAGS, 1)) < 0) @@ -489,6 +476,7 @@ int ipc_send_extended(l4id_t recv_tid, unsigned int flags) return ipc_send(recv_tid, flags); } + static inline int __sys_ipc(l4id_t to, l4id_t from, unsigned int ipc_type, unsigned int flags) { @@ -547,7 +535,7 @@ void printk_sysregs(syscall_context_t *regs) /* * sys_ipc has multiple functions. In a nutshell: * - Copies message registers from one thread to another. - * - Sends notification bits from one thread to another. + * - Sends notification bits from one thread to another. - Not there yet. * - Synchronises the threads involved in ipc. (i.e. a blocking rendez-vous) * - Can propagate messages from third party threads. * - A thread can both send and receive on the same call. @@ -560,13 +548,6 @@ int sys_ipc(syscall_context_t *regs) unsigned int ipc_type = 0; int ret = 0; -/* - if ((flags & L4_IPC_FLAGS_TYPE_MASK) == L4_IPC_FLAGS_EXTENDED) - __asm__ __volatile__ ( - "1:\n" - "b 1b\n"); -*/ - /* Check arguments */ if (from < L4_ANYTHREAD) { ret = -EINVAL; diff --git a/tasks/test0/main.c b/tasks/test0/main.c index f12f39e..e351826 100644 --- a/tasks/test0/main.c +++ b/tasks/test0/main.c @@ -33,7 +33,6 @@ void main(void) wait_pager(0); - ipc_full_test(); printf("\n%s: Running POSIX API tests.\n", __TASKNAME__); @@ -49,10 +48,11 @@ void main(void) clonetest(); - if (parent_of_all == getpid()) + if (parent_of_all == getpid()) { + ipc_full_test(); ipc_extended_test(); - else - exectest(); + } + exectest(); while (1) wait_pager(0); diff --git a/tasks/test0/src/clonetest.c b/tasks/test0/src/clonetest.c index 8cada04..a0f50d2 100644 --- a/tasks/test0/src/clonetest.c +++ b/tasks/test0/src/clonetest.c @@ -49,11 +49,11 @@ int clonetest(void) /* TODO: Add wait() or something similar and check that global is 100 */ if (getpid() == parent_of_all) - printf("CLONE TEST -- PASSED --\n"); + printf("CLONE TEST -- PASSED --\n"); return 0; out_err: - printf("CLONE TEST -- FAILED --\n"); + printf("CLONE TEST -- FAILED --\n"); return 0; } diff --git a/tasks/test0/src/dirtest.c b/tasks/test0/src/dirtest.c index 5fcfe43..ca7300f 100644 --- a/tasks/test0/src/dirtest.c +++ b/tasks/test0/src/dirtest.c @@ -203,11 +203,11 @@ int dirtest(void) if (lsdir("/usr/./././bin//") < 0) goto out_err; - printf("DIR TEST -- PASSED --\n"); + printf("DIR TEST -- PASSED --\n"); return 0; out_err: - printf("DIR TEST -- FAILED --\n"); + printf("DIR TEST -- FAILED --\n"); return 0; } diff --git a/tasks/test0/src/exectest.c b/tasks/test0/src/exectest.c index 5aa7bb3..dcc5cbd 100644 --- a/tasks/test0/src/exectest.c +++ b/tasks/test0/src/exectest.c @@ -54,7 +54,7 @@ int exectest(void) execve(filename, argv, 0); out_err: - printf("EXECVE TEST -- FAILED --\n"); + printf("EXECVE TEST -- FAILED --\n"); return 0; } diff --git a/tasks/test0/src/fileio.c b/tasks/test0/src/fileio.c index 253fd61..b5aabe3 100644 --- a/tasks/test0/src/fileio.c +++ b/tasks/test0/src/fileio.c @@ -62,11 +62,11 @@ int fileio(void) } if (getpid() == parent_of_all) - printf("FILE IO TEST -- PASSED --\n"); + printf("FILE IO TEST -- PASSED --\n"); return 0; out_err: - printf("FILE IO TEST -- FAILED --\n"); + printf("FILE IO TEST -- FAILED --\n"); return 0; } diff --git a/tasks/test0/src/forktest.c b/tasks/test0/src/forktest.c index 57587f4..204b83e 100644 --- a/tasks/test0/src/forktest.c +++ b/tasks/test0/src/forktest.c @@ -43,13 +43,13 @@ int forktest(void) } if (getpid() == parent_of_all) - printf("FORK TEST -- PASSED --\n"); + printf("FORK TEST -- PASSED --\n"); return 0; /* Any erroneous child or parent comes here */ out_err: - printf("FORK TEST -- FAILED --\n"); + printf("FORK TEST -- FAILED --\n"); return 0; } diff --git a/tasks/test0/src/ipctest.c b/tasks/test0/src/ipctest.c index 0665a3a..1982709 100644 --- a/tasks/test0/src/ipctest.c +++ b/tasks/test0/src/ipctest.c @@ -40,9 +40,9 @@ void ipc_full_test(void) } if (!ret) - printf("FULL IPC TEST: -- PASSED --\n"); + printf("FULL IPC TEST: -- PASSED --\n"); else - printf("FULL IPC TEST: -- FAILED --\n"); + printf("FULL IPC TEST: -- FAILED --\n"); } /* @@ -60,13 +60,13 @@ void ipc_extended_test(void) /* Fork the current task */ if ((child = fork()) < 0) { - printf("%s: Fork failed with %d\n", __FUNCTION__, errno); + test_printf("%s: Fork failed with %d\n", __FUNCTION__, errno); goto out_err; } if (child) - printf("%d: Created child with pid %d\n", getpid(), child); + test_printf("%d: Created child with pid %d\n", getpid(), child); else - printf("Child %d running.\n", getpid()); + test_printf("Child %d running.\n", getpid()); /* This test makes this assumption */ BUG_ON(L4_IPC_EXTENDED_MAX_SIZE > PAGE_SIZE); @@ -81,7 +81,7 @@ void ipc_extended_test(void) __FUNCTION__, (int)base); goto out_err; } else - printf("mmap: Anonymous private buffer at %p\n", base); + test_printf("mmap: Anonymous private buffer at %p\n", base); /* * Both tasks read/write both pages @@ -100,7 +100,7 @@ void ipc_extended_test(void) ipcbuf[L4_IPC_EXTENDED_MAX_SIZE - 1] = '\0'; /* Send message to parent */ - printf("Child sending message: %s\n", ipcbuf); + test_printf("Child sending message: %s\n", ipcbuf); if ((err = l4_send_extended(parent, L4_IPC_TAG_SYNC_EXTENDED, L4_IPC_EXTENDED_MAX_SIZE, ipcbuf)) < 0) { @@ -116,7 +116,7 @@ void ipc_extended_test(void) * This should prove that page faults are handled during * the ipc. */ - printf("Parent: extended receiving from child.\n"); + test_printf("Parent: extended receiving from child.\n"); if ((err = l4_receive_extended(child, L4_IPC_EXTENDED_MAX_SIZE, ipcbuf)) < 0) { printf("Extended ipc error: %d\n", err); @@ -124,7 +124,7 @@ void ipc_extended_test(void) } /* We now print the message created by child. */ - printf("(%d): Message received from child: %s\n", + test_printf("(%d): Message received from child: %s\n", getpid(), ipcbuf); /* Check that string received from child is an exact match */ @@ -137,12 +137,12 @@ void ipc_extended_test(void) if (ipcbuf[L4_IPC_EXTENDED_MAX_SIZE - 1] != '\0') goto out_err; - printf("EXTENDED IPC TEST: -- PASSED --\n"); + printf("EXTENDED IPC TEST: -- PASSED --\n"); } return; out_err: - printf("EXTENDED IPC TEST: -- FAILED --\n"); + printf("EXTENDED IPC TEST: -- FAILED --\n"); } diff --git a/tasks/test0/src/mmaptest.c b/tasks/test0/src/mmaptest.c index 95e37dd..5ff6230 100644 --- a/tasks/test0/src/mmaptest.c +++ b/tasks/test0/src/mmaptest.c @@ -46,11 +46,11 @@ int mmaptest(void) *(unsigned int *)(base + PAGE_SIZE*3) = 0x1000; *(unsigned int *)(base + PAGE_SIZE*1) = 0x1000; - printf("MMAP TEST -- PASSED --\n"); + printf("MMAP TEST -- PASSED --\n"); return 0; out_err: - printf("MMAP TEST -- FAILED --\n"); + printf("MMAP TEST -- FAILED --\n"); return 0; } diff --git a/tasks/test0/src/shmtest.c b/tasks/test0/src/shmtest.c index 25bad82..edf4d11 100644 --- a/tasks/test0/src/shmtest.c +++ b/tasks/test0/src/shmtest.c @@ -60,12 +60,12 @@ int shmtest(void) } if (getpid() == parent_of_all) - printf("SHM TEST -- PASSED --\n"); + printf("SHM TEST -- PASSED --\n"); return 0; out_err: - printf("SHM TEST -- FAILED --\n"); + printf("SHM TEST -- FAILED --\n"); return 0; } diff --git a/tasks/test0/src/test_exec/test_exec.c b/tasks/test0/src/test_exec/test_exec.c index eccd763..b1287b7 100644 --- a/tasks/test0/src/test_exec/test_exec.c +++ b/tasks/test0/src/test_exec/test_exec.c @@ -26,8 +26,8 @@ void main(void) { wait_pager(0); if (getpid() == 2) { - printf("EXECVE TEST -- PASSED --\n", getpid()); - printf("\n(Thread %d): Continues to sync with the pager...\n", getpid()); + printf("EXECVE TEST -- PASSED --\n", getpid()); + printf("\nThread (%d): Continues to sync with the pager...\n\n", getpid()); while (1) wait_pager(0); }