diff --git a/testsuite/drivers/base_driver.py b/testsuite/drivers/base_driver.py index ec70921a9..8d461e9c9 100644 --- a/testsuite/drivers/base_driver.py +++ b/testsuite/drivers/base_driver.py @@ -118,12 +118,6 @@ def output_refiners(self): if self.test_env.get("canonicalize_directory_separators", False): result.append(Substitute("\\", "/")) - # If requested, replace occurences of the working directory - if self.test_env.get("canonicalize_working_dir", False): - result.append( - Substitute(self.working_dir(), "[working-dir]") - ) - return result @property diff --git a/testsuite/tests/prep/errors/main.adb b/testsuite/tests/prep/errors/main.adb index 6884e66a6..327a3e461 100644 --- a/testsuite/tests/prep/errors/main.adb +++ b/testsuite/tests/prep/errors/main.adb @@ -26,7 +26,24 @@ procedure Main is New_Line; if U.Has_Diagnostics then for D of U.Diagnostics loop - Put_Line (U.Format_GNU_Diagnostic (D)); + + -- Remove absolute paths from error messages to have consistent + -- baselines. + + declare + Msg : constant String := U.Format_GNU_Diagnostic (D); + Prefix : constant String := + "no_such_file.adb: Cannot open "; + begin + if Msg'Length > Prefix'Length + and then Msg (Msg'First .. Msg'First + Prefix'Length - 1) + = Prefix + then + Put_Line (Prefix & "[...]"); + else + Put_Line (Msg); + end if; + end; end loop; New_Line; end if; diff --git a/testsuite/tests/prep/errors/test.out b/testsuite/tests/prep/errors/test.out index 7c8dfe3c6..6176734d8 100644 --- a/testsuite/tests/prep/errors/test.out +++ b/testsuite/tests/prep/errors/test.out @@ -13,7 +13,7 @@ PragmaNodeList[1:1-1:19] == no_such_file.adb == -no_such_file.adb: Cannot open [working-dir]/no_such_file.adb +no_such_file.adb: Cannot open [...] CompilationUnitList[1:1-1:1]: diff --git a/testsuite/tests/prep/errors/test.yaml b/testsuite/tests/prep/errors/test.yaml index 81e0c307a..e13858de8 100644 --- a/testsuite/tests/prep/errors/test.yaml +++ b/testsuite/tests/prep/errors/test.yaml @@ -1,5 +1,4 @@ driver: ada-api main: main.adb -canonicalize_working_dir: true control: - [XFAIL, "valgrind", "Pending resolution of eng/gpr/gpr-issues#43"]