Commit graph

2739 commits

Author SHA1 Message Date
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
1b976397e5 * tests/config-flags.pm.in: Add USE_SYSTEM_GLOB.
* tests/config_flags_pm.com [VMS]: Ditto.
2019-09-16 08:25:33 -04:00
Paul Smith
9bc5491712 * README.git: [SV 56895] Provide more info about "maintainer mode".
* src/read.c (get_next_mword) [HAVE_DOS_PATHS]: Don't fall through to
parsing variable references if we find a drivespec in a word!
2019-09-16 08:25:33 -04:00
Paul Smith
57b13c8020 * tests/test_driver.pl: Remember error for "running" a directory.
* tests/scripts/features/errors: Check errors "running" a directory.
2019-09-16 08:25:33 -04:00
Paul Smith
02a4c2913a * src/job.c (child_execute_job): Use errno from find_in_given_path().
* tests/test_driver.pl: Determine non-executable error message.
* tests/scripts/features/errors: Use the local non-executable error.
2019-09-16 08:25:33 -04:00
Paul Smith
8acb89c8c4 * src/job.c (child_execute_job): Use newer gnulib findprog version. 2019-09-16 08:25:33 -04:00
Eli Zaretskii
271e572ba2 Revert "[SV 56449] (Windows) Use slow path if '%' appears in the command"
This reverts commit 38e96eadea.
Per discussion on Savannah, the modified behavior matches
the way % is handled in batch files, but not in cmd command
lines.  And since Make mostly tries to emulate the command
line, the new behavior is unexpected and backward-incompatible.
2019-09-10 19:09:39 +03:00
Paul Smith
bde990bfea Rework the creation of build.sh so it's not a template.
* build.sh: Rename from build.template.  Get the list of objects
from the Makefile.  Move configure-replaced variables ...
* build.cfg.in: to this new .in file.
* configure.ac: Remove special handling of build.sh.in and add
build.cfg as a generated file.
* Makefile.am (EXTRA_DIST): Remove build.sh.in and add build.sh
and build.cfg.in for build.sh.in.
* maintMakefile: Remove handling for build.template.  Treat
build.sh as a source file, not a generated file.
* .gitignore: Ignore generated build.cfg file.
2019-09-09 18:38:31 -04:00
Paul Smith
60e54608bd * gl/modules/make-glob: Move local glob configure.ac to here
* configure.ac: from here.
2019-09-08 15:17:06 -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
ebe1d37104 * doc/make.texi (Recipe Execution): Correct example to use $(<[DF]) 2019-09-07 20:12:44 -04:00
Paul Smith
c0cb9c8b3d * configure.ac: Check whether struct dirent has a d_type field
* src/dir.c (dir_contents_file_exists_p): Use the autoconf macro
HAVE_STRUCT_DIRENT_D_TYPE rather than relying on the GNU libc-
specific _DIRENT_HAVE_D_TYPE.
* lib/glob.c: Set HAVE_D_TYPE if HAVE_STRUCT_DIRENT_D_TYPE.
2019-09-07 20:12:44 -04:00
Paul Smith
34ee9adaed * src/config.h.W32.template [W32]: Add support for dirent.d_type
* src/w32/include/dirent.h: Add DT_* values for dirent.d_type
(struct dirent): Add d_type
* src/w32/compat/durent.c (readdir): Set dirent.d_type based on
Windows file attributes.
2019-09-07 20:12:44 -04:00
Paul Smith
64f5375fe0 * src/makeint.h: Add typedef for mode_t if !HAVE_UMASK 2019-09-07 20:12:44 -04:00
Paul Smith
da81e0815f * build.template: Rewrite to allow gnulib support. 2019-09-07 20:12:44 -04:00
Paul Smith
9be3c0e2b2 * doc/make.texi: Clarify that the jobserver pipe is "blocking" 2019-09-07 18:27:26 -04:00
Paul Smith
9da708772c Align child_execute_job among different ports
Create a struct childbase which is the basics of struct child needed
to invoke child_execute_job(), and can be cast back and forth to a
struct child.  Ensure all implementations of child_execute_job() take
the same arguments.

* src/job.h (CHILDBASE): Create a macro to hold the base parts.
(struct childbase): A structure containing CHILDBASE.
(struct child): Use CHILDBASE as the initial part of child.
[VMS]: Remove declaration of VMS version of child_execute_job.
* src/job.c (start_job_command): Use new child_execute_job() call.
(child_execute_job) [__EMX__]: Implement new calling signature.
(child_execute_job): Implement new calling signature.
* src/main.c (main) [__EMX__]: Use new child_execute_job() call.
* src/function.c (func_shell_base): Use new child_execute_job() call.
* src/vmsjobs.c (vmsHandleChildTerm): Accept struct childbase.
* src/vmsjobs.c (child_execute_job): Implement new calling signature.
Modify the return value to be pid_t, not a boolean, and return the
PID rather than setting it in the child.  This is OK because our only
caller immediately reset PID to -1 anyway if we return 0.
2019-09-07 18:27:26 -04:00
Paul Smith
0967624050 * doc/make.tex (Substitution Refs): Clarify patsubst relationship. 2019-09-07 18:27:26 -04:00
Paul Smith
ba950a796a * src/job.c (start_job_command) [VMS]: Correct VMS comment. 2019-09-07 18:27:26 -04:00
Paul Smith
005a251689 Show useful errors when posix_spawn() doesn't do so
The posix_spawn() function may not detect that the command to run is
invalid when it's invoked.  Instead, it will run then exit with
error code 127.  If that happens do our best to present the user
with a useful error message.

