⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ecostest.h

📁 ecos为实时嵌入式操作系统
💻 H
📖 第 1 页 / 共 2 页
字号:
public:    struct TargetInfo {        const char *pszImage;        const char *pszPrefix;        bool bSim;        const char *pszGdbcmd;    };    bool InteractiveGdb(const CeCosTestUtils::String &strHost,int nPort,char **argv);	void SetTimeouts (CeCosTestUtils::Duration dActive,CeCosTestUtils::Duration dElapsed);	void SetExecutable (const char *pszExecutable);	static bool Value (		const char *pszStr, 		struct tm &t,		bool &bSim,		StatusType &status,		TargetType &target,    	CeCosTestUtils::String &strExecutionHostPort,	    CeCosTestUtils::String &strExecutableTail,	    CeCosTestUtils::String &strTitle,		int &nFileSize,		CeCosTestUtils::Duration &nTotalTime,		CeCosTestUtils::Duration &nMaxInactiveTime,		CeCosTestUtils::Duration &nDownloadTime,		CeCosTestUtils::Duration &nElapsedTimeout,		CeCosTestUtils::Duration &nActiveTimeout,		int &nDownloadedSize);	void Trace (const char *pszFormat,...);    CeCosTestUtils::Time GdbCpuTime();    static int ReadPipe (void *Handle,CeCosTestUtils::String &str,bool bBlock=false);             // Read from gdb process    enum ServerStatus {SERVER_BUSY, SERVER_READY, SERVER_CANT_RUN, CONNECTION_FAILED, SERVER_LOCKED, ServerStatusMax};    static const char * const Image(ServerStatus s) { return arServerStatusImage[min(s,ServerStatusMax)]; }	static ServerStatus Connect (CeCosTestUtils::String strHost,int port,CeCosTestSocket *&sock, const ExecutionParameters &e,CeCosTestUtils::Duration dTimeout=10*1000);    // Delay for given count of milliseconds    // Record test result in log file:    void LogResult();    bool ConnectForExecution (CeCosTestUtils::String strHost,int port);        // Log some output.  The accumulated output can be retrieved using Output()    void Log (const char * const pszFormat,...);    void LogString (const char *psz);protected:    static CeCosTestUtils::String CygPath (const char *pszPath);

    static const char szGdbPrompt[];            // "(gdb) "    static const unsigned int  nGdbPromptLen;	// Length of the above (null not included)fo    void LogTimeStampedOutput(const char *psz);	bool Suck(CeCosTestUtils::Duration d=1000);	bool AtGdbPrompt();    bool BreakpointsOperational() const { return /*true;*/ Sim();    }        //||(MN10300!=Target() && SPARClite_sleb!=Target() && PowerPC!=Target()); }	void * m_wPipeHandle;	void * m_rPipeHandle;        // For Unix to limit calls to ps:    CeCosTestUtils::Time m_tGdbCpuTime;    CeCosTestUtils::Time m_tPrevSample;    bool m_bDriveGdbComplete;	int m_nStrippedSize;	void SendKeepAlives(bool &b);	void WaitForRemoteCompletion();	CeCosTestUtils::Time GdbTime();	CeCosTestUtils::String m_strPath;	void GetPath(CeCosTestUtils::String &strPath);	void SetPath(const CeCosTestUtils::String &strPath);    // Function executed by thread creation system call    static THREADFUNC SThreadFunc (void *pParam);        unsigned int m_nFileSize;                   // Size of executable    	CeCosTestUtils::String m_strExecutionHostPort;        ///////////////////////////////////////////////////////////////////////////    // Stuff to manage running gdb as child subprocess	bool CheckForTimeout();                     // Check for a timeout - set status and return false if it happens    enum {PRIORITYLATCH=10*1000};               // Decrease gdb process priority after it uses this much CPU    bool m_bDownloading;                        // Are we currently downloading executable?    void LowerGdbPriority ();                   // Lower priority of gdb process    bool GdbProcessAlive ();                    // Is gdb still alive and kicking?    CeCosTestUtils::Time m_tBase;                               // Base used for measurement of timeouts    CeCosTestUtils::Time m_tBase0;                              // Base used for measurement of timeouts    CeCosTestUtils::Time m_tWallClock0;                         // When the test was actually started    void * m_pGdbProcesshandle;                 // Handle associated with gdb process    bool WritePipe (void *Handle,const char * const pszBuf); // Write to gdb process    void DriveGdb(void *pParam);  // Run gdb    ///////////////////////////////////////////////////////////////////////////    ///////////////////////////////////////////////////////////////////////////    // Socket helpers	static void GetSimpleHostName(CeCosTestUtils::String &str);    // Close the socket used by the current class instance    void CloseSocket ();    bool send(const void * const pData,unsigned int nLength,const char * const pszMsg="",CeCosTestUtils::Duration dTimeout=10*1000);    bool recv(const void *pData,unsigned int nLength,const char * const pszMsg="",CeCosTestUtils::Duration dTimeout=10*1000);    bool sendResult(CeCosTestUtils::Duration dTimeout=10*1000);    bool recvResult(CeCosTestUtils::Duration dTimeout=10*1000);    // Used to prevent a cascade of socket error messages:    bool m_bSocketErrorOccurred;    ///////////////////////////////////////////////////////////////////////////    ///////////////////////////////////////////////////////////////////////////    struct ThreadInfo {        CeCosTest *pTest;        void (CeCosTest::*pFunc)(void *);        void *pParam;        Callback cb;        THREAD_ID hThread;    };    CeCosTestSocket *m_pSock;    // While a server is executing a test on behalf of a client, a sequence of messages defined by this struct is sent.    // When the test execution has completed a message containing "AliveByteZero" is sent.  Before this point,    // the AliveInfo messages must contain at least one non-zero byte.    struct AliveInfo {        bool            Downloading;    // test is downloading        StatusType      Status;         // current status        unsigned int    Number;         // for future use    };    static AliveInfo AliveInfoZero;    mutable CeCosTestUtils::String m_strResultString;    const char * ExecutableTail() const { return CeCosTestUtils::Tail(m_strExecutable); }    ExecutionParameters m_ep;    // Chaining to allow *AllInstances functions to work:    static CeCosTest * pFirstInstance;    CeCosTest * m_pPrevInstance;    CeCosTest * m_pNextInstance;    void RunGdb (const CeCosTestUtils::String &pszExec, const CeCosTestUtils::String *arpszCmds);    bool OutputContains(const char *psz) const { return 0!=strstr(m_strOutput,psz); }    // This structure exists to marshall/unmarshall the information transmitted from server to client on completion    // of a test.  It must contain all the information needed to form an idea of the result of the test (everything    // in ResultString)    //    // This has to be more sophisticated if we support cross-architectural (endianness) execution    //    // Do not convert to a class without changing memset in recvResult    struct Result {        ExecutionParameters::Data buf;        StatusType m_Status;        CeCosTestUtils::Duration  m_nDownloadTime;        CeCosTestUtils::Duration  m_nTotalTime;        CeCosTestUtils::Duration  m_nMaxInactiveTime;        int       m_nStrippedSize;        char       szOutput[1]; // sized as necessary    };    void AcceptThreadFunc (void *pParam);    void ConnectSocketToSerialThreadFunc(void *pParam);        THREAD_ID RunThread(void (CeCosTest::*pThreadFunc)(void *), void *pParam, const Callback &cb);        // Stuff.    // Thread function used by RunLocal to execute a non-blocking test locally    void LocalThreadFunc (void *pParam=0);    // Thread function used by RunRemote to execute a non-blocking test remotely    void RemoteThreadFunc (void *pParam=0);        CeCosTestUtils::String m_strExecutable;    CeCosTestUtils::String m_strTitle;    void SetStatus (StatusType status);    StatusType m_Status;    CeCosTestUtils::Duration  m_nDownloadTime;    CeCosTestUtils::Duration  m_nTotalTime;    CeCosTestUtils::Duration  m_nMaxInactiveTime;    CPort * m_pPort;    static CeCosTestUtils::String strLogFile;    CeCosTestUtils::String m_strOutput;    static const TargetInfo arTargetInfo[1+CeCosTest::TargetTypeMax];    static const char * const arResultImage[1+StatusTypeMax];    static const char * const arServerStatusImage[1+ServerStatusMax];    bool m_bConnectSocketToSerialThreadDone;}; // class CeCosTest        #endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -