os/ossrv/genericopenlibs/cstdlib/TSTLIB/tredir.C
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:
    15 * TDIRS.C
    16 * Test code for directory and file handling
    17 * 
    18 *
    19 */
    20 
    21 
    22 
    23 #include <stdlib.h>
    24 #include <stdio.h>
    25 #include <string.h>
    26 #include <unistd.h>
    27 #include <sys/stat.h>
    28 #include <sys/fcntl.h>
    29 #include <dirent.h>
    30 #include <errno.h>
    31 
    32 #include "CTEST.H"	/* includes C interface to EPOC32 threads, and SpawnPosixServer */
    33 
    34 test_Data;
    35 int close_console=0;
    36 
    37 /**
    38 @SYMTestCaseID          SYSLIB-STDLIB-CT-1098
    39 @SYMTestCaseDesc	    Tests for redirection of server
    40 @SYMTestPriority 	    High
    41 @SYMTestActions  	    Tests for running of threads.Check for error codes
    42 @SYMTestExpectedResults Test must not fail
    43 @SYMREQ                 REQ0000
    44 */		
    45 void tests(void)
    46 	{
    47 	char bob[200];
    48 	int x;
    49 	printf("calling gets\n");
    50 	gets (bob);
    51 	printf("got %s\nnow for a getchar > ", bob);
    52 	x = getchar();
    53 	printf("got %d\n", x);
    54 	scanf("%s", bob);
    55 	printf("got %s\n", bob);
    56 
    57 	if (close_console)
    58 		{
    59 		test_Close();
    60 		close(0);
    61 		close(1);
    62 		close(2);
    63 		}
    64 
    65 
    66 	}
    67 
    68 
    69 int main()
    70 	{
    71 	void* client;
    72 	int err;
    73 
    74 	test_Title("Redirection Server");
    75 
    76 	start_posix_server();
    77 	
    78 	close_console=1;
    79 	client=create_thread(tests, "tests");
    80 	test(client!=0);
    81 	start_thread(client);
    82 	err=wait_for_thread(client);
    83 
    84 	test(err==0);
    85 
    86 	test_Close();
    87 	return 0;
    88 	}