| 1 |
26 |
unneback |
//####COPYRIGHTBEGIN####
|
| 2 |
|
|
//
|
| 3 |
|
|
// ----------------------------------------------------------------------------
|
| 4 |
|
|
// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
|
| 5 |
|
|
//
|
| 6 |
|
|
// This program is part of the eCos host tools.
|
| 7 |
|
|
//
|
| 8 |
|
|
// This program is free software; you can redistribute it and/or modify it
|
| 9 |
|
|
// under the terms of the GNU General Public License as published by the Free
|
| 10 |
|
|
// Software Foundation; either version 2 of the License, or (at your option)
|
| 11 |
|
|
// any later version.
|
| 12 |
|
|
//
|
| 13 |
|
|
// This program is distributed in the hope that it will be useful, but WITHOUT
|
| 14 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
| 15 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
| 16 |
|
|
// more details.
|
| 17 |
|
|
//
|
| 18 |
|
|
// You should have received a copy of the GNU General Public License along with
|
| 19 |
|
|
// this program; if not, write to the Free Software Foundation, Inc.,
|
| 20 |
|
|
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
| 21 |
|
|
//
|
| 22 |
|
|
// ----------------------------------------------------------------------------
|
| 23 |
|
|
//
|
| 24 |
|
|
//####COPYRIGHTEND####
|
| 25 |
|
|
// RunTests.cpp : Defines the class behaviors for the application.
|
| 26 |
|
|
//
|
| 27 |
|
|
|
| 28 |
|
|
#include "stdafx.h"
|
| 29 |
|
|
|
| 30 |
|
|
#include "CSHDialog.h"
|
| 31 |
|
|
#include "eCosDialog.h"
|
| 32 |
|
|
#include "eCosTest.h"
|
| 33 |
|
|
#include "FileName.h"
|
| 34 |
|
|
#include "TestTool.h"
|
| 35 |
|
|
#include "RunTestsSheet.h"
|
| 36 |
|
|
#include "Properties.h"
|
| 37 |
|
|
|
| 38 |
|
|
#ifdef _DEBUG
|
| 39 |
|
|
#define new DEBUG_NEW
|
| 40 |
|
|
#undef THIS_FILE
|
| 41 |
|
|
static char THIS_FILE[] = __FILE__;
|
| 42 |
|
|
#endif
|
| 43 |
|
|
|
| 44 |
|
|
/////////////////////////////////////////////////////////////////////////////
|
| 45 |
|
|
// CRunTestsApp
|
| 46 |
|
|
|
| 47 |
|
|
BEGIN_MESSAGE_MAP(CRunTestsApp, CWinApp)
|
| 48 |
|
|
//{{AFX_MSG_MAP(CRunTestsApp)
|
| 49 |
|
|
// NOTE - the ClassWizard will add and remove mapping macros here.
|
| 50 |
|
|
// DO NOT EDIT what you see in these blocks of generated code!
|
| 51 |
|
|
//}}AFX_MSG
|
| 52 |
|
|
//ON_COMMAND(ID_HELP, CWinApp::OnHelp)
|
| 53 |
|
|
END_MESSAGE_MAP()
|
| 54 |
|
|
|
| 55 |
|
|
/////////////////////////////////////////////////////////////////////////////
|
| 56 |
|
|
// CRunTestsApp construction
|
| 57 |
|
|
|
| 58 |
|
|
CRunTestsApp::CRunTestsApp()
|
| 59 |
|
|
{
|
| 60 |
|
|
// TODO: add construction code here,
|
| 61 |
|
|
// Place all significant initialization in InitInstance
|
| 62 |
|
|
}
|
| 63 |
|
|
|
| 64 |
|
|
/////////////////////////////////////////////////////////////////////////////
|
| 65 |
|
|
// The one and only CRunTestsApp object
|
| 66 |
|
|
|
| 67 |
|
|
CRunTestsApp theApp;
|
| 68 |
|
|
|
| 69 |
|
|
/////////////////////////////////////////////////////////////////////////////
|
| 70 |
|
|
// CRunTestsApp initialization
|
| 71 |
|
|
|
| 72 |
|
|
BOOL CRunTestsApp::InitInstance()
|
| 73 |
|
|
{
|
| 74 |
|
|
CeCosSocket::Init();
|
| 75 |
|
|
CeCosTestPlatform::Load();
|
| 76 |
|
|
CFileName strCSHFile;
|
| 77 |
|
|
::GetModuleFileName(::GetModuleHandle(NULL),strCSHFile.GetBuffer(1+MAX_PATH),MAX_PATH);
|
| 78 |
|
|
strCSHFile.ReleaseBuffer();
|
| 79 |
|
|
strCSHFile.ReplaceExtension(_T(".chm"));
|
| 80 |
|
|
CCSHDialog::SetCSHFilePath(strCSHFile);
|
| 81 |
|
|
|
| 82 |
|
|
extern UINT arTestToolDialogMap[];
|
| 83 |
|
|
CeCosDialog::AddDialogMap(arTestToolDialogMap);
|
| 84 |
|
|
|
| 85 |
|
|
/*
|
| 86 |
|
|
if (!AfxSocketInit())
|
| 87 |
|
|
{
|
| 88 |
|
|
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
|
| 89 |
|
|
return FALSE;
|
| 90 |
|
|
}
|
| 91 |
|
|
*/
|
| 92 |
|
|
AfxEnableControlContainer();
|
| 93 |
|
|
|
| 94 |
|
|
// Standard initialization
|
| 95 |
|
|
// If you are not using these features and wish to reduce the size
|
| 96 |
|
|
// of your final executable, you should remove from the following
|
| 97 |
|
|
// the specific initialization routines you do not need.
|
| 98 |
|
|
|
| 99 |
|
|
#ifdef _AFXDLL
|
| 100 |
|
|
Enable3dControls(); // Call this when using MFC in a shared DLL
|
| 101 |
|
|
#else
|
| 102 |
|
|
Enable3dControlsStatic(); // Call this when linking to MFC statically
|
| 103 |
|
|
#endif
|
| 104 |
|
|
/*
|
| 105 |
|
|
CRunTestsDlg dlg;
|
| 106 |
|
|
m_pMainWnd = &dlg;
|
| 107 |
|
|
int nResponse = dlg.DoModal();
|
| 108 |
|
|
if (nResponse == IDOK)
|
| 109 |
|
|
{
|
| 110 |
|
|
// TODO: Place code here to handle when the dialog is
|
| 111 |
|
|
// dismissed with OK
|
| 112 |
|
|
}
|
| 113 |
|
|
else if (nResponse == IDCANCEL)
|
| 114 |
|
|
{
|
| 115 |
|
|
// TODO: Place code here to handle when the dialog is
|
| 116 |
|
|
// dismissed with Cancel
|
| 117 |
|
|
}
|
| 118 |
|
|
*/
|
| 119 |
|
|
CRunTestsSheet sheet(_T("Run Tests"), NULL, 0, InitFunc);
|
| 120 |
|
|
m_pMainWnd = &sheet;
|
| 121 |
|
|
//sheet.m_psh.hIcon=LoadIcon(IDR_MAINFRAME);
|
| 122 |
|
|
//sheet.m_psh.dwFlags|=PSH_USEHICON/*|PSH_HASHELP*/;
|
| 123 |
|
|
sheet.DoModal();
|
| 124 |
|
|
|
| 125 |
|
|
// Since the dialog has been closed, return FALSE so that we exit the
|
| 126 |
|
|
// application, rather than start the application's message pump.
|
| 127 |
|
|
CeCosSocket::Term();
|
| 128 |
|
|
CeCosTestPlatform::RemoveAllPlatforms();
|
| 129 |
|
|
|
| 130 |
|
|
return FALSE;
|
| 131 |
|
|
}
|
| 132 |
|
|
|
| 133 |
|
|
void CALLBACK CRunTestsApp::InitFunc(CProperties *pProp, bool bSave)
|
| 134 |
|
|
{
|
| 135 |
|
|
static bool bFirstTime=true;
|
| 136 |
|
|
if(bSave){
|
| 137 |
|
|
pProp->SaveToRegistry(HKEY_CURRENT_USER,_T("Software\\Red Hat\\eCos\\RunTests"));
|
| 138 |
|
|
} else {
|
| 139 |
|
|
pProp->LoadFromCommandString(GetCommandLine());
|
| 140 |
|
|
pProp->LoadFromRegistry(HKEY_CURRENT_USER,_T("Software\\Red Hat\\eCos\\RunTests"));
|
| 141 |
|
|
}
|
| 142 |
|
|
bFirstTime=false;
|
| 143 |
|
|
}
|