patch out of source builds

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

patch out of source builds

Gnu - Make - Bugs mailing list
Good morning.

This patch makes the test suite look for config.status in the -make_path
directory to allow testing out of source builds.

regards, Dmitry

diff --git a/tests/README b/tests/README
index 0cb7eac..5ecf392 100644
--- a/tests/README
+++ b/tests/README
@@ -82,12 +82,9 @@ ChangeLog in the tests directory for pointers.

 The second serious problem is that it's not parallelizable: it scribbles
 all over its installation directory and so can only test one make at a
-time.  The third serious problem is that it's not relocatable: the only
-way it works when you build out of the source tree is to create
-symlinks, which doesn't work on every system and is bogus to boot.  The
-fourth serious problem is that it doesn't create its own sandbox when
-running tests, so that if a test forgets to clean up after itself that
-can impact future tests.
+time. The third serious problem is that it doesn't create its own
+sandbox when running tests, so that if a test forgets to clean up after
+itself that can impact future tests.


 Bugs
diff --git a/tests/run_make_tests.pl b/tests/run_make_tests.pl
index 7e969a9..437f768 100644
--- a/tests/run_make_tests.pl
+++ b/tests/run_make_tests.pl
@@ -75,12 +75,13 @@ require "test_driver.pl";
 %CONFIG_FLAGS = ();

 my $statnm = "$FindBin::Bin/../config.status";
+my $config_status_errno = "";
 if (open(my $fh, '<', $statnm)) {
     while (my $line = <$fh>) {
         $line =~ m/^[SD]\["([^\"]+)"\]=" *(.*)"/ and $CONFIG_FLAGS{$1} = $2;
     }
 } else {
-    warn "Failed to open $statnm: $!";
+    $config_status_errno = $!;
 }

 # Some target systems might not have the POSIX module...
@@ -98,6 +99,19 @@ sub valid_option
            print "$option $make_path: Not found.\n";
            exit 0;
        }
+       if ($config_status_errno) {
+           my $dir = File::Basename::dirname("$make_path");
+           $statnm = "$dir/config.status";
+           if (open(my $fh, '<', $statnm)) {
+               while (my $line = <$fh>) {
+                   $line =~ m/^[SD]\["([^\"]+)"\]=" *(.*)"/ and
+                                                        $CONFIG_FLAGS{$1} = $2;
+               }
+               $config_status_errno = "";
+           } else {
+               $config_status_errno = $!;
+           }
+       }
        return 1;
    }

@@ -138,6 +152,13 @@ sub valid_option
    return 0;
 }

+sub print_failed_to_open_configstatus
+{
+   if ($config_status_errno) {
+       warn "Failed to open $statnm: $config_status_errno";
+   }
+}
+

 # This is an "all-in-one" function.  Arguments are as follows:
 #
diff --git a/tests/test_driver.pl b/tests/test_driver.pl
index 4af84da..e1235ca 100644
--- a/tests/test_driver.pl
+++ b/tests/test_driver.pl
@@ -516,6 +516,7 @@ sub parse_command_line
       push(@TESTS,$option);
     }
   }
+  &print_failed_to_open_configstatus;
 }

 sub max

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|

Re: patch out of source builds

Eli Zaretskii
> Date: Fri, 13 Sep 2019 21:40:49 -0400
> From: Dmitry Goncharov via Bug reports and discussion for GNU  make <[hidden email]>
>
> This patch makes the test suite look for config.status in the -make_path
> directory to allow testing out of source builds.

Thanks, but I don't think relying on config_status is good enough,
because some builds don't have it.  For example, what happens when
Make is built using build.sh?  And on MS-Windows the _only_ supported
build method is by using a script similar to build.sh.

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|

Re: patch out of source builds

Gnu - Make - Bugs mailing list
On Sat, Sep 14, 2019 at 10:19:56AM +0300, Eli Zaretskii wrote:
> > This patch makes the test suite look for config.status in the -make_path
> > directory to allow testing out of source builds.
>
> Thanks, but I don't think relying on config_status is good enough,
> because some builds don't have it.  For example, what happens when
> Make is built using build.sh?  And on MS-Windows the _only_ supported
> build method is by using a script similar to build.sh.

run_make_tests.pl unconditionally reads config.status from a specific location.
If gmake is built out of source this reading fails.  The patch then looks for
config.status in the -make_path directory.  This will help if you have
config.status in the -make_path directory.  If you don't have config.status in
-make_path directory this won't help and won't hurt.  If you don't have
config.status in -make_path directory it will behave the same as today.



regards, Dmitry


_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|

Re: patch out of source builds

Paul Smith-20
In reply to this post by Gnu - Make - Bugs mailing list
On Fri, 2019-09-13 at 21:40 -0400, Dmitry Goncharov via Bug reports and
discussion for GNU make wrote:
> -The third serious problem is that it's not relocatable: the only
> -way it works when you build out of the source tree is to create
> -symlinks, which doesn't work on every system and is bogus to boot.

To be clear, the "relocatable" problem is not that you can't do this:

  $ cd make-4.2.90
  $ mkdir _bld
  $ (cd _bld && ../configure && make)

Then test like this:

  $ cd tests
  $ ./run_make_tests -make ../_bld/make

I agree your change will make that work so I'll apply something like
it.

Rather, the above comment refers to testing like this:

  $ cd _bld/tests
  $ ./run_make_tests -make ../make

That is, running the tests from within the remote build directory
"tests", not from within the source directory "tests".


_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|

Re: patch out of source builds

Gnu - Make - Bugs mailing list
On Sat, Sep 14, 2019 at 6:39 PM Paul Smith <[hidden email]> wrote:
> Rather, the above comment refers to testing like this:
...
> That is, running the tests from within the remote build directory
> "tests", not from within the source directory "tests".

Thank you. This indeed clarifies it. The purpose of the patch was to
help testing out of source builds.

regards, Dmitry

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make