Skip to content

Commit

Permalink
Merge branch 'pmderodat/abspath_baseline' into 'master'
Browse files Browse the repository at this point in the history
prep/errors: fix absolute paths handling issues on Windows

See merge request eng/libadalang/libadalang!1457
  • Loading branch information
pmderodat committed Nov 8, 2023
2 parents 7a847f2 + cb00208 commit f4bf898
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
6 changes: 0 additions & 6 deletions testsuite/drivers/base_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 18 additions & 1 deletion testsuite/tests/prep/errors/main.adb
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/prep/errors/test.out
Original file line number Diff line number Diff line change
Expand Up @@ -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]: <empty list>

Expand Down
1 change: 0 additions & 1 deletion testsuite/tests/prep/errors/test.yaml
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit f4bf898

Please sign in to comment.