Changeset 973ef9fc in mainline for kernel/test/print/print5.c
- Timestamp:
- 2010-12-25T21:20:28Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 631ee0c
- Parents:
- 1bfd3d3 (diff), 09178b7f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
kernel/test/print/print5.c
r1bfd3d3 r973ef9fc 1 1 /* 2 * Copyright (c) 200 6 Ondrej Palkovsky2 * Copyright (c) 2005 Josef Cejka 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 #include <stdio.h> 30 #include <unistd.h> 31 #include <async.h> 32 #include <errno.h> 33 #include "../tester.h" 29 /* 30 * This test tests several features of the HelenOS 31 * printf() implementation which go beyond the POSIX 32 * specification and GNU printf() behaviour. 33 * 34 * Therefore we disable printf() argument checking by 35 * the GCC compiler in this source file to avoid false 36 * positives. 37 * 38 */ 39 #define NVERIFY_PRINTF 34 40 35 #define MAX_CONNECTIONS 50 41 #include <print.h> 42 #include <test.h> 36 43 37 static int connections[MAX_CONNECTIONS]; 38 39 static void client_connection(ipc_callid_t iid, ipc_call_t *icall) 44 const char *test_print5(void) 40 45 { 41 unsigned int i; 46 TPRINTF("Testing printf(\"%%s\", NULL):\n"); 47 TPRINTF("Expected output: \"(NULL)\"\n"); 48 TPRINTF("Real output: \"%s\"\n\n", (char *) NULL); 42 49 43 TPRINTF("Connected phone %#x accepting\n", icall->in_phone_hash); 44 ipc_answer_0(iid, EOK); 45 for (i = 0; i < MAX_CONNECTIONS; i++) { 46 if (!connections[i]) { 47 connections[i] = icall->in_phone_hash; 48 break; 49 } 50 } 51 52 while (true) { 53 ipc_call_t call; 54 ipc_callid_t callid = async_get_call(&call); 55 int retval; 56 57 switch (IPC_GET_METHOD(call)) { 58 case IPC_M_PHONE_HUNGUP: 59 TPRINTF("Phone %#x hung up\n", icall->in_phone_hash); 60 retval = 0; 61 break; 62 case IPC_TEST_METHOD: 63 TPRINTF("Received well known message from %#x: %#x\n", 64 icall->in_phone_hash, callid); 65 ipc_answer_0(callid, EOK); 66 break; 67 default: 68 TPRINTF("Received unknown message from %#x: %#x\n", 69 icall->in_phone_hash, callid); 70 ipc_answer_0(callid, ENOENT); 71 break; 72 } 73 } 74 } 75 76 const char *test_register(void) 77 { 78 async_set_client_connection(client_connection); 79 80 ipcarg_t phonead; 81 int res = ipc_connect_to_me(PHONE_NS, IPC_TEST_SERVICE, 0, 0, &phonead); 82 if (res != 0) 83 return "Failed registering IPC service"; 84 85 TPRINTF("Registered as service %u, accepting connections\n", IPC_TEST_SERVICE); 86 async_manager(); 50 TPRINTF("Testing printf(\"%%c %%3.2c %%-3.2c %%2.3c %%-2.3c\", 'a', 'b', 'c', 'd', 'e'):\n"); 51 TPRINTF("Expected output: [a] [ b] [c ] [ d] [e ]\n"); 52 TPRINTF("Real output: [%c] [%3.2c] [%-3.2c] [%2.3c] [%-2.3c]\n\n", 'a', 'b', 'c', 'd', 'e'); 87 53 88 54 return NULL;
Note:
See TracChangeset
for help on using the changeset viewer.