1
0
mirror of https://github.com/mirror/make.git synced 2025-04-08 18:41:28 +08:00

* tests/run_make_tests.pl: Create $scriptsuffix for Windows/VMS.

* tests/scripts/features/targetvars: Add a suffix to scripts.
* tests/scripts/misc/general4: Ditto.
This commit is contained in:
Paul Smith 2019-09-15 16:39:22 -04:00
parent 414af96a50
commit 4c64a5f986
3 changed files with 37 additions and 28 deletions
tests

View File

@ -440,6 +440,13 @@ sub set_defaults
$testee = "GNU make";
$make_path = "make";
$tmpfilesuffix = "mk";
if ($port_type eq 'UNIX') {
$scriptsuffix = '.sh';
} elsif ($port_type eq 'VMS') {
$scriptsuffix = '.com';
} else {
$scriptsuffix = '.bat';
}
}
# This is no longer used: we import config-flags.pm instead

View File

@ -256,29 +256,29 @@ a: ; @echo $(A)
'', "hello; world\n");
# TEST #21: SV-56834 Ensure setting PATH in a target var works properly
mkdir('sd', 0775);
open(my $fh, '>', 'sd/foobar');
print $fh "exit 0";
close($fh);
chmod 0755, 'sd/foobar';
my $sname = "foobar$scriptsuffix";
run_make_test(q!
mkdir('sd', 0775);
create_file("sd/$sname", "exit 0\n");
chmod 0755, "sd/$sname";
run_make_test(qq!
all: PATH := sd
all: ; foobar
all: ; $sname >/dev/null
!,
'', "foobar\n");
'', "$sname >/dev/null\n");
# Don't use the general PATH if not found on the target path
$extraENV{PATH} = "$ENV{PATH}:sd";
run_make_test(q!
run_make_test(qq!
all: PATH := ..
all: ; foobar
all: ; $sname
!,
'', "foobar\n#MAKE#: foobar: $ERR_no_such_file\n#MAKE#: *** [#MAKEFILE#;3: all] Error 127", 512);
'', "$sname\n#MAKE#: $sname: $ERR_no_such_file\n#MAKE#: *** [#MAKEFILE#;3: all] Error 127", 512);
unlink('sd/foobar');
unlink("sd/$sname");
rmdir ('sd');
# TEST #19: Test define/endef variables as target-specific vars

View File

@ -80,40 +80,42 @@ all: ; \@echo hi
'', "hi\n");
# SV-56834 Ensure setting PATH in the makefile works properly
mkdir('sd', 0775);
create_file('sd/foobar', "exit 0\n");
chmod 0755, 'sd/foobar';
my $sname = "foobar$scriptsuffix";
run_make_test(q!
mkdir('sd', 0775);
create_file("sd/$sname", "exit 0\n");
chmod 0755, "sd/$sname";
run_make_test(qq!
PATH := sd
all: ; foobar
all: ; $sname >/dev/null
!,
'', "foobar\n");
'', "$sname >/dev/null\n");
# Don't use the general PATH if not found on the target path
$extraENV{PATH} = "$ENV{PATH}:sd";
run_make_test(q!
run_make_test(qq!
PATH := ..
all: ; foobar
all: ; $sname
!,
'', "foobar\n#MAKE#: foobar: $ERR_no_such_file\n#MAKE#: *** [#MAKEFILE#;3: all] Error 127", 512);
'', "$sname\n#MAKE#: $sname: $ERR_no_such_file\n#MAKE#: *** [#MAKEFILE#;3: all] Error 127", 512);
unlink('sd/foobar');
unlink("sd/$sname");
rmdir('sd');
# Ensure that local programs are not found if "." is not on the PATH
create_file('foobar', "exit 0\n");
chmod 0755, 'foobar';
create_file($sname, '');
chmod 0755, $sname;
run_make_test(q!
run_make_test(qq!
PATH := ..
all: ; foobar
all: ; $sname
!,
'', "foobar\n#MAKE#: foobar: $ERR_no_such_file\n#MAKE#: *** [#MAKEFILE#;3: all] Error 127", 512);
'', "$sname\n#MAKE#: $sname: $ERR_no_such_file\n#MAKE#: *** [#MAKEFILE#;3: all] Error 127", 512);
unlink('foobar');
unlink($sname);
1;