Skip to content

Commit

Permalink
Merge branch 'mr/backport/release-25.1-issue-eng/ide/libadalang-tools…
Browse files Browse the repository at this point in the history
…_200' into '25.1'

[25.1] Backport of eng/ide/libadalang-tools#200

See merge request eng/ide/libadalang-tools!280
  • Loading branch information
leocreuse committed Dec 16, 2024
2 parents f001c31 + 05ecf93 commit f30321f
Show file tree
Hide file tree
Showing 14 changed files with 90 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/test-actions.adb
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,14 @@ package body Test.Actions is
Test.Common.Verbose := Arg (Cmd, Verbose);
Test.Common.Quiet := Arg (Cmd, Quiet);

-- If the tool project is an aggregate one, exit early and do nothing.
-- The aggregated projects will be processed in sequence in subprocess
-- calls made by the driver.

if Tool.Project_Tree.Root_Project.Is_Aggregate_Project then
return;
end if;

Test.Common.Instrument := Arg (Cmd, Dump_Test_Inputs);

if Arg (Cmd, Passed_Tests) /= null then
Expand Down Expand Up @@ -1007,6 +1015,14 @@ package body Test.Actions is
Tool.Project_Tree.Root_Project.Project_Path.Display_Full_Name;
begin

-- If the tool project is an aggregate one, exit early and do nothing.
-- The aggregated projects will be processed in sequence in subprocess
-- calls made by the driver.

if Tool.Project_Tree.Root_Project.Is_Aggregate_Project then
return;
end if;

-- In any case, generate the support library if needed

if Test.Common.Get_Lib_Support_Status in Test.Common.Needed then
Expand Down
6 changes: 6 additions & 0 deletions testsuite/tests/test/200-aggregates/dep.gpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
project Dep is

for Object_Dir use "obj_dep";
for Source_Dirs use ("src_dep");

end Dep;
3 changes: 3 additions & 0 deletions testsuite/tests/test/200-aggregates/prj.gpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
aggregate project Prj is
for Project_Files use ("prj1.gpr", "prj2.gpr");
end Prj;
8 changes: 8 additions & 0 deletions testsuite/tests/test/200-aggregates/prj1.gpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
with "dep.gpr";

project Prj1 is

for Object_Dir use "obj1";
for Source_Dirs use ("src1");

end Prj1;
8 changes: 8 additions & 0 deletions testsuite/tests/test/200-aggregates/prj2.gpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
with "dep.gpr";

project Prj2 is

for Object_Dir use "obj2";
for Source_Dirs use ("src2");

end Prj2;
7 changes: 7 additions & 0 deletions testsuite/tests/test/200-aggregates/src1/pkg.adb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
with Dep;

package body Pkg is

function Foo (X : Integer) return Integer is (Dep.Baz (X));

end Pkg;
5 changes: 5 additions & 0 deletions testsuite/tests/test/200-aggregates/src1/pkg.ads
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package Pkg is

function Foo (X : Integer) return Integer;

end Pkg;
7 changes: 7 additions & 0 deletions testsuite/tests/test/200-aggregates/src2/pkh.adb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
with Dep;

package body Pkh is

function Bar (X : Integer) return Integer is (Dep.Baz (X));

end Pkh;
5 changes: 5 additions & 0 deletions testsuite/tests/test/200-aggregates/src2/pkh.ads
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package Pkh is

function Bar (X : Integer) return Integer;

end Pkh;
5 changes: 5 additions & 0 deletions testsuite/tests/test/200-aggregates/src_dep/dep.adb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package body Dep is

function Baz (X : Integer) return Integer is (X);

end Dep;
5 changes: 5 additions & 0 deletions testsuite/tests/test/200-aggregates/src_dep/dep.ads
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package Dep is

function Baz (X : Integer) return Integer;

end Dep;
Empty file.
10 changes: 10 additions & 0 deletions testsuite/tests/test/200-aggregates/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#! /bin/bash

# First, run gnattest in stub mode, with tests placed in source subdirectories,
# and stubs in the object dir of the stubbed project.
gnattest -P prj.gpr --stub --subdirs=test --stubs-dir=stub -q

# The build both test driver aggregate projects, to ensure the generated
# harnesses are valid.
gprbuild -q obj1/gnattest_stub/harness/test_drivers.gpr
gprbuild -q obj2/gnattest_stub/harness/test_drivers.gpr
5 changes: 5 additions & 0 deletions testsuite/tests/test/200-aggregates/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
description:
Test that gnattest does not crash when processing an aggregate project,
and that they are processed in sequence, producing two valid harnesses.

driver: shell_script

0 comments on commit f30321f

Please sign in to comment.