Fix tests for MacOS and Windows

* maintMakefile: Remove the template headers as prerequisites.
* tests/scripts/features/jobserver: Only test fifo if enabled.
* tests/scripts/variables/INCLUDE_DIRS: On MacOS none of the default
directories exist so .INCLUDE_DIRS is empty by default.
* tests/scripts/features/se_explicit: Fail via exit.  cp will show
different error messages on different systems.
* tests/scripts/features/se_implicit: Ditto.
* tests/scripts/features/se_statpat: Ditto.
This commit is contained in:
Paul Smith 2022-08-30 13:41:37 -04:00
parent 26e359c71d
commit 15a7e3830f
6 changed files with 35 additions and 36 deletions

View File

@ -82,9 +82,8 @@ Basic.mk: Basic.mk.template .dep_segment Makefile
sed -e 's@^\([^ ]*\)\.o:@$$(OUTDIR)\1.$$(OBJEXT):@' \ sed -e 's@^\([^ ]*\)\.o:@$$(OUTDIR)\1.$$(OBJEXT):@' \
-e 's@\([^ ]*\.[ch]\)@$$(SRCDIR)/\1@g' \ -e 's@\([^ ]*\.[ch]\)@$$(SRCDIR)/\1@g' \
-e 's@$$(SRCDIR)/src/config.h@$$(OUTDIR)src/config.h@g' \ -e 's@$$(SRCDIR)/src/config.h@$$(OUTDIR)src/config.h@g' \
-e 's@$$(SRCDIR)/lib/stdlib.h@@g' \ -e 's@$$(SRCDIR)/lib/alloca.h@@g' \
-e 's@$$(SRCDIR)/lib/sys/types.h@@g' \ -e 's@$$(SRCDIR)/lib/stdbool.h@@g' \
-e 's@$$(SRCDIR)/lib/unistd.h@@g' \
$(word 2,$^) >>$@ $(word 2,$^) >>$@
chmod a-w $@ chmod a-w $@

View File

@ -139,11 +139,12 @@ all a: ; @echo $@
# test twice. # test twice.
# First time look for /$ERR_no_such_file/ to ensure mkfifo failed. # First time look for /$ERR_no_such_file/ to ensure mkfifo failed.
# Second time look for /Nothing to be done/ to ensure make succeeded. # Second time look for /Nothing to be done/ to ensure make succeeded.
$ENV{TMPDIR} = "nosuchdir"; if (exists $FEATURES{'jobserver-fifo'}) {
run_make_test("all:\n", '-j2', "/$ERR_no_such_file/"); $ENV{TMPDIR} = "nosuchdir";
run_make_test("all:\n", '-j2', "/$ERR_no_such_file/");
$ENV{TMPDIR} = "nosuchdir";
run_make_test(undef, '-j2', "/Nothing to be done/");
$ENV{TMPDIR} = "nosuchdir";
run_make_test(undef, '-j2', "/Nothing to be done/");
}
1; 1;

View File

