Peano
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1// This file is part of the Peano project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#include "config.h"
5#include "peano4/peano.h"
6#include "peano4/UnitTests.h"
9#include "tarch/logging/Log.h"
11#include "tarch/mpi/Rank.h"
13#include "tarch/UnitTests.h"
14
15#ifdef UseToolboxBlockstructured
17#endif
18
19#ifdef UseToolboxFiniteElements
21#endif
22
23#ifdef UseToolboxMultiprecision
24#include "toolbox/multiprecision/UnitTests.h"
25#endif
26
27#ifdef UseToolboxParticles
30#endif
31
32#ifdef UseExaHyPE
33#include "exahype2/UnitTests.h"
34#endif
35
36#ifdef UseSWIFT
37#include "swift2/UnitTests.h"
38#endif
39
41
42void runTests() {
43 int unitTestsErrors = 0;
45
47 tests->run();
48 unitTestsErrors += tests->getNumberOfErrors();
49 delete tests;
50
52 tests->run();
53 unitTestsErrors += tests->getNumberOfErrors();
54 delete tests;
55
56#ifdef UseToolboxBlockstructured
58 tests->run();
59 unitTestsErrors += tests->getNumberOfErrors();
60 delete tests;
61#endif
62
63#ifdef UseToolboxFiniteElements
65 tests->run();
66 unitTestsErrors += tests->getNumberOfErrors();
67 delete tests;
68#endif
69
70#ifdef UseToolboxMultiprecision
71 tests = toolbox::multiprecision::getUnitTests();
72 tests->run();
73 unitTestsErrors += tests->getNumberOfErrors();
74 delete tests;
75#endif
76
77#ifdef UseToolboxParticles
79 tests->run();
80 unitTestsErrors += tests->getNumberOfErrors();
81 delete tests;
82
84 tests->run();
85 unitTestsErrors += tests->getNumberOfErrors();
86 delete tests;
87#endif
88
89#ifdef UseExaHyPE
91 tests->run();
92 unitTestsErrors += tests->getNumberOfErrors();
93 delete tests;
94#endif
95
96#ifdef UseSWIFT
98 tests->run();
99 unitTestsErrors += tests->getNumberOfErrors();
100 delete tests;
101#endif
102
103
104 if (unitTestsErrors != 0) {
105 logError("main()", "unit tests failed. Quit.");
106 exit(-2);
107 }
108}
109
110int main(int argc, char** argv) {
115 "peano4",
118 )
119 );
124 "peano4",
127 )
128 );
133 "tarch",
136 )
137 );
142 "tarch",
145 )
146 );
151 "exahype2",
154 )
155 );
160 "exahype2",
163 )
164 );
169 "toolbox",
172 )
173 );
174
175 // White- or blacklist assignment checks traces
180 "toolbox::particles::assignmentchecks",
183 )
184 );
189 "toolbox::particles::assignmentchecks",
192 )
193 );
194
199 "toolbox",
202 )
203 );
204
209 "tarch",
212 )
213 );
218 "peano4",
221 )
222 );
227 "exahype2",
230 )
231 );
235 0,
236 "tarch",
239 )
240 );
244 0,
245 "peano4",
248 )
249 );
253 0,
254 "exahype2",
257 )
258 );
259
262
263#ifdef Parallel
264 if (tarch::mpi::Rank::getInstance().getNumberOfRanks() <= 1) {
266 "main()",
267 "it is recommended that you run the unit tests with more than one MPI rank, too"
268 );
269 }
270#endif
271
273 if (argc != 2 and tarch::mpi::Rank::getInstance().isGlobalMaster()) {
275 "main()",
276 "usage: ./" + std::string(argv[0])
277 + " core-count (use default core count=1 now)"
278 );
279 } else if (argc == 2) {
280 cores = std::atoi(argv[1]);
281 }
282
284
285 runTests();
286
287 if (not tarch::mpi::Rank::getInstance().isGlobalMaster()) {
288 while (peano4::parallel::Node::getInstance().continueToRun()) {
289 // Do nothing. This is just to ensure that everything shuts down properly
290 // and is properly installed.
291 }
292 }
293
295
296 return 0;
297}
#define logError(methodName, logMacroMessageStream)
Wrapper macro around tarch::tarch::logging::Log to improve logging.
Definition Log.h:464
#define logWarning(methodName, logMacroMessageStream)
Wrapper macro around tarch::tarch::logging::Log to improve logging.
Definition Log.h:440
int main()
Definition main.cpp:321
void runTests()
Definition main.cpp:25
tarch::logging::Log _log("examples::grid")
static Node & getInstance()
This operation returns the singleton instance.
Definition Node.cpp:108
void addFilterListEntry(const FilterListEntry &entry)
Add one filter list entry.
static LogFilter & getInstance()
Log Device.
Definition Log.h:516
static Rank & getInstance()
This operation returns the singleton instance.
Definition Rank.cpp:543
static constexpr int UseDefaultNumberOfThreads
The default is what the system management typically gives you.
Definition Core.h:69
static Core & getInstance()
Definition Core.cpp:56
void configure(int numberOfThreads=UseDefaultNumberOfThreads)
Configure the whole node, i.e.
Definition Core.cpp:61
Represents one test case.
Definition TestCase.h:57
tarch::tests::TestCase * getUnitTests()
Please destroy after usage.
Definition UnitTests.cpp:18
tarch::tests::TestCase * getUnitTests()
Please destroy after usage.
Definition UnitTests.cpp:12
void fillLookupTables()
Fill Lookup Tables.
Definition peano.cpp:87
int initParallelEnvironment(int *argc, char ***argv)
Init Parallel Environment.
Definition peano.cpp:101
void shutdownParallelEnvironment()
Shutdown all the parallel environment, i.e.
Definition peano.cpp:127
tarch::tests::TestCase * getUnitTests()
Please destroy after usage.
Definition UnitTests.cpp:5
tarch::tests::TestCase * getUnitTests()
Please destroy after usage.
Definition UnitTests.cpp:17
tarch::tests::TestCase * getUnitTests()
Please destroy after usage.
Definition UnitTests.cpp:11
tarch::tests::TestCase * getUnitTests()
Please destroy after usage.
Definition UnitTests.cpp:11
tarch::tests::TestCase * getUnitTests()
Please destroy after usage.
Definition UnitTests.cpp:7
tarch::tests::TestCase * getUnitTests()
Please destroy after usage.
Definition UnitTests.cpp:12
Represents one entry of the filter list.
Definition LogFilter.h:30
static const std::string TargetTrace
Definition LogFilter.h:36
static const std::string TargetDebug
Definition LogFilter.h:35
static const std::string TargetInfo
Definition LogFilter.h:34
static const std::string AlwaysOn
Definition LogFilter.h:39