* src/job.h (struct child): Add cmd_name to hold the command we ran.
* src/job.c (start_job_command): On success, remember the cmd_name.
(reap_children): On exit 127, stat cmd_name and show a useful error.
(free_child): Free cmd_name.
2019-09-07 18:27:26 -04:00
Paul Smith
76b6e668a6 * README.git: Describe GCC and GNU make requirements
* maintMakefile: Put custom C flags into a separate variable
so they can be overridden more easily on the command line.
2019-09-07 18:27:26 -04:00
Paul Smith
5ff6ae6177 * tests/scripts/features/archives: Fix expected long ar name output. 2019-09-07 18:27:26 -04:00
Paul Smith
7c202b50fa * tetss/run_make_test.pl: Avoid 'sh -c' for Windows portability. 2019-09-07 18:27:26 -04:00
Paul Smith
f0182df865 Update to GNU make release candidate 4.2.91 2019-09-07 18:27:26 -04:00
Paul Smith
0a6c38eff8 * tests/scripts/functions/wildcard: Skip dangling symlink test.
The built-in glob implementation does not correctly handle dangling
symlinks.  This needs to be fixed by switching to the latest glob
implementation from gnulib but that's a big job: for now avoid the
test if we know it will fail.
2019-09-07 18:27:26 -04:00
Paul Smith
4b45e2828d * maintMakefile: Use check-local when testing build.sh.
Running 'make check' will rebuild 'make' so we're not testing the
build.sh-generated make binary.
2019-09-07 18:27:26 -04:00
Paul Smith
4f3a41c60a Don't reset stack size when using posix_spawn()
There's no way to run setrlimit() from posix_spawn() so we can't reset
the stack limit in children; thus, don't change it in the parent.

* src/makeint.h (SET_STACK_SIZE): Don't set this when HAVE_POSIX_SPAWN.
* src/job.c (child_execute_job): Remove useless comment.
2019-09-07 18:27:26 -04:00
Paul Smith
757a9d06e3 * configure.ac: Remove redundant getloadavg gnulib support 2019-09-07 18:27:26 -04:00
Paul Smith
31394f7f53 * src/dir.c (dir_setup_glob): Initialize unused gl_offs.
* tests/scripts/functions/wildcard: Add trailing slash tests.
Initial changes by Dmitry Goncharov <dgoncharov@users.sf.net>
2019-09-07 18:27:26 -04:00
Paul Eggert
b6884c73b7 Pacify Oracle Studio c99
* src/dep.h (DEP):
* src/function.c (struct function_table_entry):
Use unsigned int, not unsigned short.  Without this patch, c99
complains ‘warning: nonportable bit-field type’.
2019-09-02 11:11:26 -04:00
Paul Eggert
8bffc8d53c Port grouped_targets test to Solaris 10
* tests/scripts/features/grouped_targets: Use ‘printf ''’
instead of ‘echo -n’, as POSIX says the latter is not portable.
2019-09-02 11:11:26 -04:00
Paul Eggert
a9609084f4 Remove useless code in eval
* src/read.c (eval): Remove useless code.  Without this patch,
Oracle Studio 12.6 complains ‘"src/read.c", line 1405: warning:
loop not entered at top’.
2019-09-02 11:11:26 -04:00
Paul Eggert
8d820d57f6 Pacify Oracle Studio 12.6 in init_switches
* src/main.c (init_switches): Use a cast to convert char const *
to char *.  Without this patch, the compiler complains
‘"src/main.c", line 2643: warning: assignment type mismatch:
pointer to char "=" pointer to const char’.
2019-09-02 11:11:26 -04:00
Paul Eggert
73e11a5024 Pacify Oracle Studio 12.6
* src/arscan.c [VMS]: Use ‘#if !defined LBR$_HDRTRUNC’ instead
of ‘#ifndef LBR$_HDRTRUNC’ to pacify Oracle Studio 12.6, which
looks inside unused #if branches for preprocessor syntax errors.
Without this patch it complains ‘"src/arscan.c", line 43: warning:
tokens ignored at end of directive line’.
2019-09-02 11:11:26 -04:00
Paul Smith
85cdc9e9ae * NEWS: Fix incorrect notes. 2019-09-02 11:11:26 -04:00
Paul Smith
7e60ffe83e * src/read.c (parse_file_seq): [SV 52076] Don't reverse glob() results. 2019-09-02 11:11:26 -04:00
Eli Zaretskii
715c787dc6 Fix MS-Windows MinGW build
* src/w32/subproc/sub_proc.c (process_wait_for_multiple_objects):
Fix format specifier for GetLastError's value.

