Пример #1
0
void ecRunTestsDialog::OnIdle(wxIdleEvent& event)
{
    FlushBuffer();

    if (m_testsAreComplete)
    {
        m_testsAreComplete = FALSE;
        SubmitTests();
    }

    event.Skip();
}
Пример #2
0
void CRunTestsSheet::OnRun()
{
  
  if(Running==m_Status){
    outputpage.AddLogMsg(_T("Run canceled"));
    m_Status=Stopping;
    EnterCriticalSection(&m_CS);
    m_nNextToSubmit=0x7fffffff;
    LeaveCriticalSection(&m_CS);
    CeCosTest::CancelAllInstances();  
  } else {
    outputpage.UpdateData(TRUE);
    summarypage.UpdateData(TRUE);
    executionpage.UpdateData(TRUE);
    if(0==executionpage.SelectedTestCount()){
      MessageBox(_T("No tests have selected for execution"));
    } else {
      m_ep=CeCosTest::ExecutionParameters(
        CeCosTest::ExecutionParameters::RUN,
        m_strTarget,
        TIMEOUT_NONE==m_nTimeoutType?0x7fffffff:TIMEOUT_AUTOMATIC==m_nTimeoutType?900000:1000*m_nTimeout,
        TIMEOUT_NONE==m_nDownloadTimeoutType?0x7fffffff:TIMEOUT_AUTOMATIC==m_nDownloadTimeoutType?0:1000*m_nDownloadTimeout);
      if(m_bRemote){
        CTestResource::SetResourceServer(CeCosSocket::HostPort(m_strResourceHost,m_nResourcePort));
        if(!CTestResource::Load()){
          MessageBox(_T("Could not connect to resource server"));
          return;
        }
      } else {
        const String strPort(m_bSerial?(LPCTSTR)m_strPort:CeCosSocket::HostPort(m_strLocalTCPIPHost,m_nLocalTCPIPPort));
        if(0==strPort.size()){
          m_pResource=new CTestResource(_T(""),m_ep.PlatformName());
        } else {
          int nBaud=m_bSerial?m_nBaud:0;
          if (RESET_X10!=m_nReset) {
            m_pResource=new CTestResource(_T(""),m_ep.PlatformName(),strPort,nBaud);
          } else {
            m_pResource=new CTestResource(_T(""),m_ep.PlatformName(),strPort,nBaud,m_strReset);
          }
        }
      }
      m_Status=Running;
      SetDlgItemText(IDOK,_T("&Stop"));
      m_nNextToSubmit=0;
      outputpage.AddLogMsg(_T("Run started"));
      SubmitTests();
    }
  }
}
Пример #3
0
void ecRunTestsDialog::OnRun(wxCommandEvent& event)
{  
    if (ecRunning == m_runStatus)
    {
        m_output->AddLogMsg(_("Run cancelled"));
        m_runStatus = ecStopping;
        m_CS.Enter();
        m_nNextToSubmit=0x7fffffff;
        m_CS.Leave();
        CeCosTest::CancelAllInstances();  
    }
    else
    {
        if ( 0 == m_executables->SelectedTestCount())
        {
            wxMessageBox(_("No tests have been selected for execution."),
                wxGetApp().GetSettings().GetAppName(), wxICON_EXCLAMATION|wxOK, this);
            return ;
        }
        else
        {
            m_ep = CeCosTest::ExecutionParameters(
                CeCosTest::ExecutionParameters::RUN,
                wxGetApp().GetSettings().GetRunTestsSettings().m_strTarget,
                TIMEOUT_NONE==wxGetApp().GetSettings().GetRunTestsSettings().m_nTimeoutType?0x7fffffff:TIMEOUT_AUTOMATIC==wxGetApp().GetSettings().GetRunTestsSettings().m_nTimeoutType?900000:1000*wxGetApp().GetSettings().GetRunTestsSettings().m_nTimeout,
                TIMEOUT_NONE==wxGetApp().GetSettings().GetRunTestsSettings().m_nDownloadTimeoutType?0x7fffffff:TIMEOUT_AUTOMATIC==wxGetApp().GetSettings().GetRunTestsSettings().m_nDownloadTimeoutType?0:1000*wxGetApp().GetSettings().GetRunTestsSettings().m_nDownloadTimeout);
            
            if ( wxGetApp().GetSettings().GetRunTestsSettings().m_bRemote )
            {
                CTestResource::SetResourceServer(CeCosSocket::HostPort(wxGetApp().GetSettings().GetRunTestsSettings().m_strResourceHost, wxGetApp().GetSettings().GetRunTestsSettings().m_nResourcePort));
                if (!CTestResource::Load())
                {
                    wxMessageBox(_("Could not connect to resource server."),
                        wxGetApp().GetSettings().GetAppName(), wxICON_EXCLAMATION|wxOK, this);
                    return;
                }
            }
            else
            {
                wxString strPort;
                if (wxGetApp().GetSettings().GetRunTestsSettings().m_bSerial)
                    strPort = wxGetApp().GetSettings().GetRunTestsSettings().m_strPort;
                else
                    strPort = (const wxChar*) CeCosSocket::HostPort(wxGetApp().GetSettings().GetRunTestsSettings().m_strLocalTCPIPHost,wxGetApp().GetSettings().GetRunTestsSettings().m_nLocalTCPIPPort);
                if(0==strPort.Length()){
                    m_pResource=new CTestResource(_T(""),m_ep.PlatformName());
                } else
		{
                    // Translate from e.g. COM2 to /dev/ttyS1 on Unix.
                    // Let's assume the Windows notation is the 'standard'.
		    strPort = TranslatePort(strPort);
                    int nBaud = wxGetApp().GetSettings().GetRunTestsSettings().m_bSerial ? wxGetApp().GetSettings().GetRunTestsSettings().m_nBaud:0;
                    if (RESET_X10 != wxGetApp().GetSettings().GetRunTestsSettings().m_nReset) {
                        m_pResource=new CTestResource(_T(""),m_ep.PlatformName(), strPort, nBaud);
                    } else {
                        m_pResource=new CTestResource(_T(""),m_ep.PlatformName(), strPort, nBaud, wxGetApp().GetSettings().GetRunTestsSettings().m_strReset);
                    }
                }
            }
            m_runStatus = ecRunning;
            m_testsAreComplete = FALSE;
            
            wxButton* runButton = (wxButton*) FindWindow(ecID_RUN_TESTS_RUN);
            runButton->SetLabel(_("&Stop"));
            
            m_nNextToSubmit=0;
            m_output->AddLogMsg(_("Run started"));

            SubmitTests();
        }
    }
}