Mercurial > flash_v2
comparison host/tools/ecostest/common/eCosTest.h @ 82:6736c52df507 ecos-sw-2000-04-14
Merge from eCos master repository on 2000-04-14-13:35:46-BST
| author | jlarmour |
|---|---|
| date | Tue, 18 Apr 2000 21:51:55 +0000 |
| parents | 435cced73e2f |
| children |
comparison
equal
deleted
inserted
replaced
| 81:89fef2181d7d | 82:6736c52df507 |
|---|---|
| 40 // | 40 // |
| 41 //####DESCRIPTIONEND#### | 41 //####DESCRIPTIONEND#### |
| 42 | 42 |
| 43 #ifndef _ECOSTEST_H | 43 #ifndef _ECOSTEST_H |
| 44 #define _ECOSTEST_H | 44 #define _ECOSTEST_H |
| 45 // eCos testing infrastructure | 45 |
| 46 //================================================================= | |
| 46 // This class represents a single eCos test [executable]. | 47 // This class represents a single eCos test [executable]. |
| 47 // It includes member functions to run the test and to manage | 48 // It includes member functions to run the test and to manage related system resources. |
| 48 // related system resources. | 49 //================================================================= |
| 49 | 50 |
| 51 #include "Collections.h" | |
| 50 #include "eCosStd.h" | 52 #include "eCosStd.h" |
| 53 #include "eCosTestPlatform.h" | |
| 51 #include "eCosTestUtils.h" | 54 #include "eCosTestUtils.h" |
| 52 #include "eCosThreadUtils.h" | |
| 53 #include "Properties.h" | |
| 54 #include "ResetAttributes.h" | 55 #include "ResetAttributes.h" |
| 55 #include <vector> | 56 |
| 56 | 57 class CSubprocess; |
| 57 class CTestResource; | 58 class CTestResource; |
| 58 class CeCosTestSocket; | 59 class CeCosSocket; |
| 60 | |
| 59 class CeCosTest{ | 61 class CeCosTest{ |
| 60 public: | 62 public: |
| 61 | 63 |
| 62 static bool Init(); | |
| 63 static void Term(); | |
| 64 | |
| 65 static bool SaveTargetInfo(); | |
| 66 class TargetInfo { | |
| 67 public: | |
| 68 // Update arHwTypeImage if you add to this enum | |
| 69 enum HwType {INVALID=-1, HARDWARE=0, SIM=1, SYNTHETIC=2, HARDWARE_NO_BP=3, REMOTE_SIM=4 | |
| 70 }; | |
| 71 protected: | |
| 72 String pszImage; | |
| 73 String pszPrefix; | |
| 74 HwType nType; | |
| 75 String pszGdbcmd; | |
| 76 public: | |
| 77 static LPCTSTR arHwTypeImage[]; | |
| 78 static HwType FromStr (LPCTSTR psz); | |
| 79 bool IsValid() const { return nType!=INVALID; } | |
| 80 LPCTSTR Image() const { return pszImage.c_str(); } | |
| 81 LPCTSTR Prefix() const { return pszPrefix.c_str(); } | |
| 82 LPCTSTR GdbCmd() const { return pszGdbcmd.c_str(); } | |
| 83 HwType Type() const { return nType; } | |
| 84 TargetInfo(); | |
| 85 TargetInfo(LPCTSTR pszIm,LPCTSTR pszPre,LPCTSTR pszHwtype,LPCTSTR pszGdb=0); | |
| 86 TargetInfo(LPCTSTR pszIm,LPCTSTR pszPre,int nHwtype,LPCTSTR pszGdb=0); // FIXME: phase this out as soon as we can | |
| 87 }; | |
| 88 | |
| 89 static int AddPlatform (const TargetInfo &t); | |
| 90 static int InitTargetInfoReg (LPCTSTR szRegKey); | |
| 91 static bool SaveTargetInfoReg (LPCTSTR szRegKey); | |
| 92 static LPCTSTR pszFormat; | 64 static LPCTSTR pszFormat; |
| 93 | 65 |
| 94 /////////////////////////////////////////////////////////////////////////// | 66 /////////////////////////////////////////////////////////////////////////// |
| 95 // Representation of an elapsed time (units of milliseconds) | 67 // Representation of an elapsed time (units of milliseconds) |
| 96 enum {NOTIMEOUT=0}; // No timeout specified | 68 enum {NOTIMEOUT=0x7fffffff}; // No timeout specified |
| 97 | 69 |
| 98 /////////////////////////////////////////////////////////////////////////// | 70 /////////////////////////////////////////////////////////////////////////// |
| 99 // ctors, dtors and their friends | 71 // ctors, dtors and their friends |
| 100 class ExecutionParameters; | 72 class ExecutionParameters; |
| 101 CeCosTest(const ExecutionParameters &e, LPCTSTR const pszExecutable, LPCTSTR const pszTitle=0); | 73 CeCosTest(const ExecutionParameters &e, LPCTSTR const pszExecutable, LPCTSTR const pszTitle=0); |
| 109 // Tap them on the shoulder (does not wait) | 81 // Tap them on the shoulder (does not wait) |
| 110 static void CancelAllInstances (); | 82 static void CancelAllInstances (); |
| 111 /////////////////////////////////////////////////////////////////////////// | 83 /////////////////////////////////////////////////////////////////////////// |
| 112 | 84 |
| 113 /////////////////////////////////////////////////////////////////////////// | 85 /////////////////////////////////////////////////////////////////////////// |
| 114 // Representation of target: | |
| 115 static unsigned int TargetTypeMax() { return (unsigned)arTargetInfo.size(); } | |
| 116 static LPCTSTR const Image(unsigned int i) { return arTargetInfo[i].Image(); } | |
| 117 static const TargetInfo &Target(unsigned int i) { return arTargetInfo[i]; } | |
| 118 static const TargetInfo &Target(LPCTSTR t); | |
| 119 static void RemoveAllPlatforms(); | |
| 120 /////////////////////////////////////////////////////////////////////////// | |
| 121 | |
| 122 /////////////////////////////////////////////////////////////////////////// | |
| 123 // Class used to represent execution parameters (to be passed with request to execute a test) | 86 // Class used to represent execution parameters (to be passed with request to execute a test) |
| 124 /////////////////////////////////////////////////////////////////////////// | 87 /////////////////////////////////////////////////////////////////////////// |
| 125 class ExecutionParameters { | 88 class ExecutionParameters { |
| 126 public: | 89 public: |
| 127 | 90 |
| 128 enum RequestType { RUN, QUERY, LOCK, UNLOCK, STOP, RequestTypeMax}; | 91 enum RequestType { RUN, QUERY, LOCK, UNLOCK, STOP, RequestTypeMax}; |
| 129 static RequestType RequestTypeValue(LPCTSTR ); | 92 static RequestType RequestTypeValue(LPCTSTR ); |
| 130 static LPCTSTR Image (RequestType r) { return arRequestImage[r]; } | 93 static const String Image(RequestType r) { return (r>=0 && r<=RequestTypeMax)?String(arRequestImage[r]):String::SFormat(_T("Unknown(%d)"),r); } |
| 131 | 94 |
| 132 Duration ActiveTimeout() const { return m_nActiveTimeout; } | 95 Duration ActiveTimeout() const { return m_nActiveTimeout; } |
| 133 Duration DownloadTimeout() const { return m_nDownloadTimeout; } | 96 Duration DownloadTimeout() const { return m_nDownloadTimeout; } |
| 134 | 97 |
| 135 LPCTSTR Target() const { return m_Target.c_str(); } | 98 const CeCosTestPlatform *Platform() const { return CeCosTestPlatform::Get(m_Target); } |
| 136 bool IsValid() const { return m_Request!=RUN || CeCosTest::IsValid(m_Target); } | 99 LPCTSTR PlatformName() const { return Platform()?Platform()->Name():_T("UNKNOWN"); } |
| 100 | |
| 137 RequestType Request() const { return m_Request;} | 101 RequestType Request() const { return m_Request;} |
| 138 void SetActiveTimeout (Duration t){m_nActiveTimeout=t;} | 102 void SetActiveTimeout (Duration t){m_nActiveTimeout=t;} |
| 139 void SetDownloadTimeout (Duration t){m_nDownloadTimeout=t;} | 103 void SetDownloadTimeout (Duration t){m_nDownloadTimeout=t;} |
| 140 | 104 |
| 141 ExecutionParameters ( | 105 ExecutionParameters ( |
| 142 RequestType r=CeCosTest::ExecutionParameters::RUN, | 106 RequestType r=CeCosTest::ExecutionParameters::RUN, |
| 143 LPCTSTR Target=_T(""), | 107 LPCTSTR Target=_T(""), |
| 144 Duration nActiveTimeout=NOTIMEOUT, | 108 Duration nActiveTimeout=NOTIMEOUT, |
| 145 Duration nDownloadTimeout=NOTIMEOUT); | 109 Duration nDownloadTimeout=NOTIMEOUT); |
| 151 protected: | 115 protected: |
| 152 static LPCTSTR arRequestImage [1+RequestTypeMax]; | 116 static LPCTSTR arRequestImage [1+RequestTypeMax]; |
| 153 String m_Target; | 117 String m_Target; |
| 154 Duration m_nActiveTimeout,m_nDownloadTimeout; | 118 Duration m_nActiveTimeout,m_nDownloadTimeout; |
| 155 RequestType m_Request; | 119 RequestType m_Request; |
| 156 int m_nUnused1; | 120 int m_nUnused1; |
| 157 int m_nUnused2; | 121 int m_nUnused2; |
| 158 int m_nUnused3; | 122 int m_nUnused3; |
| 159 bool m_bUnused2; | 123 bool m_bUnused2; |
| 160 bool m_bUnused3; | 124 bool m_bUnused3; |
| 161 }; | 125 }; |
| 162 /////////////////////////////////////////////////////////////////////////// | 126 /////////////////////////////////////////////////////////////////////////// |
| 163 | 127 |
| 166 // Order is important - SetStatus can only change status in left-to-right direction | 130 // Order is important - SetStatus can only change status in left-to-right direction |
| 167 void AnalyzeOutput(); | 131 void AnalyzeOutput(); |
| 168 enum StatusType {NotStarted, NoResult, Inapplicable, Pass, DownloadTimeOut, TimeOut, Cancelled, Fail, | 132 enum StatusType {NotStarted, NoResult, Inapplicable, Pass, DownloadTimeOut, TimeOut, Cancelled, Fail, |
| 169 AssertFail, StatusTypeMax}; | 133 AssertFail, StatusTypeMax}; |
| 170 static StatusType StatusTypeValue (LPCTSTR const pszStr); | 134 static StatusType StatusTypeValue (LPCTSTR const pszStr); |
| 171 static LPCTSTR const Image(StatusType s) { return arResultImage[MIN(s,StatusTypeMax)]; } | 135 static const String Image(StatusType s) { return (s>=0 && s<StatusTypeMax)?String(arResultImage[s]):String::SFormat(_T("Unknown(%d)"),s); } |
| 172 /////////////////////////////////////////////////////////////////////////// | 136 /////////////////////////////////////////////////////////////////////////// |
| 173 | 137 |
| 174 /////////////////////////////////////////////////////////////////////////// | 138 /////////////////////////////////////////////////////////////////////////// |
| 175 // Attributes | 139 // Attributes |
| 176 LPCTSTR const Executable() const { return m_strExecutable;} // Executable name | 140 LPCTSTR const Executable() const { return m_strExecutable;} // Executable name |
| 177 const LPCTSTR Target() const { return m_ep.Target();} // Target | 141 |
| 178 static bool IsSim(LPCTSTR t) { | 142 StatusType Status() const { return m_Status; } // Test status |
| 179 return TargetInfo::SIM==Target(t).Type() || | 143 |
| 180 TargetInfo::REMOTE_SIM==Target(t).Type() || | 144 Duration Download() const { return m_nDownloadTime; } // Download time |
| 181 TargetInfo::SYNTHETIC==Target(t).Type(); } | 145 Duration Total() const { return m_nTotalTime; } // Total |
| 182 | 146 Duration MaxInactive() const { return m_nMaxInactiveTime; } // Max. inactive |
| 183 static bool ServerSideGdb(LPCTSTR t) { return TargetInfo::SIM==Target(t).Type() || TargetInfo::SYNTHETIC==Target(t).Type(); } | 147 |
| 184 bool ServerSideGdb() const { return TargetInfo::SIM==Target(Target()).Type() || TargetInfo::SYNTHETIC==Target(Target()).Type(); } | 148 LPCTSTR const Output() const { return m_strOutput; } // Output generated by a test run [for report purposes] |
| 185 LPCTSTR const Title() const; // Title | 149 //const CTestResource * const Port() const { return m_pResource; } // Resource used for a test run [for report purposes] |
| 186 | 150 |
| 187 Duration ActiveTimeout() const { return m_ep.ActiveTimeout(); } // Active timeout | 151 const String ResultString (bool bIncludeOutput=true) const; |
| 188 Duration DownloadTimeout() const { return m_ep.DownloadTimeout(); } // Total timeout | |
| 189 | |
| 190 StatusType Status() const { return m_Status; } // Test status | |
| 191 | |
| 192 Duration Download() const { return m_nDownloadTime; } // Download time | |
| 193 Duration Total() const { return m_nTotalTime; } // Total | |
| 194 Duration MaxInactive() const { return m_nMaxInactiveTime; } // Max. inactive | |
| 195 | |
| 196 LPCTSTR const Output() const { return m_strOutput; } // Output generated by a test run [for report purposes] | |
| 197 const CTestResource * const Port() const { return m_pPort; } // Port used for a test run [for report purposes] | |
| 198 | |
| 199 LPCTSTR const ResultString (bool bIncludeOutput=true) const; | |
| 200 /////////////////////////////////////////////////////////////////////////// | 152 /////////////////////////////////////////////////////////////////////////// |
| 201 | 153 |
| 202 /////////////////////////////////////////////////////////////////////////// | 154 /////////////////////////////////////////////////////////////////////////// |
| 203 // Running a test: | 155 // Running a test: |
| 204 | 156 |
| 207 | 159 |
| 208 // Run a test remotely: | 160 // Run a test remotely: |
| 209 // If pszRemoteHostPort is given, it sends the test for execution on the given host:post. | 161 // If pszRemoteHostPort is given, it sends the test for execution on the given host:post. |
| 210 // Otherwise, a suitable host:port is determined from the test resource information. | 162 // Otherwise, a suitable host:port is determined from the test resource information. |
| 211 bool RunRemote (LPCTSTR const pszRemoteHostPort); | 163 bool RunRemote (LPCTSTR const pszRemoteHostPort); |
| 212 void Cancel (); // Stop the run | |
| 213 /////////////////////////////////////////////////////////////////////////// | 164 /////////////////////////////////////////////////////////////////////////// |
| 214 | 165 |
| 215 /////////////////////////////////////////////////////////////////////////// | 166 /////////////////////////////////////////////////////////////////////////// |
| 216 // Resource functions | 167 // Resource functions |
| 217 | |
| 218 static bool SetLogFile (LPCTSTR pszFile); // Define the log file | |
| 219 | 168 |
| 220 // Run as a server on given TCP/IP port | 169 // Run as a server on given TCP/IP port |
| 221 static bool RunAgent(int nTcpPort); | 170 static bool RunAgent(int nTcpPort); |
| 222 | 171 |
| 223 unsigned int RunCount() const { return m_nRunCount; } | 172 bool InteractiveInferior(LPCTSTR pszHostPort,TCHAR **argv); |
| 224 | 173 void SetTimeouts (Duration dActive=NOTIMEOUT,Duration dDownload=NOTIMEOUT/*,Duration dElapsed=15*60*1000*/); |
| 225 static bool IsValid (LPCTSTR pszTarget) { return Target(pszTarget).IsValid(); } | |
| 226 | |
| 227 static int InitTargetInfo(LPCTSTR pszFilename); | |
| 228 static bool SaveTargetInfo(LPCTSTR pszFilename); | |
| 229 | |
| 230 bool InteractiveGdb(const String &strHost,int nPort,TCHAR **argv); | |
| 231 void SetTimeouts (Duration dActive,Duration dElapsed); | |
| 232 void SetExecutable (LPCTSTR pszExecutable); | 174 void SetExecutable (LPCTSTR pszExecutable); |
| 233 static bool Value ( | 175 static bool Value ( |
| 234 LPCTSTR pszStr, | 176 LPCTSTR pszStr, |
| 235 struct tm &t, | 177 struct tm &t, |
| 236 StatusType &status, | 178 StatusType &status, |
| 244 Duration &nDownloadTime, | 186 Duration &nDownloadTime, |
| 245 Duration &nDownloadTimeout, | 187 Duration &nDownloadTimeout, |
| 246 Duration &nActiveTimeout, | 188 Duration &nActiveTimeout, |
| 247 int &nDownloadedSize); | 189 int &nDownloadedSize); |
| 248 | 190 |
| 249 Time GdbCpuTime(); | |
| 250 #ifndef _WIN32 | |
| 251 int ReadPipe (String &str,bool bBlock=false); // Read from gdb process | |
| 252 #endif | |
| 253 enum ServerStatus {SERVER_BUSY, SERVER_READY, SERVER_CANT_RUN, CONNECTION_FAILED, SERVER_LOCKED, ServerStatusMax}; | 191 enum ServerStatus {SERVER_BUSY, SERVER_READY, SERVER_CANT_RUN, CONNECTION_FAILED, SERVER_LOCKED, ServerStatusMax}; |
| 254 static LPCTSTR const Image(ServerStatus s) { return arServerStatusImage[MIN(s,ServerStatusMax)]; } | 192 static LPCTSTR const Image(ServerStatus s) { return arServerStatusImage[MIN(s,ServerStatusMax)]; } |
| 255 static ServerStatus ServerStatusValue(LPCTSTR psz); | 193 static ServerStatus ServerStatusValue(LPCTSTR psz); |
| 256 | 194 |
| 257 static ServerStatus CeCosTest::Connect (String strHost,int port, CeCosTestSocket *&pSock, const ExecutionParameters &e,String &strInfo,Duration dTimeout=10*1000); | 195 // Force the result to change. Generally you can only set the result left-to-right in the order of the enumeration literals |
| 258 | 196 void ForceResult(StatusType s) { m_Status=s; } |
| 259 // Delay for given count of milliseconds | 197 |
| 260 // Record test result in log file: | 198 // Get size information (generally by running *gdb-size) |
| 261 void LogResult(); | 199 bool GetSizes(); |
| 262 // Connect to m_strExecutionHostPort | 200 |
| 263 void ConnectForExecution (); | 201 // Connect to a test server |
| 264 | 202 static ServerStatus CeCosTest::Connect (LPCTSTR pszHostPort, CeCosSocket *&pSock, const ExecutionParameters &e,String &strInfo,Duration dTimeout=10*1000); |
| 203 | |
| 265 // Log some output. The accumulated output can be retrieved using Output() | 204 // Log some output. The accumulated output can be retrieved using Output() |
| 266 void Log (LPCTSTR const pszFormat,...); | 205 void Log (LPCTSTR const pszFormat,...); |
| 267 void LogString (LPCTSTR psz); | 206 void LogString (LPCTSTR psz); |
| 268 static bool GetSizes(LPCTSTR pszExecutable, LPCTSTR target,unsigned int &nFileSize, unsigned int &nStrippedSize); | 207 |
| 269 | |
| 270 protected: | 208 protected: |
| 271 static String GetGreatestSubkey (LPCTSTR pszKey); | 209 int m_nOutputLen; |
| 210 | |
| 211 void Cancel (); // Stop the run | |
| 212 | |
| 213 // Connect to m_strExecutionHostPort | |
| 214 void ConnectForExecution (); | |
| 215 | |
| 216 // Callback used when EXEC output is used to create host-side processes | |
| 217 static void CALLBACK AppendFunc(void *pParam,LPCTSTR psz) { ((CeCosTest*)pParam)->Log(_T("%%%% %s"),psz);} | |
| 218 | |
| 219 void GetInferiorCommands (StringArray &arstrInferiorCmds); | |
| 220 CSubprocess *m_pspPipe; | |
| 221 PtrArray m_arpExecsp; | |
| 222 | |
| 223 // Extract a directive (such as "EXEC:") from the test output. The index passed keeps track of the last such | |
| 224 // directive extracted such that successive calls march through the output, returning a different one each time. | |
| 225 bool GetDirective (LPCTSTR pszDirective, String &str,int &nIndex); | |
| 226 | |
| 227 // Keep track of directives in the gdb output | |
| 228 int m_nLastGdbInst; // GDB | |
| 229 int m_nLastExecInst; // EXEC | |
| 230 int m_nLastTimeoutInst; // TIMEOUT | |
| 231 int m_nLastPipeInst; // PIPE | |
| 232 | |
| 233 // Commands to be sent to gdb, or other inferior process | |
| 234 StringArray m_arstrInferiorCmds; | |
| 235 // Last command sent | |
| 236 unsigned int m_nCmdIndex; | |
| 237 | |
| 238 // Inferior process output comes through here | |
| 239 static void CALLBACK SInferiorOutputFunc(void *pParam,LPCTSTR psz) { ((CeCosTest *)pParam)->InferiorOutputFunc(psz); } | |
| 240 void InferiorOutputFunc(LPCTSTR psz); | |
| 241 | |
| 242 // Has a timeout occurred? Returns false if so. | |
| 243 static bool CALLBACK SCheckForTimeout(void *pParam) { return ((CeCosTest *)pParam)->CheckForTimeout(); } | |
| 244 | |
| 245 // Read target ready indicator from server | |
| 272 bool GetTargetReady(String &strHostPort); | 246 bool GetTargetReady(String &strHostPort); |
| 273 | 247 |
| 274 unsigned int m_nRunCount; | 248 // This may be set to force the socket-to-serial connection to terminate |
| 275 void Interactive(LPCTSTR pszFormat, ...); | |
| 276 | |
| 277 bool m_bStopConnectSocketToSerial; | 249 bool m_bStopConnectSocketToSerial; |
| 278 | 250 |
| 251 // Convert a path to one understandable by Cygwin | |
| 279 static String CygPath (LPCTSTR pszPath); | 252 static String CygPath (LPCTSTR pszPath); |
| 280 CResetAttributes::ResetResult Reset(bool bSendStatus); | 253 |
| 281 void LogTimeStampedOutput(LPCTSTR psz); | 254 // Are we at a prompt? |
| 282 #ifndef _WIN32 | 255 bool AtPrompt(); |
| 283 bool Suck(LPCTSTR pszPrompt,Duration d=1000); | 256 |
| 284 #endif | 257 // To limit calls to ps, under UNIX. This prevents the acquisition of cpu time consuming the whole machine :-). |
| 285 bool AtPrompt(LPCTSTR pszPrompt); | 258 mutable Time m_tInferiorCpuTime; |
| 286 bool BreakpointsOperational() const { return TargetInfo::HARDWARE_NO_BP!=Target(Target()).Type(); } | 259 mutable Time m_tPrevSample; |
| 287 void * m_wPipeHandle; | 260 Time InferiorTime() const; |
| 288 void * m_rPipeHandle; | |
| 289 | |
| 290 // For Unix to limit calls to ps: | |
| 291 Time m_tGdbCpuTime; | |
| 292 Time m_tPrevSample; | |
| 293 | 261 |
| 294 unsigned int m_nStrippedSize; | 262 unsigned int m_nStrippedSize; |
| 295 void SendKeepAlives(bool &b); | 263 |
| 296 void WaitForRemoteCompletion(); | 264 // Path to use to execute subprocesses |
| 297 Time GdbTime(); | |
| 298 String m_strPath; | 265 String m_strPath; |
| 299 void GetPath(String &strPath); | 266 |
| 300 void SetPath(const String &strPath); | 267 // Size of executable |
| 301 | 268 unsigned int m_nFileSize; |
| 302 unsigned int m_nFileSize; // Size of executable | 269 |
| 303 | 270 // host:port we are connecting to |
| 304 String m_strExecutionHostPort; | 271 String m_strExecutionHostPort; |
| 305 | 272 |
| 306 /////////////////////////////////////////////////////////////////////////// | 273 /////////////////////////////////////////////////////////////////////////// |
| 307 // Stuff to manage running gdb as child subprocess | 274 // Stuff to manage running gdb (or some other inferior process) |
| 308 bool CheckForTimeout(); // Check for a timeout - set status and return false if it happens | 275 bool CheckForTimeout(); // Check for a timeout - set status and return false if it happens |
| 309 bool m_bDownloading; // Are we currently downloading executable? | 276 bool m_bDownloading; // Are we currently downloading executable? |
| 310 bool GdbProcessAlive (); // Is gdb still alive and kicking? | 277 bool InferiorProcessAlive (); // Is gdb still alive and kicking? |
| 311 Time m_tBase; // Base used for measurement of timeouts | 278 Time m_tBase; // Base used for measurement of timeouts |
| 312 Time m_tBase0; // Base used for measurement of timeouts | 279 Time m_tBase0; // Base used for measurement of timeouts |
| 313 Time m_tWallClock0; // When the test was actually started | 280 Time m_tWallClock0; // When the test was actually started |
| 314 void * m_pGdbProcesshandle; // Handle associated with gdb process | 281 |
| 315 #ifndef _WIN32 | |
| 316 bool WritePipe (const String &str); // Write to gdb process | |
| 317 void DriveGdb(LPCTSTR pszPrompt,const StringArray &arstrGdbCmds); // Run gdb | |
| 318 #endif | |
| 319 /////////////////////////////////////////////////////////////////////////// | 282 /////////////////////////////////////////////////////////////////////////// |
| 320 // Close the socket used by the current class instance | 283 // Close the socket used by the current class instance |
| 321 void CloseSocket (); | 284 void CloseSocket (); |
| 322 | 285 |
| 323 bool send(const void * const pData,unsigned int nLength,LPCTSTR const pszMsg=_T(""),Duration dTimeout=10*1000); | 286 bool send(const void * const pData,unsigned int nLength,LPCTSTR const pszMsg=_T(""),Duration dTimeout=10*1000); |
| 327 bool recvResult(Duration dTimeout=10*1000); | 290 bool recvResult(Duration dTimeout=10*1000); |
| 328 | 291 |
| 329 /////////////////////////////////////////////////////////////////////////// | 292 /////////////////////////////////////////////////////////////////////////// |
| 330 | 293 |
| 331 /////////////////////////////////////////////////////////////////////////// | 294 /////////////////////////////////////////////////////////////////////////// |
| 332 CeCosTestSocket *m_pSock; | 295 CeCosSocket *m_pSock; |
| 333 | |
| 334 mutable String m_strResultString; | |
| 335 | |
| 336 LPCTSTR ExecutableTail() const { return CeCosTestUtils::Tail(m_strExecutable); } | |
| 337 | 296 |
| 338 ExecutionParameters m_ep; | 297 ExecutionParameters m_ep; |
| 339 | 298 |
| 340 // Chaining to allow *AllInstances functions to work: | 299 // Chaining to allow *AllInstances functions to work: |
| 341 static CeCosTest * pFirstInstance; | 300 static CeCosTest * pFirstInstance; |
| 342 CeCosTest * m_pPrevInstance; | 301 CeCosTest * m_pPrevInstance; |
| 343 CeCosTest * m_pNextInstance; | 302 CeCosTest * m_pNextInstance; |
| 344 | 303 |
| 345 void RunGdb (LPCTSTR pszCmdline,LPCTSTR pszPrompt,const StringArray &arstrGdbCmds); | 304 void RunInferior (LPCTSTR pszCmdline); |
| 346 | 305 |
| 347 bool OutputContains(LPCTSTR psz) const { return 0!=_tcsstr(m_strOutput,psz); } | 306 bool OutputContains(LPCTSTR psz) const { return 0!=_tcsstr(m_strOutput,psz); } |
| 348 | 307 |
| 349 static void CALLBACK SAcceptThreadFunc (void *pParam) {((CeCosTest *)pParam)->AcceptThreadFunc(); } | 308 static void CALLBACK SAcceptThreadFunc (void *pParam) {((CeCosTest *)pParam)->AcceptThreadFunc(); } |
| 350 void AcceptThreadFunc(); | 309 void AcceptThreadFunc(); |
| 351 | 310 |
| 352 static void CALLBACK SConnectSocketToSerialThreadFunc(void *pParam) { ((CeCosTest *)pParam)->ConnectSocketToSerialThreadFunc(); } | 311 static void CALLBACK SConnectSocketToSerialThreadFunc(void *pParam) { ((CeCosTest *)pParam)->ConnectSocketToSerialThreadFunc(); } |
| 353 void ConnectSocketToSerialThreadFunc(); | 312 void ConnectSocketToSerialThreadFunc(); |
| 354 | |
| 355 // Stuff. | |
| 356 // Thread function used by RunLocal to execute a non-blocking test locally | |
| 357 void LocalThreadFunc (); | |
| 358 // Thread function used by RunRemote to execute a non-blocking test remotely | |
| 359 void RemoteThreadFunc (); | |
| 360 | 313 |
| 361 String m_strExecutable; | 314 String m_strExecutable; |
| 362 String m_strTitle; | 315 String m_strTitle; |
| 363 | 316 |
| 364 void SetStatus (StatusType status); | 317 void SetStatus (StatusType status); |
| 366 | 319 |
| 367 Duration m_nDownloadTime; | 320 Duration m_nDownloadTime; |
| 368 Duration m_nTotalTime; | 321 Duration m_nTotalTime; |
| 369 Duration m_nMaxInactiveTime; | 322 Duration m_nMaxInactiveTime; |
| 370 | 323 |
| 371 CTestResource * m_pPort; | 324 CTestResource *m_pResource; |
| 372 | 325 CSubprocess *m_psp; |
| 373 String m_strOutput; | 326 |
| 374 | 327 String m_strOutput; // the output of the test run goes here |
| 375 static std::vector<TargetInfo> arTargetInfo; | |
| 376 static const TargetInfo tDefault; | |
| 377 | 328 |
| 378 static LPCTSTR const arResultImage[1+StatusTypeMax]; | 329 static LPCTSTR const arResultImage[1+StatusTypeMax]; |
| 379 static LPCTSTR const arServerStatusImage[1+ServerStatusMax]; | 330 static LPCTSTR const arServerStatusImage[1+ServerStatusMax]; |
| 380 bool m_bConnectSocketToSerialThreadDone; | 331 bool m_bConnectSocketToSerialThreadDone; |
| 381 static void CALLBACK ResetLogFunc(void *pParam, LPCTSTR psz); | 332 static void CALLBACK ResetLogFunc(void *pParam, LPCTSTR psz); |
| 333 | |
| 334 // These are used by RunAgent and its friends for setting up the RDI connection | |
| 335 int m_nAuxPort; | |
| 336 int m_nAuxListenSock; | |
| 337 | |
| 338 | |
| 382 }; // class CeCosTest | 339 }; // class CeCosTest |
| 383 | 340 |
| 384 | 341 |
| 385 | 342 |
| 386 #endif | 343 #endif |
