2 #include <libmesh/ignore_warnings.h> 3 #include <cppunit/extensions/TestFactoryRegistry.h> 4 #include <cppunit/ui/text/TestRunner.h> 5 #include <libmesh/restore_warnings.h> 8 #include <libmesh/libmesh.h> 13 #ifdef LIBMESH_HAVE_CXX11_REGEX 20 const std::string & allow_r_str,
21 const std::regex & allow_r,
22 const std::string & deny_r_str,
23 const std::regex & deny_r,
24 CppUnit::TextUi::TestRunner & runner,
25 CppUnit::TestSuite & rejects)
27 int n_tests_added = 0;
30 if (test->getName() ==
"All Tests" && allow_r_str ==
"All Tests" &&
38 if (test->getChildTestCount() == 0)
41 if ((allow_r_str ==
"All Tests" ||
42 std::regex_search(test->getName(), allow_r)) &&
43 !std::regex_search(test->getName(), deny_r))
51 rejects.addTest(test);
55 for (
int i = 0; i < test->getChildTestCount(); i++)
58 deny_r_str, deny_r, runner, rejects);
66 int main(
int argc,
char ** argv)
110 std::string allow_regex_string =
"All Tests";
114 std::string deny_regex_string =
"^$";
118 CppUnit::TextUi::TestRunner runner;
121 CppUnit::TestFactoryRegistry & registry = CppUnit::TestFactoryRegistry::getRegistry();
125 CppUnit::TestSuite rejects(
"rejects");
127 #ifdef LIBMESH_HAVE_CXX11_REGEX 129 const std::regex allow_regex(allow_regex_string);
130 const std::regex deny_regex(deny_regex_string);
133 libMesh::out <<
"Will run the following tests:" << std::endl;
134 const int n_tests_added =
136 allow_regex_string, allow_regex,
137 deny_regex_string, deny_regex,
139 if (n_tests_added >= 0)
140 libMesh::out <<
"--- Running " << n_tests_added <<
" tests in total." << std::endl;
143 runner.addTest(registry.makeTest());
147 bool succeeded = runner.run();
150 #ifndef LIBMESH_ENABLE_PERFORMANCE_LOGGING 152 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)