mirror of
https://github.com/mirror/make.git
synced 2025-01-09 20:00:28 +08:00
fda00f88d3
* main.c (main): Sanitize program name detection on Windows. * makeint.h: 'program' is a const string on all platforms now. * tests/run_make_tests.bat: Windows bat file to invoke tests * tests/test_driver.pl: Obtain system-specific error messages. (get_osname): Compute the $port_type here. Add more $osname checks for different Windows Perl ports. (_run_command): Rewrite the timeout capability to work properly with Windows. Don't use Perl fork/exec; instead use system(1,...) which allows a more reliable/proper kill operation. Also, allow options to be given as a list instead of a string, to allow more complex quoting of command-line arguments. * tests/run_make_tests.pl (run_make_with_options): Allow options to be provided as a list in addition to a simple string. (set_more_defaults): Write sample makefiles and run make on them instead of trying to run echo and invoking make with -f-, to avoid relying on shell and echo to get basic configuration values. Also create a $sh_name variable instead of hard-coding /bin/sh. * tests/scripts/features/archives: Skip on Windows. * tests/scripts/features/escape: Use list method for passing options. * tests/scripts/features/include: Use system-specific error messages. * tests/scripts/features/output-sync: "Command not found" errors generate very different / odd output on Windows. This needs to be addressed but for now disable these tests on Windows. * tests/scripts/functions/abspath: Disable on Windows. * tests/scripts/functions/file: Use system-specific error messages. * tests/scripts/functions/shell: "Command not found" errors generate very different / odd output on Windows. This needs to be addressed but for now disable these tests on Windows. * tests/scripts/misc/close_stdout: Disable on Windows. * tests/scripts/options/dash-k: Use system-specific error messages. * tests/scripts/options/dash-l: Disable on Windows. * tests/scripts/options/eval: Use list method for passing options. * tests/scripts/options/general: Skip some non-portable tests. * tests/scripts/targets/ONESHELL: Skip some non-portable tests. * tests/scripts/targets/POSIX: Skip some non-portable tests. * tests/scripts/variables/MAKEFILES: Skip some non-portable tests. * tests/scripts/variables/SHELL: Use a makefile not -f- for testing.
83 lines
2.0 KiB
Perl
83 lines
2.0 KiB
Perl
# -*-mode: perl-*-
|
|
|
|
$description = "Test GNU make's auto-reinvocation feature.";
|
|
|
|
$details = "\
|
|
If the makefile or one it includes can be rebuilt then it is, and make
|
|
is reinvoked. We create a rule to rebuild the makefile from a temp
|
|
file, then touch the temp file to make it newer than the makefile.";
|
|
|
|
$omkfile = $makefile;
|
|
|
|
&utouch(-600, 'incl.mk');
|
|
# For some reason if we don't do this then the test fails for systems
|
|
# with sub-second timestamps, maybe + NFS? Not sure.
|
|
&utouch(-1, 'incl-1.mk');
|
|
|
|
run_make_test('
|
|
all: ; @echo running rules.
|
|
|
|
#MAKEFILE# incl.mk: incl-1.mk
|
|
@echo rebuilding $@
|
|
@echo >> $@
|
|
|
|
include incl.mk',
|
|
'', "rebuilding incl.mk\nrunning rules.\n");
|
|
|
|
# Make sure updating the makefile itself also works
|
|
|
|
&utouch(-600, $omkfile);
|
|
|
|
run_make_test(undef, '', "rebuilding #MAKEFILE#\nrunning rules.\n");
|
|
|
|
&rmfiles('incl.mk', 'incl-1.mk');
|
|
|
|
|
|
# In this test we create an included file that's out-of-date, but then
|
|
# the rule doesn't update it. Make shouldn't re-exec.
|
|
|
|
&utouch(-600, 'b','a');
|
|
#&utouch(-10, 'a');
|
|
&touch('c');
|
|
|
|
run_make_test('
|
|
all: ; @echo hello
|
|
|
|
a : b ; echo >> $@
|
|
|
|
b : c ; [ -f $@ ] || echo >> $@
|
|
|
|
c: ; echo >> $@
|
|
|
|
include $(F)',
|
|
'F=a', "[ -f b ] || echo >> b\nhello\n");
|
|
|
|
# Now try with the file we're not updating being the actual file we're
|
|
# including: this and the previous one test different parts of the code.
|
|
|
|
run_make_test(undef, 'F=b', "[ -f b ] || echo >> b\nhello\n")
|
|
|
|
&rmfiles('a','b','c');
|
|
|
|
# Ensure command line variables are preserved properly across re-exec
|
|
# Tests for Savannah bug #30723
|
|
|
|
run_make_test('
|
|
ifdef RECURSE
|
|
-include foo30723
|
|
endif
|
|
recurse: ; @$(MAKE) -f $(MAKEFILE_LIST) RECURSE=1 test
|
|
test: ; @echo F.O=$(F.O)
|
|
foo30723: ; @touch $@
|
|
',
|
|
'--no-print-directory F.O=bar', "F.O=bar\n");
|
|
|
|
unlink('foo30723');
|
|
|
|
# This tells the test driver that the perl test script executed properly.
|
|
1;
|
|
|
|
### Local Variables:
|
|
### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
|
|
### End:
|