os/ossrv/genericopenlibs/cstdlib/TSTLIB/TSTDLIBDEFECT.C
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2004-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 *
    16 */
    17 
    18 
    19 
    20 #include <stdlib.h>	/* definition of exit() */
    21 #include <stdio.h>
    22 #include <errno.h>
    23 #include <string.h>
    24 
    25 #include <unistd.h>	/* for getcwd */
    26 #include <sys/fcntl.h>	/* for O_RDONLY */
    27 #include <sys/types1.h>
    28 #include "CTEST.H"
    29 
    30 test_Data; /* needed for logging */
    31 
    32 int close_console=0;
    33 
    34 /**
    35 @SYMTestCaseID          SYSLIB-STDLIB-CT-1120
    36 @SYMTestCaseDesc	    Tests for defect number 050968
    37 @SYMTestPriority 	    High
    38 @SYMTestActions  	    Tests for stdlib defect
    39 @SYMTestExpectedResults Test must not fail
    40 @SYMREQ                 REQ0000
    41 */					
    42 void def050968()
    43 	{
    44 	unsigned char p = 0xFF;
    45 
    46 	test_Next("Check DEF050968");
    47 
    48 	test(p==0xFF);
    49 	FD_ZERO(&p);
    50 	test(p==0);
    51 	}
    52 
    53 void doTests()
    54 	{
    55 	def050968();
    56 
    57 	if (close_console)
    58 		{
    59 		test_Close();
    60 		close(0);
    61 		close(1);
    62 		close(2);
    63 		}
    64 	}
    65 
    66 int main()
    67 	{
    68 	void* client;
    69 	int err;
    70 
    71 	test_Title("TStdlibDefect");
    72 
    73 	doTests();
    74 
    75 	test_Next("Do it again using the CPosixServer (for them, not me)");
    76 	close_console=1;
    77 
    78 	start_posix_server();	/* calls SpawnPosixServer from C++ code */
    79 
    80 
    81 	client=create_thread(doTests, "TSTDLIBDEFECT tests");
    82 	test(client!=0);
    83 	start_thread(client);
    84 	err=wait_for_thread(client);
    85 	test(err==0);
    86 
    87 	test_Close();
    88 
    89 	return 0;
    90 	}
    91