From 75d4a5308963b983acd9911860774005c1f758ea Mon Sep 17 00:00:00 2001 From: rillig Date: Sat, 8 Jan 2022 22:13:43 +0000 Subject: [PATCH] tests/make: test line numbers in debug output for parsing files --- usr.bin/make/unit-tests/hanoi-include.mk | 6 +++--- usr.bin/make/unit-tests/opt-debug-parse.exp | 8 +++++++- usr.bin/make/unit-tests/opt-debug-parse.mk | 7 +++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/usr.bin/make/unit-tests/hanoi-include.mk b/usr.bin/make/unit-tests/hanoi-include.mk index 3ad0a751845a..3b9438bf2169 100644 --- a/usr.bin/make/unit-tests/hanoi-include.mk +++ b/usr.bin/make/unit-tests/hanoi-include.mk @@ -1,10 +1,10 @@ -# $NetBSD: hanoi-include.mk,v 1.1 2020/10/03 17:30:54 rillig Exp $ +# $NetBSD: hanoi-include.mk,v 1.2 2022/01/08 22:13:43 rillig Exp $ # # Implements the Towers of Hanoi puzzle, thereby demonstrating a bunch of -# useful programming techniques: +# more or less useful programming techniques: # # * default assignment using the ?= assignment operator -# * including the same file recursively +# * including the same file recursively (rather unusual) # * extracting the current value of a variable using the .for loop # * using shell commands for calculations since make is a text processor # * using the :: dependency operator for adding commands to a target diff --git a/usr.bin/make/unit-tests/opt-debug-parse.exp b/usr.bin/make/unit-tests/opt-debug-parse.exp index a18fd89e5ac0..bf9cfda8f8e2 100644 --- a/usr.bin/make/unit-tests/opt-debug-parse.exp +++ b/usr.bin/make/unit-tests/opt-debug-parse.exp @@ -5,6 +5,12 @@ make: "opt-debug-parse.mk" line 17: trace with multi-line .for loop head in .include from opt-debug-parse.mk:18 ParseEOF: returning to file opt-debug-parse.mk, line 18 SetFilenameVars: ${.PARSEDIR} = `' ${.PARSEFILE} = `opt-debug-parse.mk' -Parsing line 22: .MAKEFLAGS: -d0 +Parsing line 23: .include "/dev/null" +Parse_PushInput: file /dev/null, line 1 +SetFilenameVars: ${.PARSEDIR} = `/dev' ${.PARSEFILE} = `null' +SetFilenameVars: ${.INCLUDEDFROMDIR} = `' ${.INCLUDEDFROMFILE} = `opt-debug-parse.mk' +ParseEOF: returning to file opt-debug-parse.mk, line 23 +SetFilenameVars: ${.PARSEDIR} = `' ${.PARSEFILE} = `opt-debug-parse.mk' +Parsing line 25: .MAKEFLAGS: -d0 ParseDependency(.MAKEFLAGS: -d0) exit status 0 diff --git a/usr.bin/make/unit-tests/opt-debug-parse.mk b/usr.bin/make/unit-tests/opt-debug-parse.mk index b6b9f0ee38eb..ba086443e394 100644 --- a/usr.bin/make/unit-tests/opt-debug-parse.mk +++ b/usr.bin/make/unit-tests/opt-debug-parse.mk @@ -1,4 +1,4 @@ -# $NetBSD: opt-debug-parse.mk,v 1.2 2022/01/02 03:23:55 rillig Exp $ +# $NetBSD: opt-debug-parse.mk,v 1.3 2022/01/08 22:13:43 rillig Exp $ # # Tests for the -dp command line option, which adds debug logging about # makefile parsing. @@ -16,9 +16,12 @@ value .info trace with multi-line .for loop head .endfor -# FIXME: The .exp file says 'in .include from opt-debug-parse.mk:18', which is +# FIXME: The .exp file says 'in .include from opt-debug-parse.mk:19', which is # completely wrong. It should rather say 'in .for loop from :13'. +# XXX: The debug log should return to "line 24" instead of "line 23". +.include "/dev/null" + .MAKEFLAGS: -d0 all: .PHONY