mirror of
https://github.com/drasko/codezero.git
synced 2026-04-17 17:29:04 +02:00
Updated test pass/fail print messages for test0
This commit is contained in:
@@ -64,6 +64,7 @@ int ipc_full_copy(struct ktcb *to, struct ktcb *from)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Extended copy is asymmetric in that the copying always occurs from
|
* Extended copy is asymmetric in that the copying always occurs from
|
||||||
* the sender's kernel stack to receivers userspace buffers.
|
* 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 */
|
/* Send ipc request */
|
||||||
if ((ret = ipc_send(to, flags)) < 0)
|
if ((ret = ipc_send(to, flags)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get reply.
|
* Get reply. A client would block its server
|
||||||
* A client would block its server only very briefly
|
* only very briefly between these calls.
|
||||||
* between these calls.
|
|
||||||
*/
|
*/
|
||||||
if ((ret = ipc_recv(from, flags)) < 0)
|
if ((ret = ipc_recv(from, flags)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
@@ -411,12 +410,6 @@ int ipc_recv_extended(l4id_t sendertid, unsigned int flags)
|
|||||||
if ((err = ipc_recv(sendertid, flags)) < 0)
|
if ((err = ipc_recv(sendertid, flags)) < 0)
|
||||||
return err;
|
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 */
|
/* Page fault user pages if needed */
|
||||||
if ((err = check_access(ipc_address, size,
|
if ((err = check_access(ipc_address, size,
|
||||||
MAP_USR_RW_FLAGS, 1)) < 0)
|
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 */
|
/* Set extended ipc copy size */
|
||||||
current->extended_ipc_size = 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 */
|
/* Page fault those pages on the current task if needed */
|
||||||
if ((err = check_access(ipc_address, size,
|
if ((err = check_access(ipc_address, size,
|
||||||
MAP_USR_RW_FLAGS, 1)) < 0)
|
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);
|
return ipc_send(recv_tid, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline int __sys_ipc(l4id_t to, l4id_t from,
|
static inline int __sys_ipc(l4id_t to, l4id_t from,
|
||||||
unsigned int ipc_type, unsigned int flags)
|
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:
|
* sys_ipc has multiple functions. In a nutshell:
|
||||||
* - Copies message registers from one thread to another.
|
* - 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)
|
* - Synchronises the threads involved in ipc. (i.e. a blocking rendez-vous)
|
||||||
* - Can propagate messages from third party threads.
|
* - Can propagate messages from third party threads.
|
||||||
* - A thread can both send and receive on the same call.
|
* - 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;
|
unsigned int ipc_type = 0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
/*
|
|
||||||
if ((flags & L4_IPC_FLAGS_TYPE_MASK) == L4_IPC_FLAGS_EXTENDED)
|
|
||||||
__asm__ __volatile__ (
|
|
||||||
"1:\n"
|
|
||||||
"b 1b\n");
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Check arguments */
|
/* Check arguments */
|
||||||
if (from < L4_ANYTHREAD) {
|
if (from < L4_ANYTHREAD) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ void main(void)
|
|||||||
|
|
||||||
wait_pager(0);
|
wait_pager(0);
|
||||||
|
|
||||||
ipc_full_test();
|
|
||||||
|
|
||||||
printf("\n%s: Running POSIX API tests.\n", __TASKNAME__);
|
printf("\n%s: Running POSIX API tests.\n", __TASKNAME__);
|
||||||
|
|
||||||
@@ -49,10 +48,11 @@ void main(void)
|
|||||||
|
|
||||||
clonetest();
|
clonetest();
|
||||||
|
|
||||||
if (parent_of_all == getpid())
|
if (parent_of_all == getpid()) {
|
||||||
|
ipc_full_test();
|
||||||
ipc_extended_test();
|
ipc_extended_test();
|
||||||
else
|
}
|
||||||
exectest();
|
exectest();
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
wait_pager(0);
|
wait_pager(0);
|
||||||
|
|||||||
@@ -49,11 +49,11 @@ int clonetest(void)
|
|||||||
/* TODO: Add wait() or something similar and check that global is 100 */
|
/* TODO: Add wait() or something similar and check that global is 100 */
|
||||||
|
|
||||||
if (getpid() == parent_of_all)
|
if (getpid() == parent_of_all)
|
||||||
printf("CLONE TEST -- PASSED --\n");
|
printf("CLONE TEST -- PASSED --\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
out_err:
|
out_err:
|
||||||
printf("CLONE TEST -- FAILED --\n");
|
printf("CLONE TEST -- FAILED --\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -203,11 +203,11 @@ int dirtest(void)
|
|||||||
if (lsdir("/usr/./././bin//") < 0)
|
if (lsdir("/usr/./././bin//") < 0)
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
|
||||||
printf("DIR TEST -- PASSED --\n");
|
printf("DIR TEST -- PASSED --\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_err:
|
out_err:
|
||||||
printf("DIR TEST -- FAILED --\n");
|
printf("DIR TEST -- FAILED --\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ int exectest(void)
|
|||||||
execve(filename, argv, 0);
|
execve(filename, argv, 0);
|
||||||
|
|
||||||
out_err:
|
out_err:
|
||||||
printf("EXECVE TEST -- FAILED --\n");
|
printf("EXECVE TEST -- FAILED --\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,11 +62,11 @@ int fileio(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (getpid() == parent_of_all)
|
if (getpid() == parent_of_all)
|
||||||
printf("FILE IO TEST -- PASSED --\n");
|
printf("FILE IO TEST -- PASSED --\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_err:
|
out_err:
|
||||||
printf("FILE IO TEST -- FAILED --\n");
|
printf("FILE IO TEST -- FAILED --\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,13 +43,13 @@ int forktest(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (getpid() == parent_of_all)
|
if (getpid() == parent_of_all)
|
||||||
printf("FORK TEST -- PASSED --\n");
|
printf("FORK TEST -- PASSED --\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Any erroneous child or parent comes here */
|
/* Any erroneous child or parent comes here */
|
||||||
out_err:
|
out_err:
|
||||||
printf("FORK TEST -- FAILED --\n");
|
printf("FORK TEST -- FAILED --\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ void ipc_full_test(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
printf("FULL IPC TEST: -- PASSED --\n");
|
printf("FULL IPC TEST: -- PASSED --\n");
|
||||||
else
|
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 */
|
/* Fork the current task */
|
||||||
if ((child = fork()) < 0) {
|
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;
|
goto out_err;
|
||||||
}
|
}
|
||||||
if (child)
|
if (child)
|
||||||
printf("%d: Created child with pid %d\n", getpid(), child);
|
test_printf("%d: Created child with pid %d\n", getpid(), child);
|
||||||
else
|
else
|
||||||
printf("Child %d running.\n", getpid());
|
test_printf("Child %d running.\n", getpid());
|
||||||
|
|
||||||
/* This test makes this assumption */
|
/* This test makes this assumption */
|
||||||
BUG_ON(L4_IPC_EXTENDED_MAX_SIZE > PAGE_SIZE);
|
BUG_ON(L4_IPC_EXTENDED_MAX_SIZE > PAGE_SIZE);
|
||||||
@@ -81,7 +81,7 @@ void ipc_extended_test(void)
|
|||||||
__FUNCTION__, (int)base);
|
__FUNCTION__, (int)base);
|
||||||
goto out_err;
|
goto out_err;
|
||||||
} else
|
} 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
|
* Both tasks read/write both pages
|
||||||
@@ -100,7 +100,7 @@ void ipc_extended_test(void)
|
|||||||
ipcbuf[L4_IPC_EXTENDED_MAX_SIZE - 1] = '\0';
|
ipcbuf[L4_IPC_EXTENDED_MAX_SIZE - 1] = '\0';
|
||||||
|
|
||||||
/* Send message to parent */
|
/* 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,
|
if ((err = l4_send_extended(parent, L4_IPC_TAG_SYNC_EXTENDED,
|
||||||
L4_IPC_EXTENDED_MAX_SIZE,
|
L4_IPC_EXTENDED_MAX_SIZE,
|
||||||
ipcbuf)) < 0) {
|
ipcbuf)) < 0) {
|
||||||
@@ -116,7 +116,7 @@ void ipc_extended_test(void)
|
|||||||
* This should prove that page faults are handled during
|
* This should prove that page faults are handled during
|
||||||
* the ipc.
|
* 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,
|
if ((err = l4_receive_extended(child, L4_IPC_EXTENDED_MAX_SIZE,
|
||||||
ipcbuf)) < 0) {
|
ipcbuf)) < 0) {
|
||||||
printf("Extended ipc error: %d\n", err);
|
printf("Extended ipc error: %d\n", err);
|
||||||
@@ -124,7 +124,7 @@ void ipc_extended_test(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* We now print the message created by child. */
|
/* 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);
|
getpid(), ipcbuf);
|
||||||
|
|
||||||
/* Check that string received from child is an exact match */
|
/* 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')
|
if (ipcbuf[L4_IPC_EXTENDED_MAX_SIZE - 1] != '\0')
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
|
||||||
printf("EXTENDED IPC TEST: -- PASSED --\n");
|
printf("EXTENDED IPC TEST: -- PASSED --\n");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
out_err:
|
out_err:
|
||||||
printf("EXTENDED IPC TEST: -- FAILED --\n");
|
printf("EXTENDED IPC TEST: -- FAILED --\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -46,11 +46,11 @@ int mmaptest(void)
|
|||||||
*(unsigned int *)(base + PAGE_SIZE*3) = 0x1000;
|
*(unsigned int *)(base + PAGE_SIZE*3) = 0x1000;
|
||||||
*(unsigned int *)(base + PAGE_SIZE*1) = 0x1000;
|
*(unsigned int *)(base + PAGE_SIZE*1) = 0x1000;
|
||||||
|
|
||||||
printf("MMAP TEST -- PASSED --\n");
|
printf("MMAP TEST -- PASSED --\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_err:
|
out_err:
|
||||||
printf("MMAP TEST -- FAILED --\n");
|
printf("MMAP TEST -- FAILED --\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,12 +60,12 @@ int shmtest(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (getpid() == parent_of_all)
|
if (getpid() == parent_of_all)
|
||||||
printf("SHM TEST -- PASSED --\n");
|
printf("SHM TEST -- PASSED --\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_err:
|
out_err:
|
||||||
printf("SHM TEST -- FAILED --\n");
|
printf("SHM TEST -- FAILED --\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ void main(void)
|
|||||||
{
|
{
|
||||||
wait_pager(0);
|
wait_pager(0);
|
||||||
if (getpid() == 2) {
|
if (getpid() == 2) {
|
||||||
printf("EXECVE TEST -- PASSED --\n", getpid());
|
printf("EXECVE TEST -- PASSED --\n", getpid());
|
||||||
printf("\n(Thread %d): Continues to sync with the pager...\n", getpid());
|
printf("\nThread (%d): Continues to sync with the pager...\n\n", getpid());
|
||||||
while (1)
|
while (1)
|
||||||
wait_pager(0);
|
wait_pager(0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user