Module Name:    src
Committed By:   rillig
Date:           Fri Apr 15 09:33:20 UTC 2022

Modified Files:
        src/usr.bin/make: cond.c
        src/usr.bin/make/unit-tests: check-expect.lua deptgt-silent-jobs.mk
            opt-debug-cond.mk varname-dot-suffixes.mk

Log Message:
tests/make: adjust expectations to actual behavior

The bug in deptgt-silent-jobs.mk has been fixed, the debug logging for
comparing conditions and for deleting global variables has changed
intentionally.


To generate a diff of this commit:
cvs rdiff -u -r1.333 -r1.334 src/usr.bin/make/cond.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/check-expect.lua \
    src/usr.bin/make/unit-tests/deptgt-silent-jobs.mk \
    src/usr.bin/make/unit-tests/opt-debug-cond.mk \
    src/usr.bin/make/unit-tests/varname-dot-suffixes.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.333 src/usr.bin/make/cond.c:1.334
--- src/usr.bin/make/cond.c:1.333	Thu Mar  3 19:46:31 2022
+++ src/usr.bin/make/cond.c	Fri Apr 15 09:33:20 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.333 2022/03/03 19:46:31 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.334 2022/04/15 09:33:20 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -95,7 +95,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.333 2022/03/03 19:46:31 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.334 2022/04/15 09:33:20 rillig Exp $");
 
 /*
  * Conditional expressions conform to this grammar:
@@ -710,7 +710,7 @@ CondParser_FuncCallEmpty(CondParser *par
 	return true;
 }
 
-/* Parse a function call expression, such as 'defined(${file})'. */
+/* Parse a function call expression, such as 'exists(${file})'. */
 static bool
 CondParser_FuncCall(CondParser *par, bool doEval, Token *out_token)
 {

Index: src/usr.bin/make/unit-tests/check-expect.lua
diff -u src/usr.bin/make/unit-tests/check-expect.lua:1.2 src/usr.bin/make/unit-tests/check-expect.lua:1.3
--- src/usr.bin/make/unit-tests/check-expect.lua:1.2	Sat Jan 29 00:52:53 2022
+++ src/usr.bin/make/unit-tests/check-expect.lua	Fri Apr 15 09:33:20 2022
@@ -1,5 +1,5 @@
 #!  /usr/bin/lua
--- $NetBSD: check-expect.lua,v 1.2 2022/01/29 00:52:53 rillig Exp $
+-- $NetBSD: check-expect.lua,v 1.3 2022/04/15 09:33:20 rillig Exp $
 
 --[[
 
@@ -72,7 +72,11 @@ local function check_mk(mk_fname)
   for mk_lineno, mk_line in ipairs(mk_lines) do
     for text in mk_line:gmatch("#%s*expect:%s*(.*)") do
       local i = prev_expect_line
-      while i < #exp_lines and text ~= exp_lines[i + 1] do
+      -- As of 2022-04-15, some lines in the .exp files contain trailing
+      -- whitespace.  If possible, this should be avoided by rewriting the
+      -- debug logging.  When done, the gsub can be removed.
+      -- See deptgt-phony.exp lines 14 and 15.
+      while i < #exp_lines and text ~= exp_lines[i + 1]:gsub("%s*$", "") do
         i = i + 1
       end
       if i < #exp_lines then
Index: src/usr.bin/make/unit-tests/deptgt-silent-jobs.mk
diff -u src/usr.bin/make/unit-tests/deptgt-silent-jobs.mk:1.2 src/usr.bin/make/unit-tests/deptgt-silent-jobs.mk:1.3
--- src/usr.bin/make/unit-tests/deptgt-silent-jobs.mk:1.2	Sat Feb 12 11:14:48 2022
+++ src/usr.bin/make/unit-tests/deptgt-silent-jobs.mk	Fri Apr 15 09:33:20 2022
@@ -1,4 +1,4 @@
-# $NetBSD: deptgt-silent-jobs.mk,v 1.2 2022/02/12 11:14:48 rillig Exp $
+# $NetBSD: deptgt-silent-jobs.mk,v 1.3 2022/04/15 09:33:20 rillig Exp $
 #
 # Ensure that the special dependency target '.SILENT' only affects the amount
 # of output, but not the kind of error handling.
@@ -28,7 +28,6 @@ compat:
 	@${MAKE} -r -f ${MAKEFILE} test VARIANT=compat
 
 # expect: jobs: testing 1
-# expect: echo 'jobs: testing 2'
 # expect: jobs: testing 2
 # expect: jobs: testing 3
 jobs:
Index: src/usr.bin/make/unit-tests/opt-debug-cond.mk
diff -u src/usr.bin/make/unit-tests/opt-debug-cond.mk:1.2 src/usr.bin/make/unit-tests/opt-debug-cond.mk:1.3
--- src/usr.bin/make/unit-tests/opt-debug-cond.mk:1.2	Sun Jan 23 16:09:38 2022
+++ src/usr.bin/make/unit-tests/opt-debug-cond.mk	Fri Apr 15 09:33:20 2022
@@ -1,4 +1,4 @@
-# $NetBSD: opt-debug-cond.mk,v 1.2 2022/01/23 16:09:38 rillig Exp $
+# $NetBSD: opt-debug-cond.mk,v 1.3 2022/04/15 09:33:20 rillig Exp $
 #
 # Tests for the -dc command line option, which adds debug logging for the
 # evaluation of conditional expressions, such as in .if directives and
@@ -7,11 +7,11 @@
 .MAKEFLAGS: -dc
 
 # expect: CondParser_Eval: ${:U12345} > ${:U55555}
-# expect: lhs = 12345.000000, rhs = 55555.000000, op = >
+# expect: Comparing 12345.000000 > 55555.000000
 .if ${:U12345} > ${:U55555}
 
 # expect: CondParser_Eval: "string" != "string"
-# expect: lhs = "string", rhs = "string", op = !=
+# expect: Comparing "string" != "string"
 .elif "string" != "string"
 
 # expect: CondParser_Eval: "nonempty"
Index: src/usr.bin/make/unit-tests/varname-dot-suffixes.mk
diff -u src/usr.bin/make/unit-tests/varname-dot-suffixes.mk:1.2 src/usr.bin/make/unit-tests/varname-dot-suffixes.mk:1.3
--- src/usr.bin/make/unit-tests/varname-dot-suffixes.mk:1.2	Sat Jan 15 12:35:18 2022
+++ src/usr.bin/make/unit-tests/varname-dot-suffixes.mk	Fri Apr 15 09:33:20 2022
@@ -1,4 +1,4 @@
-# $NetBSD: varname-dot-suffixes.mk,v 1.2 2022/01/15 12:35:18 rillig Exp $
+# $NetBSD: varname-dot-suffixes.mk,v 1.3 2022/04/15 09:33:20 rillig Exp $
 #
 # Tests for the special "variable" .SUFFIXES, which lists the suffixes that
 # have been registered for use in suffix transformation rules.  Suffixes are
@@ -51,7 +51,7 @@
 # Deleting .SUFFIXES has no effect since there is no actual variable of that
 # name.
 .MAKEFLAGS: -dv
-# expect: Global:delete .SUFFIXES (not found)
+# expect: Global: delete .SUFFIXES (not found)
 .undef .SUFFIXES
 .MAKEFLAGS: -d0
 .if ${.SUFFIXES} != ".c .o .1 .err .tar.gz"
@@ -97,7 +97,7 @@ _:=		${preserve:L:_=.SUFFIXES}
 # expect: Command: .SUFFIXES = 1 ignored (read-only)
 # expect: Command: .SUFFIXES = 2 ignored (read-only)
 # XXX: Missing space after ':'
-# expect: Command:delete .SUFFIXES (not found)
+# expect: Command: delete .SUFFIXES (not found)
 .if ${1 2:L:@.SUFFIXES@${.SUFFIXES}@} != ".c .o .1 .err .tar.gz .c .o .1 .err .tar.gz"
 .  error
 .endif

Reply via email to