]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix tests to not use absolute paths.
authorDavid Wells <wellsd2@rpi.edu>
Sat, 24 Sep 2016 13:15:18 +0000 (09:15 -0400)
committerDavid Wells <wellsd2@rpi.edu>
Wed, 28 Sep 2016 13:38:18 +0000 (09:38 -0400)
tests/parameter_handler/parameter_handler_backslash_03.cc
tests/parameter_handler/parameter_handler_backslash_03.output
tests/parameter_handler/parameter_handler_backslash_04.cc
tests/parameter_handler/parameter_handler_backslash_04.output
tests/parameter_handler/parameter_handler_backslash_05.cc
tests/parameter_handler/parameter_handler_backslash_05.output

index d5940b4c860d71fae4fcff27b2f73dc526005b43..02e659a4f0b602f1b2ec68f0bf75a1e3dcd19b20 100644 (file)
 #include <deal.II/base/parameter_handler.h>
 #include <fstream>
 
+// header for chdir is platform dependent; when the day comes that we support
+// Windows in the test suite then conditionally include direction.h
+#include <unistd.h>
+
 /*
  * 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);
             }
 
index 628cd7340f97fa1dea7d4ec9dc244a6e129c0f73..ba4652df99bab3b3513165ac8e155f335b192225 100644 (file)
@@ -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 <prm/parameter_handler_backslash_03.prm>:
     The entry value
         a,\
     for the entry named
index b70e3fa54982981f5584a2d0d3b11c0ba7ad2438..750c04c2012899fbad3c54d9483efb253bc3af7d 100644 (file)
@@ -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);
             }
 
index d7d35ebd050968042bf69608f6deb0a3807c1037..a01be39b9dfcc2c4769675e9589f69233f4bfc07 100644 (file)
@@ -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 <prm/parameter_handler_backslash_04.prm>:
     The entry value
         a,\ b,
     for the entry named
index 15259f93c1b28e1655bd723e6bb28665734a925b..6bdba4c7e9f7f6f604f1fe265a03c290817baee2 100644 (file)
@@ -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);
             }
 
index 8987a2ec67a3d17a89ca507de4040559136d6100..b5cf2c2dbdf4870e2d61e5b968a7ae935953dbff 100644 (file)
@@ -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 <prm/parameter_handler_backslash_05.prm>: The line
 
         <b, c>
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.