@ -480,11 +480,10 @@ unlink('hello.1');
# No side effects from second expansion of unrelated rules. # No side effects from second expansion of unrelated rules.
run_make_test(q! run_make_test(q!
.SECONDEXPANSION: .SECONDEXPANSION:
hello.tsk:; cp hello.1 $@ hello.tsk:; exit 1
unrelated: $$(shell touch hello.1); unrelated: $$(shell touch hello.1);
!, '', !, '',
"cp hello.1 hello.tsk "exit 1
cp: cannot stat 'hello.1': $ERR_no_such_file
#MAKE#: *** [#MAKEFILE#:3: hello.tsk] Error 1\n", 512); #MAKE#: *** [#MAKEFILE#:3: hello.tsk] Error 1\n", 512);
# sv 62706. # sv 62706.

View File

@ -482,12 +482,11 @@ hello.tsk from hello.o
run_make_test(q! run_make_test(q!
.SECONDEXPANSION: .SECONDEXPANSION:
all: hello.tsk all: hello.tsk
%.tsk: %.o; cp hello.1 $@ %.tsk: %.o; exit 1
hello.o:; hello.o:;
%.q: $$(shell touch hello.1); %.q: $$(shell touch hello.1);
!, '', !, '',
"cp hello.1 hello.tsk "exit 1
cp: cannot stat 'hello.1': $ERR_no_such_file
#MAKE#: *** [#MAKEFILE#:4: hello.tsk] Error 1\n", 512); #MAKE#: *** [#MAKEFILE#:4: hello.tsk] Error 1\n", 512);
# sv 62706. # sv 62706.

View File

@ -207,12 +207,11 @@ unlink('hello.1');
run_make_test(q! run_make_test(q!
.SECONDEXPANSION: .SECONDEXPANSION:
all: hello.tsk all: hello.tsk
hello.tsk: %.tsk: %.o; cp hello.1 $@ hello.tsk: %.tsk: %.o; exit 1
hello.o:; hello.o:;
bye.tsk: %.tsk: $$(shell touch hello.1); bye.tsk: %.tsk: $$(shell touch hello.1);
!, '', !, '',
"cp hello.1 hello.tsk "exit 1
cp: cannot stat 'hello.1': $ERR_no_such_file
#MAKE#: *** [#MAKEFILE#:4: hello.tsk] Error 1\n", 512); #MAKE#: *** [#MAKEFILE#:4: hello.tsk] Error 1\n", 512);
# sv 62706. # sv 62706.

View File

@ -8,11 +8,12 @@ use Cwd;
$dir = cwd; $dir = cwd;
$dir =~ s,.*/([^/]+)$,../$1,; $dir =~ s,.*/([^/]+)$,../$1,;
# Test #1: The content of .INCLUDE_DIRS depends on the platform for which if (-d '/usr/include') {
# make was built. What we know for sure is that it shouldn't be # Test #1: The content of .INCLUDE_DIRS depends on the platform for which
# empty. # make was built. What we know for sure is that it shouldn't be
# # empty.
run_make_test(' #
run_make_test('
ifeq ($(.INCLUDE_DIRS),) ifeq ($(.INCLUDE_DIRS),)
$(warning .INCLUDE_DIRS is empty) $(warning .INCLUDE_DIRS is empty)
endif endif
@ -20,8 +21,8 @@ endif
.PHONY: all .PHONY: all
all:;@: all:;@:
', ',
'', ''); '', '');
}
# Test #2: Make sure -I paths end up in .INCLUDE_DIRS. # Test #2: Make sure -I paths end up in .INCLUDE_DIRS.
# #
@ -57,20 +58,21 @@ all:;\@:
# Verify that -I- disables content from .INCLUDE_DIRS # Verify that -I- disables content from .INCLUDE_DIRS
run_make_test(" run_make_test(q/
ifneq (\$(.INCLUDE_DIRS),) ifneq ($(.INCLUDE_DIRS),)
\$(warning Mismatched \$(.INCLUDE_DIRS) != ) $(warning Mismatched $(.INCLUDE_DIRS) != )
endif endif
all:;\@: all:;@:
", /,
'-I-', ''); '-I-', '');
# Prefix -I dirs to the front # Prefix -I dirs to the front
mkdir('somedir', 0777); mkdir('somedir', 0777);
my $xdirs = $dirs ? " $dirs" : '';
run_make_test(" run_make_test("
ifneq (\$(.INCLUDE_DIRS),somedir $dirs) ifneq (\$(.INCLUDE_DIRS),somedir$xdirs)
\$(warning Mismatched \$(.INCLUDE_DIRS) != somedir $dirs) \$(warning Mismatched '\$(.INCLUDE_DIRS)' != 'somedir$xdirs')
endif endif
all:;\@: all:;\@:
", ",
@ -78,12 +80,12 @@ all:;\@:
# Verify .INCLUDE_DIRS contains files after -I- # Verify .INCLUDE_DIRS contains files after -I-
run_make_test(" run_make_test(q/
ifneq (\$(.INCLUDE_DIRS),somedir) ifneq ($(.INCLUDE_DIRS),somedir)
\$(warning Mismatched \$(.INCLUDE_DIRS) != somedir) $(warning Mismatched $(.INCLUDE_DIRS) != somedir)
endif endif
all:;\@: all:;@:
", /,
'-I - -I somedir', ''); '-I - -I somedir', '');
rmdir('somedir'); rmdir('somedir');