* src/job.c (reap_children): Define the 'remote_status_lose' label
only for Posix platforms, to avoid compiler warning.

* build_w32.bat (LNKOUT): New variable, using forward slashes.
Use forward slashes in calls to :Compile, so that linking with GNU
ld works.

* src/makeint.h [!HAVE_UMASK]: Prototype for 'umask'.
(UMASK, MODE_T): Don't define.

* src/misc.c (get_tmpfile): Don't call UMASK, call umask, to
avoid compilation warning on !HAVE_UMASK platforms.
* src/output.c (output_tmpfd): Likewise.

* src/misc.c (umask) [!HAVE_UMASK]: New no-op function.

* src/config.h.W32.template (__USE_MINGW_ANSI_STDIO)
[__MINGW32__]: Define to 1, to force Make use ANSI-compatible
stdio functions, which also support the non-standard 'Id' and 'Ix'
specifiers.
(HAVE_UMASK) [__MINGW32__]: Define to 1.

* src/arscan.c (ar_member_touch): Type-cast argument of strlen to
avoid compiler warnings.
2019-08-28 17:45:49 +03:00
Paul Smith
e304a03b6d * NEWS: Update for pre-release 2019-08-26 07:54:09 -04:00
Paul Smith
2273ab7069 Update maintainer mode to support debug wait points.
Make a spin() method available when compiled in maintainer mode.
If a file exists in the working directory with a specific name,
make will sleep until the file is deleted.

Ensure that maintainer mode is enabled on Windows, using the same
algorithm we use on POSIX / autoconf systems.

* build_w32.bat: If maintMakefile exists, enable maintainer mode.
* src/main.c (main): Replace Windows-only suspend flag with spin().
* src/makeint.h: A SPIN() macro calls spin() in maintainer mode.
* src/misc.c (spin): If a spin file exists sleep until it's deleted.
2019-08-26 07:54:09 -04:00
Paul Smith
2e388a18a1 * tests/scripts/features/archives: [SV 54395] Support non-GNU ar. 2019-08-26 07:54:09 -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
a0c17b5af1 * src/job.c (construct_command_argv): Remove unused VMS code 2019-08-25 17:17:36 -04:00
Paul Smith
a483334f97 * src/job.c (child_execute_job): Set pid to -1 on posix_spawn failure. 2019-08-25 17:16:40 -04:00
Paul Smith
069f2bca99 * bootstrap: Update from latest gnulib version 2019-08-24 14:56:33 -04:00
Paul Smith
40847ce9b8 * scripts/copyright-update: Use git ls-files for controlled files 2019-08-24 14:41:10 -04:00
Paul Smith
a01c5bee02 * po/LINGUAS: Add a translation for Bulgarian. 2019-08-24 14:13:59 -04:00
Christian Eggers
38e96eadea [SV 56449] (Windows) Use slow path if '%' appears in the command
* src/job.c (sh_chars_dos): Add '%' as a special character
* src/job.c (construct_command_argv_internal): Check for '%' in quotes

For the windows version of make, a recipe line cannot be executed
diretly by make (without a shell) if a '%' character is present. This
character starts a cmd.exe escape sequence.

Signed-off-by: Christian Eggers <ceggers@arri.de>
Copyright-paperwork-exempt: yes
2019-07-14 09:28:31 -04:00
Paul Smith
d7cfbf1961 * src/read.c (parse_file_seq): Update comments. 2019-07-14 09:20:14 -04:00
Mike Haboustak
ee167c650e [SV 28456] Don't override $< when no default rule has been defined
The check for matching a file's command to the default rule's command
does not account for null. If no .DEFAULT is defined a rule with no
recipe has it's $< variable set to the value of $@. This breaks second
expansion, particularly when used with pattern rules.

* src/commands.c [set_file_variables]: Check that cmds is set
* tests/scripts/features/se_explicit: Test case
* tests/scripts/features/se_implicit: Test case

Copyright-paperwork-exempt: yes
2019-07-13 11:47:26 -04:00
Paul Smith
4d00ceba26 Switch to the gnulib version of strerror()
* bootstrap.conf: Add strerror module
* configure.ac: Remove strerror check
* src/misc.c: Remove local strerror() implementation
* src/config.ami.template: Remove HAVE_STRERROR
* src/config.h-vms.template: Ditto.
* src/config.h.W32.template: Ditto.
2019-07-13 08:47:19 -04:00