mirror of
https://github.com/mirror/make.git
synced 2025-01-30 14:20:14 +08:00
a581146562
Strawberry Perl has some different behaviors from ActiveState Perl which impact the test suite: - Avoid Perl's chomp() as it may not remove CRs; chomp() may remove only the final NL but not the CR in a CRNL line ending. - Strawberry Perl doesn't support ActiveState's system(1, ...) form. - Strawberry Perl (or msys?) does something weird with "/tmp" when provided to exec(), replacing it with the user's %TEMP%. - Strawberry Perl uses msys paths like /c/foo instead of C:\foo. * tests/test_driver.pl (get_osname): Strawberry Perl uses 'msys' as its $^O so if we see that use a port of 'W32'. (_run_with_timeout): Strawberry Perl doesn't support the special system(1, ...) form of system() so use POSIX standard fork/exec. (compare_answer): Paths generated by Strawberry Perl use msys path format (e.g., /c/foo instead of C:\foo); check for those differences and compare RE against both the unmodified and modified log. * tests/run_make_tests.pl (set_defaults): Switch from chomp to s/// to remove CRNL and NL line endings. * tests/scripts/features/errors: Executing directories on Strawberry will give an error; translate it to Windows error output format. * tests/scripts/features/output-sync: Ditto. * tests/scripts/features/temp_stdin: Ditto. * tests/scripts/functions/realpath: Ditto. * tests/scripts/options/dash-I: Ditto. * tests/scripts/variables/INCLUDE_DIRS: Ditto. * tests/scripts/misc/close_stdout: /dev/full is reported as existing on Strawberry Perl, but it doesn't do anything. Skip the test. * tests/scripts/variables/MAKEFLAGS: When an argument containing /tmp is passed to a program via exec(), something replaces it with the expansion of the %TEMP% variable. Instead of using /tmp create a local directory to use.
95 lines
1.9 KiB
Perl
95 lines
1.9 KiB
Perl
# -*-perl-*-
|
|
$description = "Test the .INCLUDE_DIRS special variable.";
|
|
|
|
$details = "";
|
|
|
|
use Cwd;
|
|
|
|
$dir = cwd;
|
|
$dir =~ s,.*/([^/]+)$,../$1,;
|
|
|
|
if (-d '/usr/include') {
|
|
# Test #1: The content of .INCLUDE_DIRS depends on the platform for which
|
|
# make was built. What we know for sure is that it shouldn't be
|
|
# empty.
|
|
#
|
|
run_make_test('
|
|
ifeq ($(.INCLUDE_DIRS),)
|
|
$(warning .INCLUDE_DIRS is empty)
|
|
endif
|
|
|
|
.PHONY: all
|
|
all:;@:
|
|
',
|
|
'', '');
|
|
}
|
|
|
|
# Test #2: Make sure -I paths end up in .INCLUDE_DIRS.
|
|
#
|
|
run_make_test('
|
|
ifeq ($(dir),)
|
|
$(warning dir is empty)
|
|
endif
|
|
|
|
ifeq ($(filter $(dir),$(.INCLUDE_DIRS)),)
|
|
$(warning .INCLUDE_DIRS does not contain $(dir): $(.INCLUDE_DIRS))
|
|
endif
|
|
|
|
.PHONY: all
|
|
all:;@:
|
|
',
|
|
"-I$dir dir=$dir", '');
|
|
|
|
# Find the default .INCLUDE_DIRS
|
|
create_file('defaultdirs.mk', "\$(info \$(.INCLUDE_DIRS))\nall:;\@:\n");
|
|
my $cmd = subst_make_string("#MAKEPATH# -f defaultdirs.mk");
|
|
my @dirs = `$cmd`;
|
|
my $dirs = $dirs[0];
|
|
$dirs =~ s/\r?\n//g;
|
|
unlink('defaultdirs.mk');
|
|
|
|
run_make_test("
|
|
ifneq (\$(.INCLUDE_DIRS),$dirs)
|
|
\$(warning Mismatched \$(.INCLUDE_DIRS) != $dirs)
|
|
endif
|
|
all:;\@:
|
|
",
|
|
'', '');
|
|
|
|
# Verify that -I- disables content from .INCLUDE_DIRS
|
|
|
|
run_make_test(q/
|
|
ifneq ($(.INCLUDE_DIRS),)
|
|
$(warning Mismatched $(.INCLUDE_DIRS) != )
|
|
endif
|
|
all:;@:
|
|
/,
|
|
'-I-', '');
|
|
|
|
# Prefix -I dirs to the front
|
|
mkdir('somedir', 0777);
|
|
|
|
my $xdirs = $dirs ? " $dirs" : '';
|
|
run_make_test("
|
|
ifneq (\$(.INCLUDE_DIRS),somedir$xdirs)
|
|
\$(warning Mismatched '\$(.INCLUDE_DIRS)' != 'somedir$xdirs')
|
|
endif
|
|
all:;\@:
|
|
",
|
|
'-I somedir', '');
|
|
|
|
# Verify .INCLUDE_DIRS contains files after -I-
|
|
|
|
run_make_test(q/
|
|
ifneq ($(.INCLUDE_DIRS),somedir)
|
|
$(warning Mismatched $(.INCLUDE_DIRS) != somedir)
|
|
endif
|
|
all:;@:
|
|
/,
|
|
'-I - -I somedir', '');
|
|
|
|
rmdir('somedir');
|
|
|
|
# This tells the test driver that the perl test script executed properly.
|
|
1;
|