File tree Expand file tree Collapse file tree 9 files changed +76
-0
lines changed
testsuite/tests/test/254-subdir-regeneration Expand file tree Collapse file tree 9 files changed +76
-0
lines changed Original file line number Diff line number Diff line change @@ -514,6 +514,31 @@ package body Test.Actions is
514514
515515 end if ;
516516
517+ -- Forbid specifying a test subdir along with a source directoy path
518+ -- ending with "**".
519+ -- Upon running gnattest twice in a row, the subdirs created during the
520+ -- first run will be taken as source directories during the second,
521+ -- leading to an error.
522+
523+ if (Root_Prj.Has_Attribute (Subdir_Mode_Att)
524+ or else Arg (Cmd, Subdirs) /= null )
525+ and then Root_Prj.Has_Attribute (Source_Dirs_Attribute)
526+ then
527+ for Src_Dir_Path
528+ of Root_Prj.Attribute_Value (Source_Dirs_Attribute).all
529+ loop
530+ if Src_Dir_Path'Length >= 2
531+ and then Src_Dir_Path
532+ (Src_Dir_Path'Last - 1 .. Src_Dir_Path'Last)
533+ = " **"
534+ then
535+ Cmd_Error_No_Help
536+ (" cannot specify test subdir along with a source directory"
537+ & " path ending with "" **"" " );
538+ end if ;
539+ end loop ;
540+ end if ;
541+
517542 if Arg (Cmd, Stubs_Dir) /= null then
518543
519544 Free (Test.Common.Stub_Dir_Name);
Original file line number Diff line number Diff line change 1+ with Ada.Text_IO ; use Ada.Text_IO;
2+
3+ with Pkg ;
4+
5+ procedure Main is
6+ begin
7+ Put_Line (Pkg.Foo);
8+ end Main ;
Original file line number Diff line number Diff line change 1+ package body Pkg is
2+ function Foo return String is
3+ begin
4+ return " Foo" ;
5+ end Foo ;
6+ end Pkg ;
Original file line number Diff line number Diff line change 1+ package Pkg is
2+ function Foo return String;
3+ end Pkg ;
Original file line number Diff line number Diff line change 1+ gnattest: cannot specify test subdir along with a source directory path ending with "**"
2+ gnattest: cannot specify test subdir along with a source directory path ending with "**"
3+ >>>program returned status code 1
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ gnattest -q -P test1.gpr
4+ gnattest -q -P test2.gpr --subdirs=" my_tests"
Original file line number Diff line number Diff line change 1+ description :
2+ An error message should be emitted when a test subdir name is specified
3+ (either throught --subdir or the Subdir gnattest project attribute) along
4+ with a source directory path ending in "**" in the project file.
5+ This is to avoid gnattest seeing a previouly generated test subdirectory
6+ as a source directory when ran twice in row.
7+
8+ driver : shell_script
9+
Original file line number Diff line number Diff line change 1+ project Test1 is
2+
3+ for Languages use ("Ada");
4+ for Source_Dirs use ("src" & "/**");
5+ for Object_Dir use "obj";
6+
7+ package GNATtest is
8+ for Subdir use "my_tests";
9+ end GNATtest;
10+
11+ end Test1;
Original file line number Diff line number Diff line change 1+ project Test2 is
2+
3+ for Languages use ("Ada");
4+ for Source_Dirs use ("src" & "/**");
5+ for Object_Dir use "obj";
6+
7+ end Test2;
You can’t perform that action at this time.
0 commit comments