1 //####COPYRIGHTBEGIN####
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
6 // This program is part of the eCos host tools.
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)
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
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.
22 // ----------------------------------------------------------------------------
24 //####COPYRIGHTEND####
27 //===========================================================================
28 //#####DESCRIPTIONBEGIN####
31 // Contact(s): julians
35 // Description: Header file for ecRunTestsDialog
42 //####DESCRIPTIONEND####
44 //===========================================================================
46 #ifndef _ECOS_RUNTESTSDLG_H_
47 #define _ECOS_RUNTESTSDLG_H_
50 #pragma interface "runtestsdlg.cpp"
53 #include "wx/notebook.h"
54 #include "wx/thread.h"
57 #include "Properties.h"
61 * Just to force idle processing now and again while
62 * the tests are running
65 class ecRunTestsTimer: public wxTimer
70 virtual void Notify() ;
73 //----------------------------------------------------------------------------
75 //----------------------------------------------------------------------------
77 class ecRunTestsExecutablesDialog;
78 class ecRunTestsOutputDialog;
79 class ecRunTestsSummaryDialog;
81 enum ecRunStatus { ecRunning, ecStopping, ecStopped };
87 class ecRunTestsDialog: public wxDialog
89 DECLARE_CLASS(ecRunTestsDialog)
90 friend class ecResetThread;
91 friend class ecRunTestsTimer;
93 ecRunTestsDialog(wxWindow* parent);
96 void OnOK(wxCommandEvent& event);
97 void OnRun(wxCommandEvent& event);
98 void OnProperties(wxCommandEvent& event);
99 //void OnHelp(wxCommandEvent& event);
100 void OnPageChange(wxNotebookEvent& event);
101 void OnSize(wxSizeEvent& event);
102 void OnIdle(wxIdleEvent& event);
103 void OnCloseWindow(wxCloseEvent& event);
105 virtual bool TransferDataToWindow();
106 virtual bool TransferDataFromWindow();
108 inline wxNotebook* GetNotebook() const { return m_notebook; }
110 // Add the test to the dialog
111 void Populate(const wxString& test, bool select = TRUE);
114 // Write to the output buffer for OnIdle to pick up
115 void OutputToBuffer(const wxString& str);
116 // Write any remaining text
120 static void RunCallback(void *pParam);
121 static void CALLBACK RunLocalFunc(void *pParam);
122 static void CALLBACK RunRemoteFunc(void *pParam);
123 static void CALLBACK TestOutputCallback(void *pParam,LPCTSTR psz);
126 // Translate from Windows to Unix serial port nomenclature
127 wxString TranslatePort(const wxString& port) const;
131 ecRunTestsExecutablesDialog* m_executables;
132 ecRunTestsOutputDialog* m_output;
133 ecRunTestsSummaryDialog* m_summary;
134 wxNotebook* m_notebook;
136 ecRunStatus m_runStatus;
137 CeCosTest::ExecutionParameters m_ep;
139 CTestResource* m_pResource;
141 wxCriticalSection m_CS;
142 static ecRunTestsDialog* m_runTestsDialog;
143 bool m_testsAreComplete;
145 // Output text by writing to the buffer and letting
147 wxString m_outputBuffer;
148 bool m_outputBufferPresent;
149 ecRunTestsTimer m_timer;
150 DECLARE_EVENT_TABLE()
153 /* Executables dialog
156 class ecRunTestsExecutablesDialog: public wxPanel
158 DECLARE_CLASS(ecRunTestsExecutablesDialog)
159 DECLARE_EVENT_TABLE()
161 ecRunTestsExecutablesDialog(wxWindow* parent);
163 void CreateControls( wxPanel *parent);
164 void AddFromFolder(const wxString& folder, bool recurse, const wxString& wildcard);
165 int SelectedTestCount();
166 wxString SelectedTest(int nIndex);
168 void OnCheckAll(wxCommandEvent& event);
169 void OnUncheckAll(wxCommandEvent& event);
170 void OnAdd(wxCommandEvent& event);
171 void OnAddFromFolder(wxCommandEvent& event);
172 void OnRemove(wxCommandEvent& event);
173 void OnUpdateCheckAll(wxUpdateUIEvent& event);
174 void OnUpdateUncheckAll(wxUpdateUIEvent& event);
177 #define ecID_RUN_TESTS_CHECK_ALL 10072
178 #define ecID_RUN_TESTS_UNCHECK_ALL 10073
179 #define ecID_RUN_TESTS_ADD 10074
180 #define ecID_RUN_TESTS_ADD_FOLDER 10075
181 #define ecID_RUN_TESTS_REMOVE 10076
182 #define ecID_RUN_TESTS_TEST_LIST 2063
187 class ecRunTestsOutputDialog: public wxPanel
189 DECLARE_CLASS(ecRunTestsOutputDialog)
191 ecRunTestsOutputDialog(wxWindow* parent);
193 void CreateControls( wxPanel *parent);
195 void AddText(const wxString& msg);
196 void AddLogMsg(const wxString& msg);
199 #define ecID_RUN_TESTS_OUTPUT_TEXT 10088
204 class WXDLLEXPORT wxListCtrl;
206 // Windows requires the sort function to be of type
212 class ecRunTestsSummaryDialog: public wxPanel
214 DECLARE_CLASS(ecRunTestsSummaryDialog)
215 DECLARE_EVENT_TABLE()
217 ecRunTestsSummaryDialog(wxWindow* parent);
219 void CreateControls( wxPanel *parent);
220 void AddResult (CeCosTest *pTest);
221 void OnColClick(wxListEvent& event);
222 static int CALLBACK SummarySortFunc(long data1, long data2, long col);
224 static wxListCtrl* m_listCtrl;
227 #define ecID_RUN_TESTS_SUMMARY_LIST 2063
229 // Information used in thread processing
230 struct ecRunTestsInfo {
231 ecRunTestsDialog* pSheet;
235 // Thread class used for resetting a remote target
236 class ecResetThread : public wxThread
239 ecResetThread(ecRunTestsInfo* info) { m_info = info; };
241 // thread execution starts here
242 virtual void *Entry();
244 // called when the thread exits - whether it terminates normally or is
245 // stopped with Delete() (but not when it is Kill()ed!)
246 virtual void OnExit();
249 ecRunTestsInfo* m_info;
254 // _ECOS_RUNTESTSDLG_H_