Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make/unit-tests make(1): demonstrate unnecessary cre...



details:   https://anonhg.NetBSD.org/src/rev/7c715ec5f786
branches:  trunk
changeset: 959026:7c715ec5f786
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Jan 29 22:38:17 2021 +0000

description:
make(1): demonstrate unnecessary creation of empty files in jobs mode

diffstat:

 distrib/sets/lists/tests/mi                     |   4 +++-
 usr.bin/make/unit-tests/Makefile                |   3 ++-
 usr.bin/make/unit-tests/jobs-empty-commands.exp |   2 ++
 usr.bin/make/unit-tests/jobs-empty-commands.mk  |  17 +++++++++++++++++
 4 files changed, 24 insertions(+), 2 deletions(-)

diffs (62 lines):

diff -r 163195206e1e -r 7c715ec5f786 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Fri Jan 29 15:49:55 2021 +0000
+++ b/distrib/sets/lists/tests/mi       Fri Jan 29 22:38:17 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1012 2021/01/17 23:00:41 rillig Exp $
+# $NetBSD: mi,v 1.1013 2021/01/29 22:38:17 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5146,6 +5146,8 @@
 ./usr/tests/usr.bin/make/unit-tests/job-flags.mk                               tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/job-output-long-lines.exp                  tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/job-output-long-lines.mk                   tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/jobs-empty-commands.exp                    tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/jobs-empty-commands.mk                     tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/jobs-error-indirect.exp                    tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/jobs-error-indirect.mk                     tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/jobs-error-nested-make.exp                 tests-usr.bin-tests     compattestfile,atf
diff -r 163195206e1e -r 7c715ec5f786 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Fri Jan 29 15:49:55 2021 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Fri Jan 29 22:38:17 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.262 2021/01/23 07:34:00 rillig Exp $
+# $NetBSD: Makefile,v 1.263 2021/01/29 22:38:17 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -201,6 +201,7 @@
 TESTS+=                include-main
 TESTS+=                job-flags
 TESTS+=                job-output-long-lines
+TESTS+=                jobs-empty-commands
 TESTS+=                jobs-error-indirect
 TESTS+=                jobs-error-nested
 TESTS+=                jobs-error-nested-make
diff -r 163195206e1e -r 7c715ec5f786 usr.bin/make/unit-tests/jobs-empty-commands.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/jobs-empty-commands.exp   Fri Jan 29 22:38:17 2021 +0000
@@ -0,0 +1,2 @@
+action
+exit status 0
diff -r 163195206e1e -r 7c715ec5f786 usr.bin/make/unit-tests/jobs-empty-commands.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/jobs-empty-commands.mk    Fri Jan 29 22:38:17 2021 +0000
@@ -0,0 +1,17 @@
+# $NetBSD: jobs-empty-commands.mk,v 1.1 2021/01/29 22:38:17 rillig Exp $
+#
+# In jobs mode, the shell commands for creating a target are written to a
+# temporary file first, which is then run by the shell.  In chains of
+# dependencies, these files would end up empty.  This can be avoided easily.
+#
+# https://mail-index.netbsd.org/current-users/2021/01/26/msg040215.html
+
+.MAKEFLAGS: -j1
+#.MAKEFLAGS: -dn               # to see the created temporary files
+
+all: .PHONY step-1
+.for i i_plus_1 in ${:U:range=100:@i@$i $i@:[2..199]}
+step-$i: .PHONY step-${i_plus_1}
+.endfor
+step-100: .PHONY
+       @echo 'action'



Home | Main Index | Thread Index | Old Index