]> git.ipfire.org Git - thirdparty/make.git/commitdiff
Fix tests for MacOS and Windows
authorPaul Smith <psmith@gnu.org>
Tue, 30 Aug 2022 17:41:37 +0000 (13:41 -0400)
committerPaul Smith <psmith@gnu.org>
Wed, 31 Aug 2022 01:05:34 +0000 (21:05 -0400)
* 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.

maintMakefile
tests/scripts/features/jobserver
tests/scripts/features/se_explicit
tests/scripts/features/se_implicit
tests/scripts/features/se_statpat
tests/scripts/variables/INCLUDE_DIRS

index aa536aaffed28b9eaccb88db4ed80eb627523627..88f734aee1acad326e64b62a20e86b028a1a1a67 100644 (file)
@@ -82,9 +82,8 @@ Basic.mk: Basic.mk.template .dep_segment Makefile
        sed -e 's@^\([^ ]*\)\.o:@$$(OUTDIR)\1.$$(OBJEXT):@' \
            -e 's@\([^ ]*\.[ch]\)@$$(SRCDIR)/\1@g' \
            -e 's@$$(SRCDIR)/src/config.h@$$(OUTDIR)src/config.h@g' \
-           -e 's@$$(SRCDIR)/lib/stdlib.h@@g' \
-           -e 's@$$(SRCDIR)/lib/sys/types.h@@g' \
-           -e 's@$$(SRCDIR)/lib/unistd.h@@g' \
+           -e 's@$$(SRCDIR)/lib/alloca.h@@g' \
+           -e 's@$$(SRCDIR)/lib/stdbool.h@@g' \
          $(word 2,$^) >>$@
        chmod a-w $@
 
index 17374eaf1da1e6097b6ea06335138a5703e236de..d56c6f409e7829db9601febc4399b13104aca23c 100644 (file)
@@ -139,11 +139,12 @@ all a: ; @echo $@
 # 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.
-$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/");
+if (exists $FEATURES{'jobserver-fifo'}) {
+  $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/");
+}
 
 1;
index ee5a89de5946016393c129293f3b368548bdd70d..d1247d40af009de02777713d562209642a77e16d 100644 (file)
@@ -480,11 +480,10 @@ unlink('hello.1');
 # No side effects from second expansion of unrelated rules.
 run_make_test(q!
 .SECONDEXPANSION:
-hello.tsk:; cp hello.1 $@
+hello.tsk:; exit 1
 unrelated: $$(shell touch hello.1);
 !, '',
-"cp hello.1 hello.tsk
-cp: cannot stat 'hello.1': $ERR_no_such_file
+"exit 1
 #MAKE#: *** [#MAKEFILE#:3: hello.tsk] Error 1\n", 512);
 
 # sv 62706.
index 58775631c650aec8bedcb9056abae6cfa6519776..c9d7ca9f4d2f24c3eecfb103592ea734db9a1fbe 100644 (file)
@@ -482,12 +482,11 @@ hello.tsk from hello.o
 run_make_test(q!
 .SECONDEXPANSION:
 all: hello.tsk
-%.tsk: %.o; cp hello.1 $@
+%.tsk: %.o; exit 1
 hello.o:;
 %.q: $$(shell touch hello.1);
 !, '',
-"cp hello.1 hello.tsk
-cp: cannot stat 'hello.1': $ERR_no_such_file
+"exit 1
 #MAKE#: *** [#MAKEFILE#:4: hello.tsk] Error 1\n", 512);
 
 # sv 62706.
index 616a1a8581fb52f1f2ec46ee2e5fda5526df5256..935ff3faa813484ac397778a56a5d62a934268a1 100644 (file)
@@ -207,12 +207,11 @@ unlink('hello.1');
 run_make_test(q!
 .SECONDEXPANSION:
 all: hello.tsk
-hello.tsk: %.tsk: %.o; cp hello.1 $@
+hello.tsk: %.tsk: %.o; exit 1
 hello.o:;
 bye.tsk: %.tsk: $$(shell touch hello.1);
 !, '',
-"cp hello.1 hello.tsk
-cp: cannot stat 'hello.1': $ERR_no_such_file
+"exit 1
 #MAKE#: *** [#MAKEFILE#:4: hello.tsk] Error 1\n", 512);
 
 # sv 62706.
index da1623c66450d5ea7bf4909d6c3ed316bd8f6ca2..6881292486b4620524a6345a3ba17fa79dde4a9d 100644 (file)
@@ -8,11 +8,12 @@ use Cwd;
 $dir = cwd;
 $dir =~ s,.*/([^/]+)$,../$1,;
 
-# Test #1: The content of .INCLUDE_DIRS depends on the platform for which
-#          make was built. What we know for sure is that it shouldn't be
-#          empty.
-#
-run_make_test('
+if (-d '/usr/include') {
+  # Test #1: The content of .INCLUDE_DIRS depends on the platform for which
+  #          make was built. What we know for sure is that it shouldn't be
+  #          empty.
+  #
+  run_make_test('
 ifeq ($(.INCLUDE_DIRS),)
 $(warning .INCLUDE_DIRS is empty)
 endif
@@ -20,8 +21,8 @@ endif
 .PHONY: all
 all:;@:
 ',
-              '', '');
-
+                '', '');
+}
 
 # Test #2: Make sure -I paths end up in .INCLUDE_DIRS.
 #
@@ -57,20 +58,21 @@ all:;\@:
 
 # Verify that -I- disables content from .INCLUDE_DIRS
 
-run_make_test("
-ifneq (\$(.INCLUDE_DIRS),)
-\$(warning Mismatched \$(.INCLUDE_DIRS) != )
+run_make_test(q/
+ifneq ($(.INCLUDE_DIRS),)
+$(warning Mismatched $(.INCLUDE_DIRS) != )
 endif
-all:;\@:
-",
+all:;@:
+/,
               '-I-', '');
 
 # Prefix -I dirs to the front
 mkdir('somedir', 0777);
 
+my $xdirs = $dirs ? " $dirs" : '';
 run_make_test("
-ifneq (\$(.INCLUDE_DIRS),somedir $dirs)
-\$(warning Mismatched \$(.INCLUDE_DIRS) != somedir $dirs)
+ifneq (\$(.INCLUDE_DIRS),somedir$xdirs)
+\$(warning Mismatched '\$(.INCLUDE_DIRS)' != 'somedir$xdirs')
 endif
 all:;\@:
 ",
@@ -78,12 +80,12 @@ all:;\@:
 
 # Verify .INCLUDE_DIRS contains files after -I-
 
-run_make_test("
-ifneq (\$(.INCLUDE_DIRS),somedir)
-\$(warning Mismatched \$(.INCLUDE_DIRS) != somedir)
+run_make_test(q/
+ifneq ($(.INCLUDE_DIRS),somedir)
+$(warning Mismatched $(.INCLUDE_DIRS) != somedir)
 endif
-all:;\@:
-",
+all:;@:
+/,
               '-I - -I somedir', '');
 
 rmdir('somedir');