Skip to content
Snippets Groups Projects
Commit 1c1de357 authored by Dmitry Yu. Naumov's avatar Dmitry Yu. Naumov
Browse files

[App] Abort if no tests for reference solutions.

Abort if test definitions exist but no tests were actually
constructed from the configuration.
parent 43d80ed0
No related branches found
No related tags found
No related merge requests found
...@@ -287,4 +287,9 @@ std::vector<std::string> const& TestDefinition::getOutputFiles() const ...@@ -287,4 +287,9 @@ std::vector<std::string> const& TestDefinition::getOutputFiles() const
{ {
return _output_files; return _output_files;
} }
std::size_t TestDefinition::numberOfTests() const
{
return size(_command_lines);
}
} // namespace ApplicationsLib } // namespace ApplicationsLib
...@@ -34,6 +34,7 @@ public: ...@@ -34,6 +34,7 @@ public:
bool runTests() const; bool runTests() const;
std::vector<std::string> const& getOutputFiles() const; std::vector<std::string> const& getOutputFiles() const;
std::size_t numberOfTests() const;
private: private:
std::vector<std::string> _command_lines; std::vector<std::string> _command_lines;
......
...@@ -68,7 +68,8 @@ int main(int argc, char* argv[]) ...@@ -68,7 +68,8 @@ int main(int argc, char* argv[])
TCLAP::ValueArg<std::string> reference_path_arg( TCLAP::ValueArg<std::string> reference_path_arg(
"r", "reference", "r", "reference",
"Run output result comparison after successful simulation comparing to " "Run output result comparison after successful simulation comparing to "
"all files in the given path.", "all files in the given path. This requires test definitions to be "
"present in the project file.",
false, "", "PATH"); false, "", "PATH");
cmd.add(reference_path_arg); cmd.add(reference_path_arg);
...@@ -204,6 +205,12 @@ int main(int argc, char* argv[]) ...@@ -204,6 +205,12 @@ int main(int argc, char* argv[])
project_config->getConfigSubtree("test_definition"), project_config->getConfigSubtree("test_definition"),
reference_path_arg.getValue(), reference_path_arg.getValue(),
outdir_arg.getValue()); outdir_arg.getValue());
if( test_definition->numberOfTests() == 0)
{
OGS_FATAL(
"No tests were constructed from the test definitions, "
"but reference solutions path was given.");
}
INFO("Cleanup possible output files before running ogs."); INFO("Cleanup possible output files before running ogs.");
BaseLib::removeFiles(test_definition->getOutputFiles()); BaseLib::removeFiles(test_definition->getOutputFiles());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment