Commit graph

9 commits

Author SHA1 Message Date
Paul Smith
fa937343f5 Clean up errors for invalid commands and add regression tests.
* src/function.c (func_shell_base): Use error() instead of recreating
the error output.
* src/job.c (exec_command): Show more standard error messages.
* src/load.c (unload_file): Fix whitespace in the error message.
* tests/scripts/features/errors: Add tests for starting non-
existent commands and new error message formats.
* tests/scripts/features/output-sync: New error message formats.
* tests/scripts/functions/shell: Ditto.
2018-08-04 12:37:19 -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
75b5268faf * function.c (shell_completed): [SV 51014] Add signal to .SHELLSTATUS
* tests/scripts/functions/shell: Verify that .SHELLSTATUS contains
a non-0 value when the shell exits due to a signal.
2017-07-01 19:40: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
c6966b3238 [SV 20513] Un-escaped # are not comments in function invocations
* NEWS: Document the change, as a backward-incompatible change.
* main.c (main): Add 'nocomment' to the .FEATURES variable.
* read.c (remove_comments): Skip variable references during remove.
(find_char_unquote): Fix comments for new STOPMAP support.
* tests/scripts/features/escape: Test new escape syntax.
* tests/scripts/functions/guile: Ditto.
* tests/scripts/functions/shell: Ditto.
2016-12-26 09:01:59 -05:00
Paul Smith
047bd5a16f [SV 46433] Show recipe line offsets in line number messages.
While displaying line numbers, show the relevant line number inside
the recipe not just the first line of the entire recipe.
Sample changes suggested by Brian Vandenberg <phantall@gmail.com>

* gnumake.h (gmk_floc): Add an 'offset' to track the recipe offset.
* read.c (eval, eval_makefile, eval_buffer): Initialize 'offset'.
(record_files, install_pattern_rule): Ditto.
* job.c (new_job, job_next_command): Update 'offset' based on the
line of the recipe we're expanding or invoking.
(child_error): Add 'offset' when showing the line number.
* function.c (func_shell_base): Ditto.
* output.c (error, fatal): Ditto.
* NEWS: Mention the new ability.
* tests/scripts/features/errors: Check the line number on errors.
* tests/scripts/functions/warning: Check the line number on warnings.
* tests/scripts/features/output-sync,
tests/scripts/features/parallelism, tests/scripts/functions/shell,
tests/scripts/functions/error: Update line numbers.
2016-04-11 07:51:05 -04:00
Paul Smith
43181f1f82 [SV 28092] Preserve the exit status of the $(shell...) function.
Add a new variable .SHELLSTATUS which holds the exit status of the
last-invoked shell function or != assignment.

* NEWS, doc/make.texi: Document the change.
* function.c (shell_completed, msdos_openpipe, func_shell_base): Add
shell_completed() to handle the completion of the shell, by setting
.SHELLSTATUS.  Call it where needed.
* job.c (child_handler): Call shell_completed().
* tests/scripts/functions/shell: Add tests for .SHELLSTATUS.
2015-07-12 21:03:24 -04:00
Paul Smith
f907a4d90c - Update manual description for pattern rule search algorithm
- Add new "-all" flag to the test suite to run tests that don't pass yet
- Add some non-passing tests
- Fix from Andreas Buening for OS/2.
2009-09-28 23:08:49 +00:00
Paul Smith
da1b137e38 Fix strerror() handling for systems which set ANSI_STRING.
Don't print errors if "include" is specified with no arguments.
New test suite for the $(shell ...) function.
2005-06-27 01:01:07 +00:00