亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? ecostest.cpp

?? 基于ecos的redboot
?? CPP
?? 第 1 頁(yè) / 共 4 頁(yè)
字號(hào):
//####COPYRIGHTBEGIN####
//                                                                          
// ----------------------------------------------------------------------------
// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
//
// This program is part of the eCos host tools.
//
// This program is free software; you can redistribute it and/or modify it 
// under the terms of the GNU General Public License as published by the Free 
// Software Foundation; either version 2 of the License, or (at your option) 
// any later version.
// 
// This program is distributed in the hope that it will be useful, but WITHOUT 
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
// more details.
// 
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the Free Software Foundation, Inc., 
// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
// ----------------------------------------------------------------------------
//                                                                          
//####COPYRIGHTEND####
//=================================================================
//
//        eCosTest.cpp
//
//        Test class
//
//=================================================================
//=================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s):     sdf
// Contributors:  sdf
// Date:          1999-04-01
// Description:   This class abstracts a test for use in the testing infrastructure
// Usage:
//
//####DESCRIPTIONEND####
///////////////////////////////////////////////////////////////////////////////
#include "eCosStd.h"
#include "eCosTest.h"
#include "eCosTestPlatform.h"
#include "eCosTrace.h"
#include "TestResource.h"
#include "eCosTestUtils.h"
#include "eCosSocket.h"
#include "eCosSerial.h"
#include "eCosTestSerialFilter.h"
#include "eCosTestDownloadFilter.h"
#include "Properties.h"
#include "Subprocess.h"

#define WF(n) (n+50)/1000,((n+50)%1000)/100     // Present n as whole and fractional part.  Round to nearest least significant digit
#define WFS   _T("%u.%u")                           // The format string to output the above

LPCTSTR  const CeCosTest::arResultImage[1+CeCosTest::StatusTypeMax]=
{_T("NotStarted"), _T("NoResult"), _T("Inapplicable"), _T("Pass"), _T("DTimeout"), _T("Timeout"), _T("Cancelled"), _T("Fail"), _T("AssertFail"), _T("Unknown")};

CeCosTest *CeCosTest::pFirstInstance=0;
int CeCosTest::InstanceCount=0;

LPCTSTR  const CeCosTest::arServerStatusImage[1+CeCosTest::ServerStatusMax]={
  _T("Busy"), _T("Ready"), _T("Can't run"), _T("Connection failed"), _T("Locked"), _T("Bad server status")};
LPCTSTR  CeCosTest::ExecutionParameters::arRequestImage [1+ExecutionParameters::RequestTypeMax]={
  _T("Run"), _T("Query"), _T("Lock"), _T("Unlock"), _T("Stop"), _T("Bad request") };
  
static bool CALLBACK IsCancelled(void *pThis)
{
  return CeCosTest::Cancelled==((CeCosTest *)pThis)->Status();
}

// Ctors and dtors:
CeCosTest::CeCosTest(const ExecutionParameters &e, LPCTSTR pszExecutable,LPCTSTR pszTitle):
  m_pspPipe(0),
  m_nStrippedSize(0),
  m_nFileSize(0),
  m_bDownloading(false),
  m_pSock(0),
  m_ep(e),
  m_strTitle(pszTitle),
  m_Status(NotStarted),
  m_nDownloadTime(0),
  m_nTotalTime(0),
  m_nMaxInactiveTime(0),
  m_pResource(0),
  m_psp(0)
{
  
  assert(e.Platform());
  
  SetExecutable (pszExecutable);
  
  TRACE(_T("%%%% Create test instance %08x count:=%d\n"),this,InstanceCount+1);  

  // By recording the path now, we ensure processes are always run in the context in which the test instance
  // is created (important for the ConfigTool to be able to call PrepareEnvironment).

#ifdef _WIN32
  // for some reason _tgetenv() doesn't return the PATH set
  // by PrepareEnvironment() so use GetEnvironmentVariable() instead
  // JLD - 2000-06-09
  String strPath;
  int nSize=GetEnvironmentVariable(_T("PATH"), NULL, 0);
  GetEnvironmentVariable(_T("PATH"), strPath.GetBuffer(nSize), nSize);
  strPath.ReleaseBuffer();
  m_strPath=strPath;
#else
  LPCTSTR pszPath=_tgetenv(_T("PATH"));
  if(pszPath){
    m_strPath=pszPath;
  }
#endif
  
  ENTERCRITICAL;
  InstanceCount++;
  m_pNextInstance=pFirstInstance;
  if(m_pNextInstance){
    m_pNextInstance->m_pPrevInstance=this;
  } 
  m_pPrevInstance=0;
  pFirstInstance=this;
  LEAVECRITICAL;
  
}

