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