sl@0: /* sl@0: * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * A small support DLL for STDLIB test programs sl@0: * sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: #ifdef __cplusplus sl@0: extern "C" { sl@0: #endif sl@0: #include <_ansi.h> sl@0: sl@0: /* STDLIB equivalent of RTest sl@0: */ sl@0: sl@0: struct __testdata { sl@0: int iCheck; sl@0: int iSubtest; sl@0: int iErrno; sl@0: }; sl@0: sl@0: extern struct __testdata __td; sl@0: sl@0: IMPORT_C void td_Title(struct __testdata* td, char *title); sl@0: IMPORT_C void td_Next(struct __testdata* td, char *testname); sl@0: IMPORT_C void td_Test(struct __testdata* td, int line, int mustBeTrue); sl@0: IMPORT_C void td_TestErrno(struct __testdata* td, int line, int mustBeTrue, int expectedErrno); sl@0: IMPORT_C void td_Close(void); sl@0: sl@0: #define test_Data struct __testdata __td /* declares global variable __td */ sl@0: sl@0: #define test_Title(title) td_Title(&__td, title) sl@0: #define test_Next(testname) td_Next(&__td, testname) sl@0: #define test_Close() td_Close() sl@0: #define test_Test(line,cond) td_Test(&__td, line, cond) sl@0: #define test_TestErrno(line,cond,expected) td_TestErrno(&__td, line, cond, expected) sl@0: sl@0: #define test_Start(x) test_Next(x) sl@0: #define test(f) test_Test(__LINE__, (f)?1:0) sl@0: #define test_ok(f) test_TestErrno(__LINE__, (f)?1:0, errno) sl@0: #define test_errno(f,expected) test_TestErrno(__LINE__, (f)?1:0, expected) sl@0: sl@0: sl@0: /* Routine to ensure that the Comms server is running sl@0: */ sl@0: IMPORT_C int CommInit(int enhanced); sl@0: sl@0: sl@0: /* C routine for starting the redirection server sl@0: */ sl@0: sl@0: IMPORT_C int start_redirection_server(void); sl@0: sl@0: sl@0: /* C routines for creating EPOC32 threads sl@0: */ sl@0: sl@0: IMPORT_C int start_posix_server(void); sl@0: sl@0: IMPORT_C void* create_thread(void (*aFn)(), char* aName); sl@0: IMPORT_C void start_thread(void* aThread); sl@0: IMPORT_C int wait_for_thread(void* aThread); sl@0: sl@0: IMPORT_C void* create_process(void (*aFn)(), char* aName, char* mode, int fids[3]); sl@0: IMPORT_C void start_process(void* aThread); sl@0: IMPORT_C int wait_for_process(void* aThread); sl@0: IMPORT_C int wait_for_process_id(void* aProcess, int procid, int opt, int* status); sl@0: IMPORT_C int get_proc_id(void* aProcess); sl@0: /* C-callable routines to access the EPOC32 asynchonous ioctl facilities sl@0: * sl@0: * NB. The int* status parameter stands in for the usual TRequestStatus& sl@0: */ sl@0: IMPORT_C int async_ioctl(int aFid, int aCmd, void* aParam, int* status); sl@0: IMPORT_C int async_ioctl_completion(int aFid, int aCmd, void* aParam, int* status); sl@0: sl@0: #ifdef __cplusplus sl@0: } sl@0: #endif