From: David Wells Date: Sat, 24 Sep 2016 13:15:18 +0000 (-0400) Subject: Fix tests to not use absolute paths. X-Git-Tag: v8.5.0-rc1~626^2~7 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74daf9ce8dce3fa386752c077c03202671c2aee2;p=dealii.git Fix tests to not use absolute paths. --- diff --git a/tests/parameter_handler/parameter_handler_backslash_03.cc b/tests/parameter_handler/parameter_handler_backslash_03.cc index d5940b4c86..02e659a4f0 100644 --- a/tests/parameter_handler/parameter_handler_backslash_03.cc +++ b/tests/parameter_handler/parameter_handler_backslash_03.cc @@ -19,6 +19,10 @@ #include #include +// header for chdir is platform dependent; when the day comes that we support +// Windows in the test suite then conditionally include direction.h +#include + /* * Test that ParameterHandler does not join lines for things like * @@ -43,18 +47,21 @@ int main () Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h"))); prm.leave_subsection (); + // We need a local path for the file to get consistent output messages. + const int chdir_return_code = chdir (SOURCE_DIR); + AssertThrow (chdir_return_code == 0, ExcInternalError()); // test both relevant read_input functions. They should fail with a // specific exception. try { if (i == 0) { - prm.read_input(SOURCE_DIR "/prm/parameter_handler_backslash_03.prm"); + prm.read_input("prm/parameter_handler_backslash_03.prm"); } else { std::ifstream input_stream - (SOURCE_DIR "/prm/parameter_handler_backslash_03.prm"); + ("prm/parameter_handler_backslash_03.prm"); prm.read_input(input_stream); } diff --git a/tests/parameter_handler/parameter_handler_backslash_03.output b/tests/parameter_handler/parameter_handler_backslash_03.output index 628cd7340f..ba4652df99 100644 --- a/tests/parameter_handler/parameter_handler_backslash_03.output +++ b/tests/parameter_handler/parameter_handler_backslash_03.output @@ -1,6 +1,6 @@ DEAL::ExcInvalidEntryForPattern (current_line_n, input_filename, entry_value, entry_name, patterns[pattern_index]->description()) -Line <4> of file <./prm/parameter_handler_backslash_03.prm>: +Line <4> of file : The entry value a,\ for the entry named diff --git a/tests/parameter_handler/parameter_handler_backslash_04.cc b/tests/parameter_handler/parameter_handler_backslash_04.cc index b70e3fa549..750c04c201 100644 --- a/tests/parameter_handler/parameter_handler_backslash_04.cc +++ b/tests/parameter_handler/parameter_handler_backslash_04.cc @@ -41,18 +41,21 @@ int main () Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h"))); prm.leave_subsection (); + // We need a local path for the file to get consistent output messages. + const int chdir_return_code = chdir (SOURCE_DIR); + AssertThrow (chdir_return_code == 0, ExcInternalError()); // test both relevant read_input functions. They should fail with a // specific exception. try { if (i == 0) { - prm.read_input(SOURCE_DIR "/prm/parameter_handler_backslash_04.prm"); + prm.read_input("prm/parameter_handler_backslash_04.prm"); } else { std::ifstream input_stream - (SOURCE_DIR "/prm/parameter_handler_backslash_04.prm"); + ("prm/parameter_handler_backslash_04.prm"); prm.read_input(input_stream); } diff --git a/tests/parameter_handler/parameter_handler_backslash_04.output b/tests/parameter_handler/parameter_handler_backslash_04.output index d7d35ebd05..a01be39b9d 100644 --- a/tests/parameter_handler/parameter_handler_backslash_04.output +++ b/tests/parameter_handler/parameter_handler_backslash_04.output @@ -1,6 +1,6 @@ DEAL::ExcInvalidEntryForPattern (current_line_n, input_filename, entry_value, entry_name, patterns[pattern_index]->description()) -Line <4> of file <./prm/parameter_handler_backslash_04.prm>: +Line <4> of file : The entry value a,\ b, for the entry named diff --git a/tests/parameter_handler/parameter_handler_backslash_05.cc b/tests/parameter_handler/parameter_handler_backslash_05.cc index 15259f93c1..6bdba4c7e9 100644 --- a/tests/parameter_handler/parameter_handler_backslash_05.cc +++ b/tests/parameter_handler/parameter_handler_backslash_05.cc @@ -50,17 +50,20 @@ int main () prm.leave_subsection (); + // We need a local path for the file to get consistent output messages. + const int chdir_return_code = chdir (SOURCE_DIR); + AssertThrow (chdir_return_code == 0, ExcInternalError()); // test both relevant read_input functions try { if (i == 0) { - prm.read_input(SOURCE_DIR "/prm/parameter_handler_backslash_05.prm"); + prm.read_input("prm/parameter_handler_backslash_05.prm"); } else { std::ifstream input_stream - (SOURCE_DIR "/prm/parameter_handler_backslash_05.prm"); + ("prm/parameter_handler_backslash_05.prm"); prm.read_input(input_stream); } diff --git a/tests/parameter_handler/parameter_handler_backslash_05.output b/tests/parameter_handler/parameter_handler_backslash_05.output index 8987a2ec67..b5cf2c2dbd 100644 --- a/tests/parameter_handler/parameter_handler_backslash_05.output +++ b/tests/parameter_handler/parameter_handler_backslash_05.output @@ -1,6 +1,6 @@ DEAL::ExcCannotParseLine (current_line_n, input_filename, "The line\n\n" " <" + original_line + ">\n\n" "could not be parsed: please check to " "make sure that the file is not missing a " "'set', 'include', 'subsection', or 'end' " "statement.") -Line <8> of file <./prm/parameter_handler_backslash_05.prm>: The line +Line <8> of file : The line