2 #include <libmesh/ignore_warnings.h> 3 #include <cppunit/extensions/TestFactoryRegistry.h> 4 #include <cppunit/ui/text/TestRunner.h> 5 #include <cppunit/BriefTestProgressListener.h> 6 #include <cppunit/TestResult.h> 7 #include <libmesh/restore_warnings.h> 10 #include <libmesh/libmesh.h> 15 #ifdef LIBMESH_HAVE_CXX11_REGEX 22 const std::string & allow_r_str,
23 const std::regex & allow_r,
24 const std::string & deny_r_str,
25 const std::regex & deny_r,
26 CppUnit::TextUi::TestRunner & runner,
27 CppUnit::TestSuite & rejects)
29 int n_tests_added = 0;
32 if (test->getName() ==
"All Tests" && allow_r_str ==
"All Tests" &&
40 if (test->getChildTestCount() == 0)
43 if ((allow_r_str ==
"All Tests" ||
44 std::regex_search(test->getName(), allow_r)) &&
45 !std::regex_search(test->getName(), deny_r))
53 rejects.addTest(test);
57 for (
int i = 0; i < test->getChildTestCount(); i++)
60 deny_r_str, deny_r, runner, rejects);
68 int main(
int argc,
char ** argv)
112 std::string allow_regex_string =
"All Tests";
116 std::string deny_regex_string =
"^$";
120 CppUnit::TextUi::TestRunner runner;
123 CppUnit::TestFactoryRegistry & registry = CppUnit::TestFactoryRegistry::getRegistry();
127 CppUnit::TestSuite rejects(
"rejects");
129 #ifdef LIBMESH_HAVE_CXX11_REGEX 131 const std::regex allow_regex(allow_regex_string);
132 const std::regex deny_regex(deny_regex_string);
135 libMesh::out <<
"Will run the following tests:" << std::endl;
136 const int n_tests_added =
138 allow_regex_string, allow_regex,
139 deny_regex_string, deny_regex,
141 if (n_tests_added >= 0)
142 libMesh::out <<
"--- Running " << n_tests_added <<
" tests in total." << std::endl;
145 runner.addTest(registry.makeTest());
148 std::unique_ptr<CppUnit::TestResult> controller;
149 std::unique_ptr<CppUnit::BriefTestProgressListener> listener;
155 listener = std::make_unique<CppUnit::BriefTestProgressListener>();
156 runner.eventManager().addListener(listener.get());
159 bool succeeded = runner.run();
162 #ifndef LIBMESH_ENABLE_PERFORMANCE_LOGGING 164 driver_unitlog.
clear();
T command_line_next(std::string name, T default_value)
Use GetPot's search()/next() functions to get following arguments from the command line...
libMesh::Parallel::Communicator * TestCommWorld
int add_matching_tests_to_runner(CppUnit::Test *test, const std::string &allow_r_str, const std::regex &allow_r, const std::string &deny_r_str, const std::regex &deny_r, CppUnit::TextUi::TestRunner &runner, CppUnit::TestSuite &rejects)
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
The PerfLog class allows monitoring of specific events.
void enable_summarized_logs()
Tells the PerfLog to only print log results summarized by header.
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
void clear()
Clears all the internal data and restores the data structures to a pristine state.
libMesh::PerfLog * unitlog
int main(int argc, char **argv)
bool on_command_line(std::string arg)