CeCosTest::~CeCosTest()
{
  for(int i=0;i<(signed)m_arpExecsp.size();i++){
    delete (CSubprocess *)m_arpExecsp[i];
  }
  delete m_pspPipe;

  TRACE(_T("%%%% Delete test instance %08x\n"),this);
  Cancel();
  CloseSocket();
  if(m_pResource){
    m_pResource->Release();
    //delete m_pResource;
    //m_pResource=0;
  }
  
  VTRACE(_T("~CeCosTest(): EnterCritical and decrease instance count\n"));
  ENTERCRITICAL;
  InstanceCount--;
  TRACE(_T("%%%% Destroy instance.  Instance count:=%d\n"),InstanceCount);
  if(pFirstInstance==this){
    pFirstInstance=m_pNextInstance;
  }
  if(m_pPrevInstance){
    m_pPrevInstance->m_pNextInstance=m_pNextInstance;
  }
  if(m_pNextInstance){
    m_pNextInstance->m_pPrevInstance=m_pPrevInstance;
  }
  LEAVECRITICAL;
}

bool CeCosTest::RunRemote (LPCTSTR pszRemoteHostPort)
{
  bool rc=false;
  TRACE(_T("RunRemote\n"));
  m_strExecutionHostPort=pszRemoteHostPort;
  m_Status=NotStarted;
  
  VTRACE(_T("RemoteThreadFunc()\n"));
  
  // Find a server.
  ConnectForExecution();
  if(Cancelled!=Status()){       
    if(m_ep.Platform()->ServerSideGdb()){
      // The executable is transmitted to the server for execution.
      // Send file size
      if(m_pSock->sendInteger(m_nFileSize,_T("file size"))&&m_nFileSize>0){
        int nBufSize=MIN(10000,m_nFileSize);
        Buffer b(nBufSize);
        TRACE(_T("Sending [%d bytes]\n"), m_nFileSize);
        int nToSend=m_nFileSize;
        FILE *f1=_tfopen(m_strExecutable,_T("rb"));
        if(0==f1){
          Log(_T("Failed to open %s - %s\n"),(LPCTSTR)m_strExecutable,strerror(errno));
        } else {
          while (nToSend>0){
            int nRead=fread( b.Data(), 1, nBufSize, f1);
            if(nRead<=0){
              Log(_T("Failure reading %s - %s\n"),(LPCTSTR)m_strExecutable,strerror(errno));
              break;
            }
            if(!send( b.Data(), nRead, _T("executable"))){
              Log(_T("Failure sending %s - %s\n"),(LPCTSTR)m_strExecutable,(LPCTSTR)m_pSock->SocketErrString());
              break;
            }
            nToSend-=nRead;
          }
          fclose(f1);
          f1=0;
          if(nToSend>0){
            TRACE(_T("done [%d bytes sent]\n"),m_nFileSize-nToSend);
            Log(_T("Failed to transmit %s - %d/%d bytes sent\n"),(LPCTSTR)m_strExecutable,m_nFileSize-nToSend,m_nFileSize);
          } else {
            TRACE(_T("done\n"));
            rc=true;
          }
        }
        if(!recvResult(9*1000*60)){ // nine minutes
          Log(_T("Failed to receive result from remote server\n"));
          rc=false;
        }
        m_pSock->sendInteger(456); // send an ack [n'importe quoi]
        CloseSocket();
      }
    } else {
      // The server sets up a connection between port and tcp/ip socket, and gdb is run locally
      // Big timeout here because we have to wait for the target to be reset
      // We do this:
      // do {
      //     target ready indicator (0==fail, 1==ready, 2==fail and will retry)
      //     any output so far
      // } while (2==target ready indicator)
      // read host:port
      String strHostPort;
      if(GetTargetReady(strHostPort)){
        // Fix up a resource to represent permission to use the host:port we have been told about
        CTestResource resource;
        resource.SetTarget(m_ep.PlatformName());
        resource.SetDownload(strHostPort,0);
        m_pResource=&resource;
        RunLocal();
        m_pResource=0;
        m_pSock->sendInteger(Status(),_T("Terminating ack"));
        m_pSock->Close();
        rc=true;
      }
    }
  }
  TRACE(_T("RemoteThreadFunc - exiting\n"));
  return rc;
}

