Changeset 973ef9fc in mainline for uspace/app/tester/print/print5.c


Ignore:
Timestamp:
2010-12-25T21:20:28Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
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.
Message:

Merge mainline changes.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/app/tester/print/print5.c

    r1bfd3d3 r973ef9fc  
    11/*
    2  * Copyright (c) 2006 Ondrej Palkovsky
     2 * Copyright (c) 2005 Josef Cejka
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
     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
     40
    2941#include <stdio.h>
    3042#include <unistd.h>
    31 #include <atomic.h>
    3243#include "../tester.h"
    3344
    34 static atomic_t finish;
    35 
    36 static void callback(void *priv, int retval, ipc_call_t *data)
     45const char *test_print5(void)
    3746{
    38         atomic_set(&finish, 1);
    39 }
    40 
    41 const char *test_connect(void)
    42 {
    43         TPRINTF("Connecting to %u...", IPC_TEST_SERVICE);
    44         int phone = ipc_connect_me_to(PHONE_NS, IPC_TEST_SERVICE, 0, 0);
    45         if (phone > 0) {
    46                 TPRINTF("phoneid %d\n", phone);
    47         } else {
    48                 TPRINTF("\n");
    49                 return "ipc_connect_me_to() failed";
    50         }
     47        TPRINTF("Testing printf(\"%%s\", NULL):\n");
     48        TPRINTF("Expected output: \"(NULL)\"\n");
     49        TPRINTF("Real output:     \"%s\"\n\n", (char *) NULL);
    5150       
    52         printf("Sending synchronous message...\n");
    53         int retval = ipc_call_sync_0_0(phone, IPC_TEST_METHOD);
    54         TPRINTF("Received response to synchronous message\n");
    55        
    56         TPRINTF("Sending asynchronous message...\n");
    57         atomic_set(&finish, 0);
    58         ipc_call_async_0(phone, IPC_TEST_METHOD, NULL, callback, 1);
    59         while (atomic_get(&finish) != 1)
    60                 TPRINTF(".");
    61         TPRINTF("Received response to asynchronous message\n");
    62        
    63         TPRINTF("Hanging up...");
    64         retval = ipc_hangup(phone);
    65         if (retval == 0) {
    66                 TPRINTF("OK\n");
    67         } else {
    68                 TPRINTF("\n");
    69                 return "ipc_hangup() failed";
    70         }
     51        TPRINTF("Testing printf(\"%%c %%3.2c %%-3.2c %%2.3c %%-2.3c\", 'a', 'b', 'c', 'd', 'e'):\n");
     52        TPRINTF("Expected output: [a] [  b] [c  ] [ d] [e ]\n");
     53        TPRINTF("Real output:     [%c] [%3.2c] [%-3.2c] [%2.3c] [%-2.3c]\n\n", 'a', 'b', 'c', 'd', 'e');
    7154       
    7255        return NULL;
Note: See TracChangeset for help on using the changeset viewer.