2013-09-21 22:10:08 +00:00
|
|
|
# -*-perl-*-
|
|
|
|
|
|
|
|
$description = "Test jobserver.";
|
|
|
|
|
|
|
|
$details = "These tests are ones that specifically are different when the
|
|
|
|
jobserver feature is available. Most -j tests are the same whether or not
|
|
|
|
jobserver is available, and those appear in the 'parallelism' test suite.";
|
|
|
|
|
|
|
|
exists $FEATURES{'jobserver'} or return -1;
|
|
|
|
|
|
|
|
if (!$parallel_jobs) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-04-04 05:23:04 +00:00
|
|
|
# Shorthand
|
|
|
|
my $np = '--no-print-directory';
|
|
|
|
|
|
|
|
# Simple test of MAKEFLAGS settings
|
|
|
|
run_make_test(q!
|
|
|
|
SHOW = $(patsubst --jobserver-auth=%,--jobserver-auth=<auth>,$(MAKEFLAGS))
|
|
|
|
recurse: ; @echo $@: "/$(SHOW)/"; $(MAKE) -f #MAKEFILE# all
|
|
|
|
all:;@echo $@: "/$(SHOW)/"
|
|
|
|
!,
|
|
|
|
"-j2 $np", "recurse: /-j2 --jobserver-auth=<auth> $np/\nall: /-j2 --jobserver-auth=<auth> $np/\n");
|
|
|
|
|
|
|
|
# Setting parallelism with the environment
|
|
|
|
# Command line should take precedence over the environment
|
2020-04-01 05:58:33 +00:00
|
|
|
$ENV{MAKEFLAGS} = "-j2 $np";
|
2016-04-04 05:23:04 +00:00
|
|
|
run_make_test(q!
|
|
|
|
SHOW = $(patsubst --jobserver-auth=%,--jobserver-auth=<auth>,$(MAKEFLAGS))
|
|
|
|
recurse: ; @echo $@: "/$(SHOW)/"; $(MAKE) -f #MAKEFILE# all
|
|
|
|
all:;@echo $@: "/$(SHOW)/"
|
|
|
|
!,
|
|
|
|
'', "recurse: /-j2 --jobserver-auth=<auth> $np/\nall: /-j2 --jobserver-auth=<auth> $np/\n");
|
|
|
|
|
|
|
|
# Test override of -jN
|
2020-04-01 05:58:33 +00:00
|
|
|
$ENV{MAKEFLAGS} = "-j9 $np";
|
2016-04-04 05:23:04 +00:00
|
|
|
run_make_test(q!
|
|
|
|
SHOW = $(patsubst --jobserver-auth=%,--jobserver-auth=<auth>,$(MAKEFLAGS))
|
|
|
|
recurse: ; @echo $@: "/$(SHOW)/"; $(MAKE) -j3 -f #MAKEFILE# recurse2
|
|
|
|
recurse2: ; @echo $@: "/$(SHOW)/"; $(MAKE) -f #MAKEFILE# all
|
|
|
|
all:;@echo $@: "/$(SHOW)/"
|
|
|
|
!,
|
2017-10-30 16:53:49 +00:00
|
|
|
"-j2 $np", "recurse: /-j2 --jobserver-auth=<auth> $np/\n#MAKE#[1]: warning: -j3 forced in submake: resetting jobserver mode.\nrecurse2: /-j3 --jobserver-auth=<auth> $np/\nall: /-j3 --jobserver-auth=<auth> $np/\n");
|
2016-04-04 05:23:04 +00:00
|
|
|
|
|
|
|
# Test override of -jN with -j
|
|
|
|
run_make_test(q!
|
|
|
|
SHOW = $(patsubst --jobserver-auth=%,--jobserver-auth=<auth>,$(MAKEFLAGS))
|
|
|
|
recurse: ; @echo $@: "/$(SHOW)/"; $(MAKE) -j -f #MAKEFILE# recurse2
|
|
|
|
recurse2: ; @echo $@: "/$(SHOW)/"; $(MAKE) -f #MAKEFILE# all
|
|
|
|
all:;@echo $@: "/$(SHOW)/"
|
|
|
|
!,
|
2017-10-30 16:53:49 +00:00
|
|
|
"-j2 $np", "recurse: /-j2 --jobserver-auth=<auth> $np/\n#MAKE#[1]: warning: -j0 forced in submake: resetting jobserver mode.\nrecurse2: /-j $np/\nall: /-j $np/\n");
|
2016-04-04 05:23:04 +00:00
|
|
|
|
2016-04-02 20:29:48 +00:00
|
|
|
# Don't put --jobserver-auth into a re-exec'd MAKEFLAGS.
|
2013-09-21 22:10:08 +00:00
|
|
|
# We can't test this directly because there's no way a makefile can
|
|
|
|
# show the value of MAKEFLAGS we were re-exec'd with. We can intuit it
|
|
|
|
# by looking for "disabling jobserver mode" warnings; we should only
|
|
|
|
# get one from the original invocation and none from the re-exec.
|
|
|
|
# See Savannah bug #18124
|
|
|
|
|
2013-09-22 15:28:46 +00:00
|
|
|
unlink('inc.mk');
|
|
|
|
|
2013-09-21 22:10:08 +00:00
|
|
|
run_make_test(q!
|
2020-03-31 02:01:09 +00:00
|
|
|
.RECIPEPREFIX = >
|
2013-09-21 22:10:08 +00:00
|
|
|
-include inc.mk
|
|
|
|
recur:
|
2020-03-31 02:01:09 +00:00
|
|
|
#> @echo 'MAKEFLAGS = $(MAKEFLAGS)'
|
|
|
|
> @rm -f inc.mk
|
|
|
|
> @$(MAKE) -j2 -f #MAKEFILE# all
|
2013-09-21 22:10:08 +00:00
|
|
|
all:
|
2020-03-31 02:01:09 +00:00
|
|
|
#> @echo 'MAKEFLAGS = $(MAKEFLAGS)'
|
|
|
|
> @echo $@
|
2013-09-21 22:10:08 +00:00
|
|
|
inc.mk:
|
2020-03-31 02:01:09 +00:00
|
|
|
#> @echo 'MAKEFLAGS = $(MAKEFLAGS)'
|
|
|
|
> @echo 'FOO = bar' > $@
|
2013-09-21 22:10:08 +00:00
|
|
|
!,
|
2017-10-30 16:53:49 +00:00
|
|
|
"$np -j2", "#MAKE#[1]: warning: -j2 forced in submake: resetting jobserver mode.\nall\n");
|
2013-09-21 22:10:08 +00:00
|
|
|
|
2013-09-22 15:28:46 +00:00
|
|
|
unlink('inc.mk');
|
2013-09-21 22:10:08 +00:00
|
|
|
|
2018-07-01 20:13:13 +00:00
|
|
|
# Test recursion which is hidden from make.
|
2013-09-21 22:10:08 +00:00
|
|
|
# See Savannah bug #39934
|
|
|
|
# Or Red Hat bug https://bugzilla.redhat.com/show_bug.cgi?id=885474
|
Support implementing the jobserver using named pipes
Using anonymous pipes for jobserver support has some advantages:
for example there is nothing on disk that needs to be cleaned up.
However it has many obscure problems, related to the fact that in
order for it to work we need to ensure these resources are properly
passed through to child processes that want to use the jobserver.
At the same time we don't want to pass the pipe to process which
DON'T know about the jobserver.
Other processes can open file descriptors which we then think are
our jobserver, but aren't. And, we open the pipe file descriptors
in blocking mode which doesn't work for all users.
See issues such as SV 57178, SV 57242, and SV 62397
To avoid these issues, use named pipes (on systems where they are
available) instead of anonoymous pipes. This simplifies many things:
we never need to pass open file descriptors to our children; they
can open the jobserver named pipe. We don't need to worry about
recursive vs. non-recursive children. Users don't have to "pass
through" the resources if they are invoking sub-makes. Each child
can open its own file descriptor and set blocking as needed.
The downside is the named pipe exists on disk and so must be cleaned
up when the "top-level" make instance exits.
In order to allow make to continue to be used in build systems where
older versions of GNU make, or other tools that want to use the
jobserver, but don't understand named pipes, introduce a new option
--jobserver-style that allows the user to choose anonymous pipes.
* NEWS: Announce the change and the --jobserver-style option.
* doc/make.1: Add --jobserver-style documentation.
* doc/make.texi (Special Variables): Add missing items to .FEATURES.
(Options Summary): Add --jobserver-style.
(POSIX Jobserver): Named pipes, changes to --jobserver-auth, and the
--jobserver-style option.
(Windows Jobserver): Document --jobserver-style for Windows.
* configure.ac: Check for mkfifo.
* src/config.h-vms.template: Undefined HAVE_MKFIFO.
* src/config.h.W32.template: Ditto.
* src/main.c: Add jobserver-style as a new command line option.
(main): Add jobserver-fifo to .FEATURES if supported. Pass the style
option to jobserver_setup().
* src/os.h (jobserver_setup): Accept a style string option.
* src/posixos.c (enum js_type): Enumeration of the jobserver style.
(js_type): Which style we are currently using.
(fifo_name): The path to the named pipe (if in use).
(jobserver_setup): If no style is given, or "fifo" is given, set up a
named pipe: get a temporary file and use mkfifo() on it, then open it
for reading and writing. If something fails fall back to anonymous
pipes.
(jobserver_parse_auth): Parse jobserver-auth to determine the style.
If we are using a named pipe, open it. If we're using anonymous pipes
ensure they're valid as before.
(jobserver_get_invalid_auth): Don't invalidate the jobserver when
using named pipes.
(jobserver_clear): Clean up memory used for named pipes.
(jobserver_acquire_all): Unlink the named pipe when done.
* src/w32/w32os.c (jobserver_setup): Check the style argument.
* tests/scripts/features/jobserver: Use --jobserver-style to test
the anonymous pipe behavior, and also test named pipe/semaphore
behavior. Check invalid jobserver-style options.
* tests/scripts/functions/shell: Use --jobserver-style to test the
anonymous pipe behavior, and also test named pipe/semaphore
behavior.
2022-08-02 22:07:27 +00:00
|
|
|
# Environments that don't use a pipe won't close access, so this won't happen.
|
2018-07-01 20:13:13 +00:00
|
|
|
if ($port_type ne 'W32') {
|
Support implementing the jobserver using named pipes
Using anonymous pipes for jobserver support has some advantages:
for example there is nothing on disk that needs to be cleaned up.
However it has many obscure problems, related to the fact that in
order for it to work we need to ensure these resources are properly
passed through to child processes that want to use the jobserver.
At the same time we don't want to pass the pipe to process which
DON'T know about the jobserver.
Other processes can open file descriptors which we then think are
our jobserver, but aren't. And, we open the pipe file descriptors
in blocking mode which doesn't work for all users.
See issues such as SV 57178, SV 57242, and SV 62397
To avoid these issues, use named pipes (on systems where they are
available) instead of anonoymous pipes. This simplifies many things:
we never need to pass open file descriptors to our children; they
can open the jobserver named pipe. We don't need to worry about
recursive vs. non-recursive children. Users don't have to "pass
through" the resources if they are invoking sub-makes. Each child
can open its own file descriptor and set blocking as needed.
The downside is the named pipe exists on disk and so must be cleaned
up when the "top-level" make instance exits.
In order to allow make to continue to be used in build systems where
older versions of GNU make, or other tools that want to use the
jobserver, but don't understand named pipes, introduce a new option
--jobserver-style that allows the user to choose anonymous pipes.
* NEWS: Announce the change and the --jobserver-style option.
* doc/make.1: Add --jobserver-style documentation.
* doc/make.texi (Special Variables): Add missing items to .FEATURES.
(Options Summary): Add --jobserver-style.
(POSIX Jobserver): Named pipes, changes to --jobserver-auth, and the
--jobserver-style option.
(Windows Jobserver): Document --jobserver-style for Windows.
* configure.ac: Check for mkfifo.
* src/config.h-vms.template: Undefined HAVE_MKFIFO.
* src/config.h.W32.template: Ditto.
* src/main.c: Add jobserver-style as a new command line option.
(main): Add jobserver-fifo to .FEATURES if supported. Pass the style
option to jobserver_setup().
* src/os.h (jobserver_setup): Accept a style string option.
* src/posixos.c (enum js_type): Enumeration of the jobserver style.
(js_type): Which style we are currently using.
(fifo_name): The path to the named pipe (if in use).
(jobserver_setup): If no style is given, or "fifo" is given, set up a
named pipe: get a temporary file and use mkfifo() on it, then open it
for reading and writing. If something fails fall back to anonymous
pipes.
(jobserver_parse_auth): Parse jobserver-auth to determine the style.
If we are using a named pipe, open it. If we're using anonymous pipes
ensure they're valid as before.
(jobserver_get_invalid_auth): Don't invalidate the jobserver when
using named pipes.
(jobserver_clear): Clean up memory used for named pipes.
(jobserver_acquire_all): Unlink the named pipe when done.
* src/w32/w32os.c (jobserver_setup): Check the style argument.
* tests/scripts/features/jobserver: Use --jobserver-style to test
the anonymous pipe behavior, and also test named pipe/semaphore
behavior. Check invalid jobserver-style options.
* tests/scripts/functions/shell: Use --jobserver-style to test the
anonymous pipe behavior, and also test named pipe/semaphore
behavior.
2022-08-02 22:07:27 +00:00
|
|
|
create_file('Makefile2', "vpath %.c ../\n", "foo:\n");
|
2018-07-01 20:13:13 +00:00
|
|
|
|
|
|
|
run_make_test(q!
|
2013-09-21 22:10:08 +00:00
|
|
|
default: ; @ #MAKEPATH# -f Makefile2
|
|
|
|
!,
|
Support implementing the jobserver using named pipes
Using anonymous pipes for jobserver support has some advantages:
for example there is nothing on disk that needs to be cleaned up.
However it has many obscure problems, related to the fact that in
order for it to work we need to ensure these resources are properly
passed through to child processes that want to use the jobserver.
At the same time we don't want to pass the pipe to process which
DON'T know about the jobserver.
Other processes can open file descriptors which we then think are
our jobserver, but aren't. And, we open the pipe file descriptors
in blocking mode which doesn't work for all users.
See issues such as SV 57178, SV 57242, and SV 62397
To avoid these issues, use named pipes (on systems where they are
available) instead of anonoymous pipes. This simplifies many things:
we never need to pass open file descriptors to our children; they
can open the jobserver named pipe. We don't need to worry about
recursive vs. non-recursive children. Users don't have to "pass
through" the resources if they are invoking sub-makes. Each child
can open its own file descriptor and set blocking as needed.
The downside is the named pipe exists on disk and so must be cleaned
up when the "top-level" make instance exits.
In order to allow make to continue to be used in build systems where
older versions of GNU make, or other tools that want to use the
jobserver, but don't understand named pipes, introduce a new option
--jobserver-style that allows the user to choose anonymous pipes.
* NEWS: Announce the change and the --jobserver-style option.
* doc/make.1: Add --jobserver-style documentation.
* doc/make.texi (Special Variables): Add missing items to .FEATURES.
(Options Summary): Add --jobserver-style.
(POSIX Jobserver): Named pipes, changes to --jobserver-auth, and the
--jobserver-style option.
(Windows Jobserver): Document --jobserver-style for Windows.
* configure.ac: Check for mkfifo.
* src/config.h-vms.template: Undefined HAVE_MKFIFO.
* src/config.h.W32.template: Ditto.
* src/main.c: Add jobserver-style as a new command line option.
(main): Add jobserver-fifo to .FEATURES if supported. Pass the style
option to jobserver_setup().
* src/os.h (jobserver_setup): Accept a style string option.
* src/posixos.c (enum js_type): Enumeration of the jobserver style.
(js_type): Which style we are currently using.
(fifo_name): The path to the named pipe (if in use).
(jobserver_setup): If no style is given, or "fifo" is given, set up a
named pipe: get a temporary file and use mkfifo() on it, then open it
for reading and writing. If something fails fall back to anonymous
pipes.
(jobserver_parse_auth): Parse jobserver-auth to determine the style.
If we are using a named pipe, open it. If we're using anonymous pipes
ensure they're valid as before.
(jobserver_get_invalid_auth): Don't invalidate the jobserver when
using named pipes.
(jobserver_clear): Clean up memory used for named pipes.
(jobserver_acquire_all): Unlink the named pipe when done.
* src/w32/w32os.c (jobserver_setup): Check the style argument.
* tests/scripts/features/jobserver: Use --jobserver-style to test
the anonymous pipe behavior, and also test named pipe/semaphore
behavior. Check invalid jobserver-style options.
* tests/scripts/functions/shell: Use --jobserver-style to test the
anonymous pipe behavior, and also test named pipe/semaphore
behavior.
2022-08-02 22:07:27 +00:00
|
|
|
"--jobserver-style=pipe -j2 $np",
|
2013-09-21 22:10:08 +00:00
|
|
|
"#MAKE#[1]: warning: jobserver unavailable: using -j1. Add '+' to parent make rule.
|
|
|
|
#MAKE#[1]: Nothing to be done for 'foo'.");
|
|
|
|
|
2018-07-01 20:13:13 +00:00
|
|
|
rmfiles('Makefile2');
|
|
|
|
}
|
2013-09-21 22:10:08 +00:00
|
|
|
|
Support implementing the jobserver using named pipes
Using anonymous pipes for jobserver support has some advantages:
for example there is nothing on disk that needs to be cleaned up.
However it has many obscure problems, related to the fact that in
order for it to work we need to ensure these resources are properly
passed through to child processes that want to use the jobserver.
At the same time we don't want to pass the pipe to process which
DON'T know about the jobserver.
Other processes can open file descriptors which we then think are
our jobserver, but aren't. And, we open the pipe file descriptors
in blocking mode which doesn't work for all users.
See issues such as SV 57178, SV 57242, and SV 62397
To avoid these issues, use named pipes (on systems where they are
available) instead of anonoymous pipes. This simplifies many things:
we never need to pass open file descriptors to our children; they
can open the jobserver named pipe. We don't need to worry about
recursive vs. non-recursive children. Users don't have to "pass
through" the resources if they are invoking sub-makes. Each child
can open its own file descriptor and set blocking as needed.
The downside is the named pipe exists on disk and so must be cleaned
up when the "top-level" make instance exits.
In order to allow make to continue to be used in build systems where
older versions of GNU make, or other tools that want to use the
jobserver, but don't understand named pipes, introduce a new option
--jobserver-style that allows the user to choose anonymous pipes.
* NEWS: Announce the change and the --jobserver-style option.
* doc/make.1: Add --jobserver-style documentation.
* doc/make.texi (Special Variables): Add missing items to .FEATURES.
(Options Summary): Add --jobserver-style.
(POSIX Jobserver): Named pipes, changes to --jobserver-auth, and the
--jobserver-style option.
(Windows Jobserver): Document --jobserver-style for Windows.
* configure.ac: Check for mkfifo.
* src/config.h-vms.template: Undefined HAVE_MKFIFO.
* src/config.h.W32.template: Ditto.
* src/main.c: Add jobserver-style as a new command line option.
(main): Add jobserver-fifo to .FEATURES if supported. Pass the style
option to jobserver_setup().
* src/os.h (jobserver_setup): Accept a style string option.
* src/posixos.c (enum js_type): Enumeration of the jobserver style.
(js_type): Which style we are currently using.
(fifo_name): The path to the named pipe (if in use).
(jobserver_setup): If no style is given, or "fifo" is given, set up a
named pipe: get a temporary file and use mkfifo() on it, then open it
for reading and writing. If something fails fall back to anonymous
pipes.
(jobserver_parse_auth): Parse jobserver-auth to determine the style.
If we are using a named pipe, open it. If we're using anonymous pipes
ensure they're valid as before.
(jobserver_get_invalid_auth): Don't invalidate the jobserver when
using named pipes.
(jobserver_clear): Clean up memory used for named pipes.
(jobserver_acquire_all): Unlink the named pipe when done.
* src/w32/w32os.c (jobserver_setup): Check the style argument.
* tests/scripts/features/jobserver: Use --jobserver-style to test
the anonymous pipe behavior, and also test named pipe/semaphore
behavior. Check invalid jobserver-style options.
* tests/scripts/functions/shell: Use --jobserver-style to test the
anonymous pipe behavior, and also test named pipe/semaphore
behavior.
2022-08-02 22:07:27 +00:00
|
|
|
# For Windows and named pipes, we don't need to worry about recursion
|
|
|
|
if ($port_type eq 'W32' || exists $FEATURES{'jobserver-fifo'}) {
|
|
|
|
create_file('Makefile2', "vpath %.c ../\n", "foo:\n");
|
|
|
|
|
|
|
|
run_make_test(q!
|
|
|
|
default: ; @ #MAKEPATH# -f Makefile2
|
|
|
|
!,
|
|
|
|
"-j2 $np",
|
|
|
|
"#MAKE#[1]: Nothing to be done for 'foo'.");
|
|
|
|
|
|
|
|
rmfiles('Makefile2');
|
|
|
|
}
|
|
|
|
|
2020-03-31 02:01:09 +00:00
|
|
|
# Ensure enter/leave directory messages appear before jobserver warnings
|
2016-04-02 20:29:48 +00:00
|
|
|
|
2020-03-31 02:01:09 +00:00
|
|
|
run_make_test(q!
|
|
|
|
all: ; @$(MAKE) -C . -f #MAKEFILE# recurse -j1
|
|
|
|
recurse: ; @echo hi
|
|
|
|
!,
|
|
|
|
'-w -j2', "#MAKE#: Entering directory '#PWD#'
|
|
|
|
#MAKE#[1]: Entering directory '#PWD#'
|
|
|
|
#MAKE#[1]: warning: -j1 forced in submake: resetting jobserver mode.
|
|
|
|
hi
|
|
|
|
#MAKE#[1]: Leaving directory '#PWD#'
|
|
|
|
#MAKE#: Leaving directory '#PWD#'\n");
|
|
|
|
|
Support implementing the jobserver using named pipes
Using anonymous pipes for jobserver support has some advantages:
for example there is nothing on disk that needs to be cleaned up.
However it has many obscure problems, related to the fact that in
order for it to work we need to ensure these resources are properly
passed through to child processes that want to use the jobserver.
At the same time we don't want to pass the pipe to process which
DON'T know about the jobserver.
Other processes can open file descriptors which we then think are
our jobserver, but aren't. And, we open the pipe file descriptors
in blocking mode which doesn't work for all users.
See issues such as SV 57178, SV 57242, and SV 62397
To avoid these issues, use named pipes (on systems where they are
available) instead of anonoymous pipes. This simplifies many things:
we never need to pass open file descriptors to our children; they
can open the jobserver named pipe. We don't need to worry about
recursive vs. non-recursive children. Users don't have to "pass
through" the resources if they are invoking sub-makes. Each child
can open its own file descriptor and set blocking as needed.
The downside is the named pipe exists on disk and so must be cleaned
up when the "top-level" make instance exits.
In order to allow make to continue to be used in build systems where
older versions of GNU make, or other tools that want to use the
jobserver, but don't understand named pipes, introduce a new option
--jobserver-style that allows the user to choose anonymous pipes.
* NEWS: Announce the change and the --jobserver-style option.
* doc/make.1: Add --jobserver-style documentation.
* doc/make.texi (Special Variables): Add missing items to .FEATURES.
(Options Summary): Add --jobserver-style.
(POSIX Jobserver): Named pipes, changes to --jobserver-auth, and the
--jobserver-style option.
(Windows Jobserver): Document --jobserver-style for Windows.
* configure.ac: Check for mkfifo.
* src/config.h-vms.template: Undefined HAVE_MKFIFO.
* src/config.h.W32.template: Ditto.
* src/main.c: Add jobserver-style as a new command line option.
(main): Add jobserver-fifo to .FEATURES if supported. Pass the style
option to jobserver_setup().
* src/os.h (jobserver_setup): Accept a style string option.
* src/posixos.c (enum js_type): Enumeration of the jobserver style.
(js_type): Which style we are currently using.
(fifo_name): The path to the named pipe (if in use).
(jobserver_setup): If no style is given, or "fifo" is given, set up a
named pipe: get a temporary file and use mkfifo() on it, then open it
for reading and writing. If something fails fall back to anonymous
pipes.
(jobserver_parse_auth): Parse jobserver-auth to determine the style.
If we are using a named pipe, open it. If we're using anonymous pipes
ensure they're valid as before.
(jobserver_get_invalid_auth): Don't invalidate the jobserver when
using named pipes.
(jobserver_clear): Clean up memory used for named pipes.
(jobserver_acquire_all): Unlink the named pipe when done.
* src/w32/w32os.c (jobserver_setup): Check the style argument.
* tests/scripts/features/jobserver: Use --jobserver-style to test
the anonymous pipe behavior, and also test named pipe/semaphore
behavior. Check invalid jobserver-style options.
* tests/scripts/functions/shell: Use --jobserver-style to test the
anonymous pipe behavior, and also test named pipe/semaphore
behavior.
2022-08-02 22:07:27 +00:00
|
|
|
# Check for invalid jobserver-style options
|
|
|
|
|
|
|
|
run_make_test(q!
|
|
|
|
all: a
|
|
|
|
all a: ; @echo $@
|
|
|
|
!,
|
|
|
|
'--jobserver-style=foo -j8',
|
|
|
|
"#MAKE#: *** Unknown jobserver auth style 'foo'. Stop.", 512);
|
|
|
|
|
2022-08-23 01:27:08 +00:00
|
|
|
# sv 62908.
|
|
|
|
# Test that when mkfifo fails, make switches to pipe and succeeds.
|
|
|
|
# Force mkfifo to fail by attempting to create a fifo in a non existent
|
|
|
|
# directory.
|
|
|
|
# run_make_test does not allow matching a multiline pattern, therefore run the
|
|
|
|
# test twice.
|
|
|
|
# First time look for /$ERR_no_such_file/ to ensure mkfifo failed.
|
|
|
|
# Second time look for /Nothing to be done/ to ensure make succeeded.
|
2022-08-30 17:41:37 +00:00
|
|
|
if (exists $FEATURES{'jobserver-fifo'}) {
|
|
|
|
$ENV{TMPDIR} = "nosuchdir";
|
|
|
|
run_make_test("all:\n", '-j2', "/$ERR_no_such_file/");
|
2022-08-23 01:27:08 +00:00
|
|
|
|
2022-08-30 17:41:37 +00:00
|
|
|
$ENV{TMPDIR} = "nosuchdir";
|
|
|
|
run_make_test(undef, '-j2', "/Nothing to be done/");
|
2022-09-11 14:56:08 +00:00
|
|
|
|
|
|
|
# Verify that MAKE_TMPDIR is preferred if provided
|
|
|
|
$ENV{MAKE_TMPDIR} = '.';
|
|
|
|
$ENV{TMPDIR} = 'nosuchdir';
|
|
|
|
|
|
|
|
run_make_test(q!
|
|
|
|
recurse: ; @$(MAKE) -f #MAKEFILE# all
|
|
|
|
all:;@echo "$$MAKEFLAGS"
|
|
|
|
!,
|
|
|
|
"-j2 --no-print-directory", "/--jobserver-auth=fifo:\\./");
|
2022-08-30 17:41:37 +00:00
|
|
|
}
|
2022-08-23 01:27:08 +00:00
|
|
|
|
2020-03-31 02:01:09 +00:00
|
|
|
1;
|