// Run the test locally
bool CeCosTest::RunLocal()
{
  bool rc=false;

  TRACE(_T("RunLocal %s\n"),(LPCTSTR)Executable());

  if(!CeCosTestUtils::IsFile(Executable())){
    Log(_T("Cannot run - %s is not a file\n"),(LPCTSTR)Executable());
  } else if(0==m_pResource && 0==CTestResource::Count(m_ep)){
    Log(_T("Cannot run a %s test\n"),(LPCTSTR)m_ep.PlatformName());
  } else {
    
    m_Status=NotStarted;

    TRACE(_T("LocalThreadFunc - target=%s\n"),(LPCTSTR)m_ep.PlatformName());
    // Acquire a port (our caller may have done this for us)
    VTRACE(_T("LocalThreadFunc():Trying to acquire a port\n"));
    if(0==m_pResource){
      for(;;){
        m_pResource=CTestResource::GetResource(m_ep);
        if(m_pResource||Cancelled==Status()){
          break;
        }
        CeCosThreadUtils::Sleep(2000);
        TRACE(_T("Waiting for a port\n"));
      }
    }
    VTRACE(_T("\nPort acquired!\n"));
    
    if(Cancelled!=Status()){
      // This means we have acquired a local port 
      bool bTargetReady=false;
      if(!m_pResource->HasReset()){
        bTargetReady=true;
      } else {
        bTargetReady=(CResetAttributes::RESET_OK==m_pResource->Reset(0,this));
      }
      // we may proceed to execute the test
      if(bTargetReady){
        SetStatus(NotStarted);

        if(NOTIMEOUT==m_ep.DownloadTimeout()){
          // No elapsed timeout given - calculate from knowledge of executable size and baud rate
          // 10 baud ~= 1 byte/sec, but we halve this to account for download in hex :-(
          // We use a minimum of 30 seconds and double the calculated result for safety
          // Note that the baud rate is generally unknown on the client side.
          int nBaud=m_pResource->Baud();
          if(0==nBaud){
            CTestResource *pExecutionResource=CTestResource::Lookup(m_strExecutionHostPort);
            if(pExecutionResource){
              nBaud=pExecutionResource->Baud();
            } 
          }
          if(0==nBaud){
            nBaud=38400;
          }

          int nBytesPerSec=(nBaud/10)/2; // division by 2 assumes download in "ascii" (2 bytes/char)
          m_ep.SetDownloadTimeout (1000*MAX(30,2*(m_nStrippedSize/nBytesPerSec)));
          TRACE(_T("Estimated download time %d sec (%d bytes @ %d bytes/sec [%d baud])\n"),m_nStrippedSize/nBytesPerSec,m_nStrippedSize,nBytesPerSec,nBaud);
        }

        TRACE(_T("Active timeout=%d download timeout=%d\n"),m_ep.ActiveTimeout(), m_ep.DownloadTimeout());

        GetInferiorCommands(m_arstrInferiorCmds);
        String strInferior(m_ep.Platform()->Inferior());
        strInferior.Replace(_T("%e"),CygPath(m_strExecutable),true);
        RunInferior(strInferior);
        rc=true;          
      }
    }
    if(m_pResource){
      m_pResource->Release();
      m_pResource=0;
    }
    TRACE(_T("RunLocal - exiting\n"));
  }

  return rc;
}

