Commit graph

31 commits

Author SHA1 Message Date
Paul Smith
4c64a5f986 * tests/run_make_tests.pl: Create $scriptsuffix for Windows/VMS.
* tests/scripts/features/targetvars: Add a suffix to scripts.
* tests/scripts/misc/general4: Ditto.
2019-09-16 08:25:33 -04:00
Paul Smith
414af96a50 Refresh the test suite framework implementation.
Go through both run_make_tests.pl and test_driver.pl and slightly
modernize the Perl and clean up indentation etc.  Fix a number of
warnings in the test scripts detected by running with -w.

* tests/test_driver.pl: Move make error string detection out of the
base test driver.
(run_all_tests): Ensure that we always look for tests in the cwd.
* tests/run_make_tests.pl: Use File::Spec for path manipulations.
Correctly use setlocale() when detecting error strings.
Get configuration from the config-flags.pm file not config.status.
* tests/scripts/features/archives: Use new $cwddir variable.
* tests/scripts/features/reinvoke: Add missing semicolon.
* tests/scripts/features/vpath2: Avoid non-existent variable.
* tests/scripts/functions/foreach: Escape variables.
* tests/scripts/misc/bs-nl: Remove non-existing \v escape sequence.
* tests/scripts/misc/general4: Use handy create_file().
* tests/scripts/options/dash-C: Use Cwd/$cwddir.
* tests/scripts/options/dash-I: Use subst_make_string() and #PWD#.
* tests/scripts/options/symlinks: Use File::Spec.
* tests/scripts/targets/DEFAULT: Use create_file and run_make_test.
* tests/scripts/variables/CURDIR: Use run_make_test.
* tests/scripts/variables/automatic: Remove extraneous "\".
* tests/scripts/vms/library: Remove extra "my" and extraneous "\".
2019-09-16 08:25:33 -04:00
Paul Smith
60905a8afb [SV 56834] Support local PATH search with posix_spawnp
When using exec we install the child's environment before invoking
execlp(), so commands are found on the child's PATH.  posix_spawnp
searches on the parent's PATH, which we don't want.

Import gnulib's findprog-in module and use it to search the child's
PATH, then use posix_spawn() to run it.

Also, posix_spawn() does not fall back to trying sh on ENOEXEC, as
execlp() does, so implement that as well.

