From: Paul Smith Date: Sat, 23 Apr 2022 20:30:02 +0000 (-0400) Subject: [SV 62173] Fix archive tests for non-GNU systems X-Git-Tag: 4.3.90~85 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=88ceff8b2f8303706daf0809b5a3e6af7ba4822e;p=thirdparty%2Fmake.git [SV 62173] Fix archive tests for non-GNU systems Original patch from Dmitry Goncharov Fix the ar flags to match the default values in make. If the U option is supported, add it to the end not the beginning, since ARFLAGS now starts with a "-". * tests/test_driver.pl: Add defaults for global variables. (get_osname): Preserve $osname if it's set from $^O * tests/scripts/features/archive: Set the default arflags. If "U" is available add it to the end of the flags. --- diff --git a/tests/scripts/features/archives b/tests/scripts/features/archives index dcd38e5a..d4058119 100644 --- a/tests/scripts/features/archives +++ b/tests/scripts/features/archives @@ -35,16 +35,17 @@ my $ar = get_config('AR') || 'ar'; my $redir = '2>&1'; $redir = '' if $osname eq 'VMS'; -my $arflags = 'rv'; +# This is the value from src/default.c +my $arflags = $ostype eq 'aix' ? '-Xany -rv' : '-rv'; my $arvar = "AR=$ar"; # Newer versions of binutils can be built with --enable-deterministic-archives # which forces all timestamps (among other things) to always be 0, defeating # GNU make's archive support. See if ar supports the U option to disable it. unlink('libxx.a'); -$_ = `$ar U$arflags libxx.a a1.o $redir`; +$_ = `$ar ${arflags}U libxx.a a1.o $redir`; if ($? == 0) { - $arflags = 'Urv'; + $arflags = "${arflags}U"; $arvar = "$arvar ARFLAGS=$arflags"; } diff --git a/tests/test_driver.pl b/tests/test_driver.pl index 5522ac11..fd5a7696 100644 --- a/tests/test_driver.pl +++ b/tests/test_driver.pl @@ -47,6 +47,10 @@ $tests_run = 0; # The number of tests in this category that have passed $tests_passed = 0; +$port_type = undef; +$osname = undef; +$vos = undef; +$pathsep = undef; # Yeesh. This whole test environment is such a hack! $test_passed = 1; @@ -331,6 +335,8 @@ sub get_osname { # Set up an initial value. In perl5 we can do it the easy way. $osname = defined($^O) ? $^O : ''; + $vos = 0; + $pathsep = "/"; # find the type of the port. We do this up front to have a single # point of change if it needs to be tweaked. @@ -366,10 +372,7 @@ sub get_osname $port_type = 'UNIX'; } - if ($osname eq 'VMS') - { - $vos = 0; - $pathsep = "/"; + if ($osname eq 'VMS') { return; } @@ -399,7 +402,7 @@ sub get_osname $vos = 1; $pathsep = ">"; - } else { + } elsif ($osname eq '') { # the following is regrettably gnarly, but it seems to be the only way # to not get ugly error messages if uname can't be found. # Hmmm, BSD/OS 2.0's uname -a is excessively verbose. Let's try it @@ -414,8 +417,6 @@ sub get_osname $osname = "(something posixy)"; } } - $vos = 0; - $pathsep = "/"; } if (! $short_filenames) {