Mercurial > flash_v2
comparison host/tools/testtool/win32/RunTestsSheet.cpp @ 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 | c37d3a9e1b28 |
comparison
equal
deleted
inserted
replaced
| 81:89fef2181d7d | 82:6736c52df507 |
|---|---|
| 26 // | 26 // |
| 27 | 27 |
| 28 #include "stdafx.h" | 28 #include "stdafx.h" |
| 29 | 29 |
| 30 #include "eCosTest.h" | 30 #include "eCosTest.h" |
| 31 #include "eCosThreadUtils.h" | |
| 31 #include "eCosTrace.h" | 32 #include "eCosTrace.h" |
| 32 #include "PropertiesDialog.h" | 33 #include "PropertiesDialog.h" |
| 33 #include "ResetAttributes.h" | 34 #include "ResetAttributes.h" |
| 34 #include "RunTestsSheet.h" | 35 #include "RunTestsSheet.h" |
| 35 #include "TestResource.h" | 36 #include "TestResource.h" |
| 61 m_cyMin(0), | 62 m_cyMin(0), |
| 62 m_Status(Stopped), | 63 m_Status(Stopped), |
| 63 m_bHideTarget(false), | 64 m_bHideTarget(false), |
| 64 m_bHideRemoteControls(false), | 65 m_bHideRemoteControls(false), |
| 65 m_bModal(false), | 66 m_bModal(false), |
| 66 m_prop(_T("Software\\Red Hat\\eCos\\RunTests"),HKEY_CURRENT_USER), | |
| 67 m_ppSheet(ppSheet), | 67 m_ppSheet(ppSheet), |
| 68 m_ep(CeCosTest::ExecutionParameters::RUN) | 68 m_ep(CeCosTest::ExecutionParameters::RUN), |
| 69 m_nTimeout(900), | |
| 70 m_nDownloadTimeout(120), | |
| 71 m_nTimeoutType(TIMEOUT_AUTOMATIC), | |
| 72 m_nDownloadTimeoutType(TIMEOUT_AUTOMATIC), | |
| 73 m_bSerial(true), | |
| 74 m_strPort(_T("COM1")), | |
| 75 m_nBaud(38400), | |
| 76 m_nLocalTCPIPPort(1), | |
| 77 m_nReset(RESET_MANUAL), | |
| 78 m_nResourcePort(1), | |
| 79 m_nRemotePort(1), | |
| 80 m_bFarmed(true) | |
| 69 { | 81 { |
| 70 InitializeCriticalSection(&m_CS); | 82 InitializeCriticalSection(&m_CS); |
| 71 AddPage(&executionpage); | 83 AddPage(&executionpage); |
| 72 AddPage(&outputpage); | 84 AddPage(&outputpage); |
| 73 AddPage(&summarypage); | 85 AddPage(&summarypage); |
| 104 // CRunTestsSheet message handlers | 116 // CRunTestsSheet message handlers |
| 105 | 117 |
| 106 BOOL CRunTestsSheet::OnInitDialog() | 118 BOOL CRunTestsSheet::OnInitDialog() |
| 107 { | 119 { |
| 108 if(!m_bHideTarget){ | 120 if(!m_bHideTarget){ |
| 109 m_prop.Add(_T("Platform"),(void *)&m_strTarget,GetFn,PutFn); | 121 m_prop.Add(_T("Platform"),m_strTarget); |
| 110 } | 122 } |
| 111 m_prop.Add(_T("Active timeout"),m_nTimeout,900); | 123 m_prop.Add(_T("Active timeout"),m_nTimeout); |
| 112 m_prop.Add(_T("Download timeout"),m_nDownloadTimeout,120); | 124 m_prop.Add(_T("Download timeout"),m_nDownloadTimeout); |
| 113 m_prop.Add(_T("Active timeout type"),m_nTimeoutType,TIMEOUT_AUTOMATIC); | 125 m_prop.Add(_T("Active timeout type"),m_nTimeoutType); |
| 114 m_prop.Add(_T("Download timeout type"),m_nDownloadTimeoutType,TIMEOUT_AUTOMATIC); | 126 m_prop.Add(_T("Download timeout type"),m_nDownloadTimeoutType); |
| 115 m_prop.Add(_T("Remote"),m_bRemote); | 127 m_prop.Add(_T("Remote"),m_bRemote); |
| 116 m_prop.Add(_T("Serial"),m_bSerial,true); | 128 m_prop.Add(_T("Serial"),m_bSerial); |
| 117 m_prop.Add(_T("Port"),(void *)&m_strPort,GetFn,PutFn,_T("COM1")); | 129 m_prop.Add(_T("Port"),m_strPort); |
| 118 m_prop.Add(_T("Baud"),m_nBaud,38400); | 130 m_prop.Add(_T("Baud"),m_nBaud); |
| 119 m_prop.Add(_T("Local TCPIP Host"),(void *)&m_strLocalTCPIPHost,GetFn,PutFn); | 131 m_prop.Add(_T("Local TCPIP Host"),m_strLocalTCPIPHost); |
| 120 m_prop.Add(_T("Local TCPIP Port"),m_nLocalTCPIPPort,1); | 132 m_prop.Add(_T("Local TCPIP Port"),m_nLocalTCPIPPort); |
| 121 m_prop.Add(_T("Reset Type"),m_nReset,RESET_MANUAL); | 133 m_prop.Add(_T("Reset Type"),m_nReset); |
| 122 m_prop.Add(_T("Reset String"),(void *)&m_strReset,GetFn,PutFn); | 134 m_prop.Add(_T("Reset String"),m_strReset); |
| 123 m_prop.Add(_T("Resource Host"),(void *)&m_strResourceHost,GetFn,PutFn); | 135 m_prop.Add(_T("Resource Host"),m_strResourceHost); |
| 124 m_prop.Add(_T("Resource Port"),m_nResourcePort,1); | 136 m_prop.Add(_T("Resource Port"),m_nResourcePort); |
| 125 m_prop.Add(_T("Remote Host"),(void *)&m_strRemoteHost,GetFn,PutFn); | 137 m_prop.Add(_T("Remote Host"),m_strRemoteHost); |
| 126 m_prop.Add(_T("Remote Port"),m_nRemotePort,1); | 138 m_prop.Add(_T("Remote Port"),m_nRemotePort); |
| 127 m_prop.Add(_T("Recurse"),executionpage.m_bRecurse); | 139 m_prop.Add(_T("Recurse"),executionpage.m_bRecurse); |
| 128 //m_prop.Add(_T("Loadfromdir"),executionpage.m_strLoaddir); | 140 //m_prop.Add(_T("Loadfromdir"),executionpage.m_strLoaddir); |
| 129 m_prop.Add(_T("Farmed"),m_bFarmed,true); | 141 m_prop.Add(_T("Farmed"),m_bFarmed); |
| 130 m_prop.Add(_T("Extension"),(void *)&executionpage.m_strExtension,GetFn,PutFn,_T("*.exe")); | 142 m_prop.Add(_T("Extension"),executionpage.m_strExtension); |
| 131 m_prop.SetDefaults(); | |
| 132 | 143 |
| 133 CeCosTrace::SetOutput(TestOutputCallback,this); | 144 CeCosTrace::SetOutput(TestOutputCallback,this); |
| 134 CeCosTrace::SetError (TestOutputCallback,this); | 145 CeCosTrace::SetError (TestOutputCallback,this); |
| 135 | 146 |
| 136 // m_psh can only be used to set the small icon. Set the large one here. | 147 // m_psh can only be used to set the small icon. Set the large one here. |
| 140 SetIcon(m_psh.hIcon,FALSE); | 151 SetIcon(m_psh.hIcon,FALSE); |
| 141 SetIcon(m_psh.hIcon,TRUE); | 152 SetIcon(m_psh.hIcon,TRUE); |
| 142 } | 153 } |
| 143 GetWindowRect(m_rcPrev); | 154 GetWindowRect(m_rcPrev); |
| 144 #ifdef _DEBUG | 155 #ifdef _DEBUG |
| 145 CeCosTrace::EnableTracing(true); | 156 CeCosTrace::EnableTracing(CeCosTrace::TRACE_LEVEL_TRACE); |
| 146 #endif | 157 #endif |
| 147 CeCosTrace::SetInteractive(true); | 158 CeCosTrace::SetInteractive(true); |
| 148 | 159 |
| 149 if(m_pInitFunc){ | 160 if(m_pInitFunc){ |
| 150 m_pInitFunc(&m_prop,false); | 161 m_pInitFunc(&m_prop,false); |
| 278 CeCosTest::ExecutionParameters::RUN, | 289 CeCosTest::ExecutionParameters::RUN, |
| 279 m_strTarget, | 290 m_strTarget, |
| 280 TIMEOUT_NONE==m_nTimeoutType?0x7fffffff:TIMEOUT_AUTOMATIC==m_nTimeoutType?0:1000*m_nTimeout, | 291 TIMEOUT_NONE==m_nTimeoutType?0x7fffffff:TIMEOUT_AUTOMATIC==m_nTimeoutType?0:1000*m_nTimeout, |
| 281 TIMEOUT_NONE==m_nDownloadTimeoutType?0x7fffffff:TIMEOUT_AUTOMATIC==m_nDownloadTimeoutType?0:1000*m_nDownloadTimeout); | 292 TIMEOUT_NONE==m_nDownloadTimeoutType?0x7fffffff:TIMEOUT_AUTOMATIC==m_nDownloadTimeoutType?0:1000*m_nDownloadTimeout); |
| 282 if(m_bRemote){ | 293 if(m_bRemote){ |
| 283 CTestResource::SetResourceServer(m_strResourceHost,m_nResourcePort); | 294 CTestResource::SetResourceServer(CeCosSocket::HostPort(m_strResourceHost,m_nResourcePort)); |
| 284 if(!CTestResource::LoadSocket()){ | 295 if(!CTestResource::Load()){ |
| 285 MessageBox(_T("Could not connect to resource server")); | 296 MessageBox(_T("Could not connect to resource server")); |
| 286 return; | 297 return; |
| 287 } | 298 } |
| 288 } else { | 299 } else { |
| 289 if(CeCosTest::IsSim(m_ep.Target())){ | 300 const String strPort(m_bSerial?(LPCTSTR)m_strPort:CeCosSocket::HostPort(m_strLocalTCPIPHost,m_nLocalTCPIPPort)); |
| 290 //for(int i=0;i<m_nSimConcurrent;i++){ | 301 if(0==strPort.size()){ |
| 291 m_pResource=new CTestResource(m_ep.Target()); | 302 m_pResource=new CTestResource(_T(""),m_ep.PlatformName()); |
| 292 //} | |
| 293 } else { | 303 } else { |
| 294 const String strPort(m_bSerial?(LPCTSTR)m_strPort:CeCosTestSocket::HostPort(m_strLocalTCPIPHost,m_nLocalTCPIPPort)); | |
| 295 int nBaud=m_bSerial?m_nBaud:0; | 304 int nBaud=m_bSerial?m_nBaud:0; |
| 296 if (RESET_X10!=m_nReset) { | 305 if (RESET_X10!=m_nReset) { |
| 297 m_pResource=new CTestResource(m_ep.Target(),strPort,nBaud); | 306 m_pResource=new CTestResource(_T(""),m_ep.PlatformName(),strPort,nBaud); |
| 298 } else { | 307 } else { |
| 299 m_pResource=new CTestResource(m_ep.Target(),strPort,nBaud,m_strReset); | 308 m_pResource=new CTestResource(_T(""),m_ep.PlatformName(),strPort,nBaud,m_strReset); |
| 300 } | 309 } |
| 301 } | 310 } |
| 302 } | 311 } |
| 303 m_Status=Running; | 312 m_Status=Running; |
| 304 SetDlgItemText(IDOK,_T("&Stop")); | 313 SetDlgItemText(IDOK,_T("&Stop")); |
| 318 { | 327 { |
| 319 Info *pInfo=(Info *)pParam; | 328 Info *pInfo=(Info *)pParam; |
| 320 String str; | 329 String str; |
| 321 bool bOk=false; | 330 bool bOk=false; |
| 322 CResetAttributes::ResetResult n=pInfo->pSheet->m_pResource->Reset(str); | 331 CResetAttributes::ResetResult n=pInfo->pSheet->m_pResource->Reset(str); |
| 323 if(CResetAttributes::RESET_OK==n){ | 332 if(CResetAttributes::RESET_OK!=n){ |
| 324 str+=_TCHAR('\n'); | 333 str+=_T(">>> Could not reset target\n"); |
| 325 if(CResetAttributes::IsValidReset((void *)(LPCTSTR )str)){ | 334 } |
| 326 str+=_T(">>> Reset ok\n"); | 335 str+=_TCHAR('\n'); |
| 327 bOk=true; | 336 LPTSTR pszCopy=new TCHAR[1+str.size()]; |
| 328 } else { | |
| 329 str+=_T(">>> Could not reset target (no valid startup string seen)\n"); | |
| 330 } | |
| 331 } else { | |
| 332 String str; | |
| 333 str+=_T(">>> Could not reset target - X10 error - "); | |
| 334 str+=CResetAttributes::Image(n); | |
| 335 str+=_TCHAR('\n'); | |
| 336 } | |
| 337 LPTSTR pszCopy=new TCHAR[1+str.GetLength()]; | |
| 338 _tcscpy(pszCopy,str); | 337 _tcscpy(pszCopy,str); |
| 339 pInfo->pSheet->PostMessage(WM_TESTOUTPUT,(WPARAM)pszCopy,0); | 338 pInfo->pSheet->PostMessage(WM_TESTOUTPUT,(WPARAM)pszCopy,0); |
| 340 | 339 |
| 341 if(bOk){ | 340 if(bOk){ |
| 342 // we're already in a thread, so we can call the function directly | 341 // we're already in a thread, so we can call the function directly |
| 369 m_nTestsToComplete++; | 368 m_nTestsToComplete++; |
| 370 if(m_bRemote){ | 369 if(m_bRemote){ |
| 371 CeCosThreadUtils::RunThread(RunRemoteFunc,pInfo,RunCallback,_T("RunRemoteFunc")); | 370 CeCosThreadUtils::RunThread(RunRemoteFunc,pInfo,RunCallback,_T("RunRemoteFunc")); |
| 372 } else { | 371 } else { |
| 373 bool bRun=false; | 372 bool bRun=false; |
| 374 if(CeCosTest::IsSim(m_ep.Target())){ | 373 switch((ResetType)m_nReset){ |
| 375 bRun=true; | 374 case RESET_NONE: |
| 376 } else { | 375 bRun=true; |
| 377 switch((ResetType)m_nReset){ | 376 break; |
| 378 case RESET_NONE: | 377 case RESET_X10: |
| 379 bRun=true; | 378 // Resetting can take a while, so spawn a thread |
| 380 break; | 379 bRun=false; |
| 381 case RESET_X10: | 380 { |
| 382 // Resetting can take a while, so spawn a thread | 381 DWORD dwID; |
| 383 bRun=false; | 382 CloseHandle(CreateThread(0,0,X10ThreadFunc, pInfo, 0, &dwID)); |
| 384 { | |
| 385 DWORD dwID; | |
| 386 CloseHandle(CreateThread(0,0,X10ThreadFunc, pInfo, 0, &dwID)); | |
| 387 } | |
| 388 break; | |
| 389 case RESET_MANUAL: | |
| 390 bRun=(IDOK==MessageBox(_T("Press OK when target is reset - cancel to abort run"),NULL,MB_OKCANCEL)); | |
| 391 if(!bRun){ | |
| 392 m_nNextToSubmit=executionpage.SelectedTestCount(); | |
| 393 RunCallback(pInfo); | |
| 394 } | |
| 395 break; | |
| 396 } | 383 } |
| 384 break; | |
| 385 case RESET_MANUAL: | |
| 386 bRun=(IDOK==MessageBox(_T("Press OK when target is reset - cancel to abort run"),NULL,MB_OKCANCEL)); | |
| 387 if(!bRun){ | |
| 388 m_nNextToSubmit=executionpage.SelectedTestCount(); | |
| 389 RunCallback(pInfo); | |
| 390 } | |
| 391 break; | |
| 397 } | 392 } |
| 398 if(bRun){ | 393 if(bRun){ |
| 399 CeCosThreadUtils::RunThread(RunLocalFunc,pInfo,RunCallback,_T("RunLocalFunc")); | 394 CeCosThreadUtils::RunThread(RunLocalFunc,pInfo,RunCallback,_T("RunLocalFunc")); |
| 400 } | 395 } |
| 401 } | 396 } |
| 477 dlg.m_strRemoteHost=m_strRemoteHost; | 472 dlg.m_strRemoteHost=m_strRemoteHost; |
| 478 dlg.m_nRemotePort=m_nRemotePort; | 473 dlg.m_nRemotePort=m_nRemotePort; |
| 479 dlg.m_strPort=m_strPort; | 474 dlg.m_strPort=m_strPort; |
| 480 dlg.m_bFarmed=m_bFarmed; | 475 dlg.m_bFarmed=m_bFarmed; |
| 481 if(IDOK==dlg.DoModal()){ | 476 if(IDOK==dlg.DoModal()){ |
| 482 m_strTarget=dlg.m_strTarget; | 477 m_strTarget=(LPCTSTR)dlg.m_strTarget; |
| 483 m_nTimeout=dlg.m_nTimeout; | 478 m_nTimeout=dlg.m_nTimeout; |
| 484 m_nDownloadTimeout=dlg.m_nDownloadTimeout; | 479 m_nDownloadTimeout=dlg.m_nDownloadTimeout; |
| 485 m_nTimeoutType=dlg.m_nTimeoutType; | 480 m_nTimeoutType=dlg.m_nTimeoutType; |
| 486 m_nDownloadTimeoutType=dlg.m_nDownloadTimeoutType; | 481 m_nDownloadTimeoutType=dlg.m_nDownloadTimeoutType; |
| 487 m_bRemote=dlg.m_bRemote; | 482 m_bRemote=dlg.m_bRemote; |
| 488 m_bSerial=dlg.m_bSerial; | 483 m_bSerial=dlg.m_bSerial; |
| 489 m_strPort=dlg.m_strPort; | 484 m_strPort=(LPCTSTR)dlg.m_strPort; |
| 490 m_nBaud=dlg.m_nBaud; | 485 m_nBaud=dlg.m_nBaud; |
| 491 m_strLocalTCPIPHost=dlg.m_strLocalTCPIPHost; | 486 m_strLocalTCPIPHost=(LPCTSTR)dlg.m_strLocalTCPIPHost; |
| 492 m_nLocalTCPIPPort=dlg.m_nLocalTCPIPPort; | 487 m_nLocalTCPIPPort=dlg.m_nLocalTCPIPPort; |
| 493 m_nReset=dlg.m_nReset; | 488 m_nReset=dlg.m_nReset; |
| 494 m_strReset=dlg.m_strReset; | 489 m_strReset=(LPCTSTR)dlg.m_strReset; |
| 495 m_strResourceHost=dlg.m_strResourceHost; | 490 m_strResourceHost=(LPCTSTR)dlg.m_strResourceHost; |
| 496 m_nResourcePort=dlg.m_nResourcePort; | 491 m_nResourcePort=dlg.m_nResourcePort; |
| 497 m_strRemoteHost=dlg.m_strRemoteHost; | 492 m_strRemoteHost=(LPCTSTR)dlg.m_strRemoteHost; |
| 498 m_nRemotePort=dlg.m_nRemotePort; | 493 m_nRemotePort=dlg.m_nRemotePort; |
| 499 m_bFarmed=dlg.m_bFarmed; | 494 m_bFarmed=dlg.m_bFarmed; |
| 500 if(m_pInitFunc){ | 495 if(m_pInitFunc){ |
| 501 m_pInitFunc(&m_prop,true); | 496 m_pInitFunc(&m_prop,true); |
| 502 } | 497 } |