* bootstrap.conf: Add the findprog-in gnulib module
* src/job.c: Include findprog.h if we're using posix_spawn.
(start_job_command): Remove the handling of child->cmd_name,
(child_execute_job): and add it here.  Look up the command to be
run in the child's path and invoke it if found.  If it fails with
ENOEXEC then retry it as an argument to the default shell.
* tests/scripts/misc/general4: Test makefile PATH assignments.
* tests/scripts/features/targetvars: Ditto, for target variables.
2019-09-08 15:12:40 -04:00
Paul Smith
39bf50b2da * tests/scripts/misc/general3: Add more tests for SHELL/.SHELLFLAGS 2019-08-26 07:54:09 -04:00
Paul Smith
c808f10d08 Update regression tests for Windows.
* tests/scripts/features/jobserver: Windows doesn't use pipes
* tests/scripts/functions/shell: Don't test kill -2 on Windows
* tests/scripts/misc/bs-nl: Windows doesn't handle single quotes
* tests/scripts/misc/general3: Ditto.
2018-07-02 07:54:07 -04:00
Paul Smith
6264deece3 * job.c (child_error): Modify error message string.
Ensure Emacs compile-mode's next-error doesn't match target failure
messages.  Syntax errors in makefiles are still matched.
2017-10-30 17:07:21 -04:00
Paul Smith
fda00f88d3 Add test suite support to Windows
* 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.
2017-06-04 18:37:20 -04:00
Paul Smith
e97159745d [SV 46995] Strip leading/trailing space from variable names
* makeint.h: Change MAP_SPACE to MAP_NEWLINE, and add MAP_PATHSEP
and MAP_SPACE which is now MAP_BLANK|MAP_NEWLINE.  Create
NEW_TOKEN(), END_OF_TOKEN(), ISBLANK(), ISSPACE() macros.
* main.c (initialize_stopchar_map): Set MAP_NEWLINE only for
newline characters.
* Convert all uses of isblank() and isspace() to macros.
* Examine all uses of isblank() (doesn't accept newlines) and
change them wherever possible to ISSPACE() (does accept newlines).
* function.c (func_foreach): Strip leading/trailing space.
* variable.c (parse_variable_definition): Clean up.
* tests/scripts/functions/foreach: Test settings and errors.
* tests/scripts/functions/call: Rewrite to new-style.
* tests/scripts/misc/bs-nl: Add many more tests for newlines.
2016-03-23 01:25:51 -04:00
Paul Smith
b4682cb479 * job.c (child_error): Combine file info with error message.
* tests/scripts/...: Update error message matches.
2016-03-20 14:23:22 -04:00
Paul Smith
c18b23f7b2 * tests/scripts/misc/fopen-fail: [SV 42390] Increase test timeout.
* Makefile.am (check-regression): Force ulimit -n for fopen-fail test.
2015-07-12 18:19:01 -04:00
Paul Smith
9d58570c77 * makeint.h (STOP_SET): [SV 40371] Cast to unsigned char.
* tests/scripts/misc/utf8: Test variable names with characters >127.
Fix suggested by Robert Bogomip <bob.bogo@milohedge.com>
2013-10-27 17:43:21 -04:00
Paul Smith
1b90248893 [SV 27374] Fatal immediately on unrecoverable fopen() errors. 2013-09-15 17:09:01 -04:00
Paul Smith
c11024b3b3 [SV #38945] Copy the entire buffer back when overwriting CR 2013-05-26 14:41:45 -04:00
Paul Smith
bf60bbd67a [SV #39035] Compare OUT to the beginning of the OUT var/func, not IN. 2013-05-26 13:56:51 -04:00
Paul Smith
23c2b99e9d Convert all "`'" quotes to "''" per new GNU Coding Standard guidelines.
Fixes Savannah bug #34530.
2012-03-04 00:24:20 +00:00
Paul Smith
88f1bc8b55 Modify backslash/newline handling for POSIX.
We fixed Savannah 16670 but that broke previously-working makefiles
that relied on the GNU make behavior.  The POSIX behavior doesn't
seem to me to be better, and can be obtained using GNU make as well,
so put it back as the default behavior and require .POSIX to
get the POSIX behavior.
Add a new section to the manual discussing backslash/newline handling.
Update the test suite.
2012-03-03 18:45:08 +00:00
Paul Smith
391456aad7 Improve backslash/newline handling to adhere to POSIX requirements. 2010-11-06 21:56:23 +00:00
Paul Smith
c8840352ac - Fix Savannah bug #19108
- Fix Savannah bug #17752
- Test suite:
  * When tests fail keep a "run" file containing the command invoked.
  * Support for the Valgrind "memcheck" and "massif" tools.
2009-06-10 02:21:09 +00:00
Paul Smith
71385e1225 - Add forgotten variable/define test suite
- Skip initial whitespace including formfeeds, vertical tab, etc.
- Add tests for that
- Fix the variable/SHELL test; it was wrong!
2009-06-05 01:17:29 +00:00
Paul Smith
43d81ff866 New special variable: .RECIPEPREFIX
Allows the user to reset the prefix character for introducing recipe lines
from the default (tab) to any other single character, and back again.
Also, reworked the manual to consistently use the word "recipe" to describe
the set of commands we use to update a target, instead of the various
phrases used in the past: "commands", "command lines", "command scripts",
etc.
2007-11-04 21:54:00 +00:00
Paul Smith
3bcb608bda Extend .SECONDEXPANSION to implicit rules. Final fix for bug #13781. 2005-12-11 15:41:17 +00:00
Paul Smith
82103b1a49 Fix a crash I introduced last-minute.
Try to avoid extraneous rebuilds of template files.
2005-10-26 16:06:30 +00:00
Paul Smith
11095a90f1 Make second expansion optional (partial implementation).
I decided this feature was too impacting to make the permanent default
behavior.  This set of changes makes the default behavior of make the
old behavior (no second expansion).  If you want second expansion, you
must define the .SECONDEXPANSION: special target before the first target
that needs it.

This set of changes ONLY fixes explicit and static pattern rules to work
like this.  Implicit rules still have second expansion enabled all the
time: I'll work on that next.

Note that there is still a backward-incompatibility: now to get the old
SysV behavior using $$@ etc. in the prerequisites list you need to set
.SECONDEXPANSION: as well.
2005-10-24 13:01:39 +00:00
Paul Smith
d6a7894d3a Fix Savannah bug # 1332: handle backslash-newline pairs in command scripts
according to POSIX rules.
2005-06-26 03:31:29 +00:00
Paul Smith
6cdaff0948 Fix Savannah bug #1454: skip over semicolons (and comments) inside variable
references in target definition lines.
2005-06-25 21:30:13 +00:00
Paul Smith
467115baae Fix Savannah bug # 1328: if stdout is redirected to a full filesystem, we
check for this and exit with an error.
The closeout.c version from gnulib pulls in too much other stuff, and
gnulib requires an ANSI C 89 compliant compiler, while GNU make (so far)
still wants to work on K&R.
2005-06-12 22:22:07 +00:00
Paul Smith
d2516343bc * New feature: -L option
* New function: $(info ...)
* Disallow $(eval ...) to create prereq relationships inside command scripts
  (caused core dumps)
* Try to allow more tests to succeed in Windows/DOS by sanitizing CRLF and \
* Various bug fixes and code cleanups (see the ChangeLog entry)
2005-02-28 07:48:22 +00:00
Boris Kolpackov
659fc6b55e Implementation of the second expansion in explicit
rules, static pattern rules and implicit rules.
2005-02-27 21:40:23 +00:00
Paul Smith
988deb489b Fix for complex situations where directories are declared as prerequisites.
Info on this fix from barkalow@reputation.com: thanks!

Some updates/cleanups of some of the tests; added a forgotten -t test, etc.
2002-09-04 07:26:19 +00:00
Paul Smith
f2ceb0d68a Incorporate some VMS fixes.
Add -B option docs.
Add .VARIABLES variable.
Add a few new tests.
Add a new translation: Swedish
2002-08-08 00:11:19 +00:00
Paul Smith
0d366b6682 * Added the test suite to the main distribution. 1999-09-14 02:03:19 +00:00