Update contrib.
1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 //! @file f32test\concur\t_tdebug.h
18 #ifndef __T_TDEBUG_H__
19 #define __T_TDEBUG_H__
22 /// Data about a test task
24 RThread iThread; ///< thread class
25 TThreadId iId; ///< thread ID
26 TInt iNum; ///< thread number
27 TRequestStatus iStat; ///< current thread status
28 TFullName iFile; ///< file to be used for testing
29 TBuf<64> iName; ///< name of this thread
30 TBuf<256> iMess; ///< buffer for return messages
31 TAny* iData; ///< other data to be passed to the thread
34 const TInt KMaxThreads = 100;
37 /// Replacement for RTest, for use within a task (RTest doesn't work in multiple tasks).
38 /// Each of the output commands prints the task name first on the line.
39 /// Note that all of the functions and data members of this class are static, they are
40 /// shared among all threads using the class.
46 TPos(const char *aFile, TInt aLine);
48 const char* iFailFile;
55 static void Start(const TDesC& aStr);
56 static void End(const TDesC& aStr);
57 static void Next(const TDesC& aStr);
58 static void PrintLock();
59 static void PrintUnlock();
60 static void Printf(TRefByValue<const TDesC> aFmt, ...);
62 static void Fail(TPos aPos, TRefByValue<const TDesC> aFmt, ...);
63 static void Fail(TPos aPos, TInt aErr, TRefByValue<const TDesC> aFmt, ...);
65 static TDesC& ErrStr(TInt aErr, TDes& aDes);
67 static TInt Create(TInt aNum, TThreadFunction aFunction, const TDesC& aName);
68 static TInt Run(TBool aExitAny = EFalse, TInt aTimeout = 0);
69 static TInt RunOnly();
70 static void KillAll(TInt aReason);
72 static TThreadData& Self();
73 static TThreadData& Data(TInt aIndex);
75 static TInt ParseCommandArguments(TPtrC aArgV[], TInt aArgMax);
76 static TInt ParseCommandArguments(TPtrC aArgV[], TInt aArgMax, TInt& aDebFlags);
77 static TChar DefaultDriveChar();
82 static TThreadData iData[KMaxThreads];
83 static TThreadData iDummy;
84 static RMutex iDebugLock;
85 static RMutex iPrintLock;
87 static TFullName iWhere;
90 // Exit (panic) if the condition isn't met.
91 #define TEST(cond) if (!(cond)) { _LIT(err, #cond); TTest::Fail(HERE, _L("failed %S at line %d"), &err, __LINE__); }
92 #define HERE TTest::TPos(__FILE__, __LINE__)
94 // Define the TInt64 macros if they aren't already defined.
96 #define MAKE_TINT64(h,l) ( TInt64((h), (l)) )
97 #define MAKE_TUINT64(h,l) ( TInt64((h), (l)) )
98 #define I64HIGH(x) ( (x).High() )
99 #define I64LOW(x) ( (x).Low() )
100 #define I64INT(x) ( (x).GetTInt() )
101 #define I64REAL(x) ( (x).GetTReal() )