source: TestRunnerClient.h@ e670e4

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since e670e4 was 861874, checked in by Frederik Heber <heber@…>, 14 years ago

libMolecuilderAction is now a shared lib via libtool.

This is all taken from the example available at http://www.openismus.com/documents/linux/building_libraries/building_libraries/building_libraries.shtml.

Necessary changes:

  • ValueStorage is now part of Actions, not of UIElements anymore (which is actually as it should have been right away, only Dialog uses ValueStorage and for all Actions ValueStorage is the simple adapter pattern to MapOfActions needed the relax (compilation) dependencies).
  • new files:
    • config/ltmain.sh (scipt for libtool)
    • libmolecuilder_config.h.in (extra config.h which is copied along with lib to contain how it has been compiled)
    • molecuilder.pc.in (package config information
  • BUGFIX: m4/gwqt4.m4 added -L$X_libraries, however $X_libraries was nowhere set and libtool admonished the empty "-L"
  • libMolecuilderUI now depends on libMolecuilderAction
  • all unit tests now have libMolecuilderAction and libMolecuilderUI due to non-interactive calls of actions
  • Property mode set to 100644
File size: 4.1 KB
Line 
1/*******************************************************************************
2 * Copyright (c) 2008 Gerhard Leonhartsberger.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *******************************************************************************/
8
9#ifndef TESTRUNNERSERVER_H_
10#define TESTRUNNERSERVER_H_
11
12#ifdef CPPUNIT_MAIN
13
14#include "cppunit/TestListener.h"
15
16#include <vector>
17#include <string>
18
19/*!
20 * Class <code>TestRunnerClient</code> handles the network connection to the
21 * <code>CppUnitServer</code> and executes all registered CppUnit tests.
22 * <p>
23 * The meta data of the CppUnit tests and the test results are sent to the
24 * <code>CppUnitServer</code> for displaying.
25 * </p>
26 * <p>
27 * For debugging purposes class <code>TestRunnerClient</code> displays debug
28 * messages on <code>std.cerr</code>. The debug modus is activated by specifying
29 * <code>debug</code> command line option. The command line is parsed by method
30 * <code>Init()</code>.
31 * </p>
32 * <p>
33 * Note: This class is not intended to be subclassed by clients. This class is
34 * based on the original <code>RemoteTestRunner</code> class provided by
35 * <code>org.eclipse.cdt.cppunit</code>.
36 * </p>
37 *
38 * @author Gerhard Leonhartsberger
39 */
40class TestRunnerClient: public CppUnit::TestListener
41{
42private:
43 CppUnit::TestResult *fTestResult;
44 int fClientSocket;
45 char *fHost;
46 int fPort;
47 int fDebugMode;
48 int fKeepAlive;
49
50public:
51 TestRunnerClient();
52 virtual ~TestRunnerClient();
53
54 /*!
55 * Initializes the <code>TestRunnerClient</code>.
56 * <p>
57 * The given <code>args</code> are parsed. The syntax for the arguments is
58 * defined in EBNF as follows: <code>{-option=value}</code>
59 * </p>
60 *
61 * @param n The number of arguments.
62 * @param args The argument values. Valid options are:
63 * <li><code>-debug</code> When present the TestRunnerClient
64 * is run in debug modus and displays debug messages.</li>
65 * <li><code>-port=number</code> Defines the port where
66 * CppUnitServer is listening for client connections.</li>
67 */
68 void Init(int n,char *args[]);
69
70 /*!
71 * Runs the TestRunnerClient. A trial to connect to the CppUnitServer is done.
72 * The test results are sent to the CppUnitServer.
73 *
74 * @return The return value is <code>0</code> when the CppUnitServer was connected successfully
75 * otherwise the return value is <code>-1</code>.
76 */
77 int Run();
78
79 /*!
80 * Stops processing <code>CppUnit</code> from executing tests.
81 */
82 void Stop();
83
84 /*!
85 * Method defined in <code>CppUnit::TestListener</code>.
86 */
87 void startTest(CppUnit::Test *test);
88
89 /*!
90 * Method defined in <code>CppUnit::TestListener</code>.
91 */
92 void addFailure(const CppUnit::TestFailure &failure);
93
94 /*!
95 * Method defined in <code>CppUnit::TestListener</code>.
96 */
97 void endTest(CppUnit::Test *test);
98
99private:
100 int Connect();
101 void RunTests();
102 void ShutDown();
103
104 // utility methods
105 void ParseCommandLine(int n, char *args[]);
106 void DefineHostName();
107 void InstallListeners();
108 void UninstallListeners();
109
110 /*!
111 * Sends the given test to the CppUnitView.
112 * <p>
113 * In case of test is of type CppUnit::Test the following protocol is sent:
114 * <code>TSTTREE name, false, testCaseCount</code>
115 * </p>
116 * <p>
117 * In case of test is of type CppUnit::TestSuite the following protocol is sent:
118 * TSTTREE name, true, testCount
119 * </p>
120 * @param test the CppUnit test
121 */
122 void SendTestTree(CppUnit::Test *test);
123 void SendMessage(std::string msg);
124
125 // Notification methods
126 void NotifyTestRunStarted(int testCount);
127 void NotifyTestRunEnded(long elapsedTime);
128 void NotifyTestRunStopped(long elapsedTime);
129 void NotifyTestTreeEntry(std::string treeEntry);
130 void NotifyTestStarted(std::string testName);
131 void NotifyTestEnded(std::string testName);
132 void NotifyTestFailed(std::string status, std::string testName, std::string trace);
133
134 std::string GetTrace(const CppUnit::TestFailure &failure);
135 long CurrentTimeMillis();
136 void PrivateSleep(int millisecs);
137};
138
139#endif /*CPPUNIT_MAIN*/
140#endif /*TESTRUNNERSERVER_H_*/
Note: See TracBrowser for help on using the repository browser.