void CeCosTest::Cancel ()
{
  SetStatus(Cancelled);
}

CeCosTest::ServerStatus CeCosTest::Connect (LPCTSTR pszHostPort, CeCosSocket *&pSock, const ExecutionParameters &e,String &strInfo,Duration dTimeout)
{
  // Find out whether this host is receptive
  ServerStatus s=CONNECTION_FAILED;
  pSock=new CeCosSocket(pszHostPort,dTimeout);
  int nStatus;    
  if(pSock->Ok() &&
    pSock->sendString(e.Image(), _T("execution parameters")) &&
    pSock->recvInteger(nStatus,_T("ready status")) &&
    pSock->recvString(strInfo)){
    s=(ServerStatus)MIN(nStatus,ServerStatusMax);
  }
  if(SERVER_READY!=s || ExecutionParameters::RUN!=e.Request()){
    delete pSock;
    pSock=0;
  }
  return s;
}

// Initiate a connection to hostName:nPort and acquire the ready status [retry until this is achieved]
// The socket (m_pSock) is left open.
// This function is either called with m_strExecutionHostPort already set to a desired server
// or else m_strExecutionHostPort empty (in which case the server is / dynamically)

void CeCosTest::ConnectForExecution ()
{
  bool bSchedule=(0==m_strExecutionHostPort.size());
  Duration nDelay=2000;
  
  m_pSock=0;
  
  bool *arbHostTried=0;
  
  while(Cancelled!=Status()){
    StringArray arstrHostPort,arstrTries;
    int nChoices;
    
    if(bSchedule){
      if(!CTestResource::GetMatches(m_ep,arstrHostPort)){
        Log(_T("Could not establish matches\n"));
        continue;
      }
      nChoices=arstrHostPort.size();
      if(nChoices>0){
        TRACE(_T("ConnectForExecution: choices are:\n"));
        for(int i=0;i<nChoices;i++){
          TRACE(_T("\t%s\n"),(LPCTSTR)arstrHostPort[i]);
        }
      }
    } else {
      // Server has already been picked by caller
      nChoices=1;
      String str;
      arstrHostPort.push_back(m_strExecutionHostPort);
    }
    
    if(nChoices>0){
      delete [] arbHostTried;
      arbHostTried=new bool[nChoices];
      for(int i=0;i<nChoices;i++){
        arbHostTried[i]=false;
      }
      
      // Loop around the choices
      for(int nUntried=nChoices;nUntried>0;nUntried--) {
        // Select one we haven't tried already:
        int nChoice;        
        do {
          nChoice=rand() % nChoices;
        } while (arbHostTried[nChoice]);
        
        m_strExecutionHostPort=arstrHostPort[nChoice];
        
        TRACE(_T("ConnectForExecution: chosen %s\n"),(LPCTSTR)m_strExecutionHostPort);
        if(CeCosSocket::IsLegalHostPort(m_strExecutionHostPort)){
          // If we're using the resource server we had better check that the host
          // we are about to lock has not been resource-locked (the other match checks
          // will of course always succeed)
          String strInfo; 
          ServerStatus s=bSchedule && !CTestResource::Matches(m_strExecutionHostPort,m_ep)?SERVER_LOCKED:  
            Connect(m_strExecutionHostPort,m_pSock,m_ep,strInfo);
          arbHostTried[nChoice]=true;        
          TRACE(_T("Connect: %s says %s %s\n"),(LPCTSTR)m_strExecutionHostPort,(LPCTSTR)Image(s),(LPCTSTR)strInfo);
          CTestResource *pResource=CTestResource::Lookup(m_strExecutionHostPort);
          if(pResource){
            String str;
            str.Format(_T("%s %s %s"),(LPCTSTR)pResource->Image(),(LPCTSTR)strInfo,(LPCTSTR)Image(s));
            arstrTries.push_back(str);
          }
          if(SERVER_READY==s){
            // So that's ok then.  We're outta here.
            INTERACTIVE(_T("Connected to %s\n"),(LPCTSTR)m_strExecutionHostPort);
            goto Done;
          } else {
            delete m_pSock;
            m_pSock=0;
          }
        }
      } 
    }
    
    INTERACTIVE(_T("Warning - could not connect to any test servers:\n"));
    if(arstrTries.size()>0){
      for(unsigned int i=0;i<arstrTries.size();i++){
        INTERACTIVE(_T("    %s\n"),(LPCTSTR)arstrTries[i]);
      }
    } else {
      INTERACTIVE(_T("No servers available to execute %s test:\n"),(LPCTSTR)m_ep.PlatformName());
      ENTERCRITICAL;
      for(CTestResource *pResource=CTestResource::First();pResource;pResource=pResource->Next()){
        INTERACTIVE(_T("    %s\n"),(LPCTSTR)pResource->Image());
      }
      LEAVECRITICAL;
    }
    INTERACTIVE(_T("Retry in %d seconds...\n"),nDelay/1000);
    
    // We have tried all possibilities - sleep before retrying
    CeCosThreadUtils::Sleep(nDelay);
    
    if(Cancelled==m_Status){

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久精品免费免费| 成熟亚洲日本毛茸茸凸凹| 国产精品久久久久久久第一福利| 欧美一卡2卡三卡4卡5免费| www.视频一区| 91在线小视频| 欧美在线免费播放| 精品视频一区三区九区| 欧美午夜在线观看| 欧美日韩精品二区第二页| 色噜噜狠狠成人中文综合| 色综合天天综合网国产成人综合天| 国产经典欧美精品| 丁香五精品蜜臀久久久久99网站| 国产成人精品1024| 一区二区不卡在线视频 午夜欧美不卡在| 91精品国产高清一区二区三区蜜臀| 国产高清精品网站| 国产成人精品免费在线| 国产成人免费视频网站高清观看视频| 日韩电影在线一区| 激情偷乱视频一区二区三区| 国产suv精品一区二区6| 色婷婷av一区二区三区软件| 欧美日韩国产首页| 久久久综合激的五月天| 国产精品夫妻自拍| 日韩精品电影在线观看| 国产精品18久久久久久久久| 成年人国产精品| 欧美日韩国产中文| 久久久综合视频| 亚洲综合一区二区三区| 久久99国产精品久久| 成人18精品视频| 欧美福利视频导航| 国产免费久久精品| 亚洲成人自拍网| 国产一区二区久久| 91福利社在线观看| 精品国产乱码久久久久久闺蜜| 国产精品国产三级国产aⅴ入口| 亚洲国产综合色| 国产呦精品一区二区三区网站| 国产一区二区免费在线| 色综合久久99| 精品久久久久久无| 亚洲自拍偷拍九九九| 国产成a人无v码亚洲福利| 欧美三级欧美一级| 亚洲欧洲成人自拍| 狠狠狠色丁香婷婷综合激情| 色综合久久久久综合99| 国产欧美日韩视频在线观看| 日韩电影在线免费观看| 91久久一区二区| 欧美国产成人在线| 蜜臀99久久精品久久久久久软件| 成人h动漫精品一区二区| 日韩一区二区在线观看视频| 亚洲美女淫视频| jizz一区二区| 精品国产乱码久久久久久牛牛| 夜色激情一区二区| 国产·精品毛片| 久久久久久黄色| 九九**精品视频免费播放| 欧美在线视频日韩| 有坂深雪av一区二区精品| eeuss国产一区二区三区| 久久久精品综合| 国产一区二区三区蝌蚪| 精品国产髙清在线看国产毛片| 日本va欧美va精品| 欧美一卡二卡三卡| 久久99精品久久久久| 91精品在线观看入口| 免费成人你懂的| 精品三级在线看| 国产麻豆精品在线| 日本一区二区三区四区在线视频 | 欧美性受xxxx黑人xyx| 国产肉丝袜一区二区| 国产精品自在欧美一区| 欧美激情一区二区| 国产成人精品亚洲日本在线桃色| 亚洲精品一区在线观看| 成人影视亚洲图片在线| 国产精品福利一区二区三区| 一本色道久久加勒比精品| 亚洲黄色在线视频| 欧美人与性动xxxx| 美日韩一区二区| 欧美本精品男人aⅴ天堂| 国产一区二区伦理片| 国产精品久久久久久久久搜平片| 色狠狠桃花综合| 日韩av电影免费观看高清完整版| 日韩三级精品电影久久久| 欧美刺激午夜性久久久久久久| 亚洲高清久久久| 色久优优欧美色久优优| 亚洲精品欧美激情| 日韩一区二区在线观看| 国产乱子伦视频一区二区三区 | jizzjizzjizz欧美| 亚洲第一综合色| 精品电影一区二区三区| 99久久国产综合色|国产精品| 亚洲自拍偷拍av| 精品国产一二三区| 色婷婷久久久亚洲一区二区三区| 日韩精品一卡二卡三卡四卡无卡| 在线免费观看日本欧美| 日韩在线观看一区二区| 日韩视频在线你懂得| 国产高清亚洲一区| 亚洲成av人片在线观看无码| 久久久精品tv| 欧美日韩精品欧美日韩精品| 国产精品白丝jk黑袜喷水| 亚洲高清免费观看| 中文字幕一区二区三区蜜月| 欧美精品在线视频| 91丨porny丨蝌蚪视频| 日本特黄久久久高潮| 自拍偷拍亚洲激情| 久久先锋影音av鲁色资源网| 欧美三级视频在线| 成人av网站在线观看| 精一区二区三区| 亚洲精品综合在线| 国产日韩综合av| 日韩欧美激情四射| 欧美日韩国产小视频在线观看| 风间由美一区二区三区在线观看 | 成人污视频在线观看| 男男视频亚洲欧美| 亚洲一区在线观看免费| 一色桃子久久精品亚洲| 国产色产综合色产在线视频| 日韩欧美一级二级| 欧美精品久久99久久在免费线 | 亚洲私人黄色宅男| 亚洲天天做日日做天天谢日日欢| 在线观看网站黄不卡| 国产黑丝在线一区二区三区| 日韩黄色免费电影| 亚洲成a人v欧美综合天堂下载| 国产精品久99| 国产精品欧美久久久久无广告| 精品国产乱码久久久久久牛牛| 日韩欧美国产成人一区二区| 91精品久久久久久久99蜜桃| 欧美日韩高清在线| 欧美天堂亚洲电影院在线播放| 91免费观看视频| 日本久久电影网| 色www精品视频在线观看| 91高清视频在线| 欧美网站一区二区| 欧美精品一级二级| 欧美色偷偷大香| 4438亚洲最大| 欧美大尺度电影在线| va亚洲va日韩不卡在线观看| thepron国产精品| 一本大道久久a久久综合婷婷| 色88888久久久久久影院按摩| 91久久精品午夜一区二区| 欧美在线观看视频在线| 欧美日韩www| 4hu四虎永久在线影院成人| 精品乱人伦一区二区三区| 久久久精品中文字幕麻豆发布| 国产精品美女一区二区三区| 樱桃视频在线观看一区| 日韩电影在线一区| 国产成人日日夜夜| 99re在线精品| 欧美日韩美女一区二区| 精品国产免费人成电影在线观看四季 | 99久久精品免费看国产| 欧美中文字幕一二三区视频| 欧美日韩激情一区二区三区| 精品理论电影在线观看| 中文字幕在线免费不卡| 亚洲成人高清在线| 国产精品亚洲第一| 欧美亚洲国产一卡| 久久久国产精品麻豆| 亚洲天堂av一区| 久久99精品久久久久婷婷| 97精品国产露脸对白| 日韩亚洲欧美一区| 亚洲精品国产无套在线观| 久久国产综合精品| 欧美影院精品一区| 欧美激情在线一区二区| 青娱乐精品视频|