1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/cstdlib/TSTLIB/tredir.C Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,88 @@
1.4 +/*
1.5 +* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +* TDIRS.C
1.19 +* Test code for directory and file handling
1.20 +*
1.21 +*
1.22 +*/
1.23 +
1.24 +
1.25 +
1.26 +#include <stdlib.h>
1.27 +#include <stdio.h>
1.28 +#include <string.h>
1.29 +#include <unistd.h>
1.30 +#include <sys/stat.h>
1.31 +#include <sys/fcntl.h>
1.32 +#include <dirent.h>
1.33 +#include <errno.h>
1.34 +
1.35 +#include "CTEST.H" /* includes C interface to EPOC32 threads, and SpawnPosixServer */
1.36 +
1.37 +test_Data;
1.38 +int close_console=0;
1.39 +
1.40 +/**
1.41 +@SYMTestCaseID SYSLIB-STDLIB-CT-1098
1.42 +@SYMTestCaseDesc Tests for redirection of server
1.43 +@SYMTestPriority High
1.44 +@SYMTestActions Tests for running of threads.Check for error codes
1.45 +@SYMTestExpectedResults Test must not fail
1.46 +@SYMREQ REQ0000
1.47 +*/
1.48 +void tests(void)
1.49 + {
1.50 + char bob[200];
1.51 + int x;
1.52 + printf("calling gets\n");
1.53 + gets (bob);
1.54 + printf("got %s\nnow for a getchar > ", bob);
1.55 + x = getchar();
1.56 + printf("got %d\n", x);
1.57 + scanf("%s", bob);
1.58 + printf("got %s\n", bob);
1.59 +
1.60 + if (close_console)
1.61 + {
1.62 + test_Close();
1.63 + close(0);
1.64 + close(1);
1.65 + close(2);
1.66 + }
1.67 +
1.68 +
1.69 + }
1.70 +
1.71 +
1.72 +int main()
1.73 + {
1.74 + void* client;
1.75 + int err;
1.76 +
1.77 + test_Title("Redirection Server");
1.78 +
1.79 + start_posix_server();
1.80 +
1.81 + close_console=1;
1.82 + client=create_thread(tests, "tests");
1.83 + test(client!=0);
1.84 + start_thread(client);
1.85 + err=wait_for_thread(client);
1.86 +
1.87 + test(err==0);
1.88 +
1.89 + test_Close();
1.90 + return 0;
1.91 + }