tests/make: test line numbers in debug output for parsing files

This commit is contained in:
rillig 2022-01-08 22:13:43 +00:00
parent e72b1cbbbd
commit 75d4a53089
3 changed files with 15 additions and 6 deletions

View File

@ -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 # 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 # * 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 # * extracting the current value of a variable using the .for loop
# * using shell commands for calculations since make is a text processor # * using shell commands for calculations since make is a text processor
# * using the :: dependency operator for adding commands to a target # * using the :: dependency operator for adding commands to a target

View File

@ -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 in .include from opt-debug-parse.mk:18
ParseEOF: returning to file opt-debug-parse.mk, line 18 ParseEOF: returning to file opt-debug-parse.mk, line 18
SetFilenameVars: ${.PARSEDIR} = `<curdir>' ${.PARSEFILE} = `opt-debug-parse.mk' SetFilenameVars: ${.PARSEDIR} = `<curdir>' ${.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} = `<curdir>' ${.INCLUDEDFROMFILE} = `opt-debug-parse.mk'
ParseEOF: returning to file opt-debug-parse.mk, line 23
SetFilenameVars: ${.PARSEDIR} = `<curdir>' ${.PARSEFILE} = `opt-debug-parse.mk'
Parsing line 25: .MAKEFLAGS: -d0
ParseDependency(.MAKEFLAGS: -d0) ParseDependency(.MAKEFLAGS: -d0)
exit status 0 exit status 0

View File

@ -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 # Tests for the -dp command line option, which adds debug logging about
# makefile parsing. # makefile parsing.
@ -16,9 +16,12 @@
value value
.info trace with multi-line .for loop head .info trace with multi-line .for loop head
.endfor .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'. # 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 .MAKEFLAGS: -d0
all: .PHONY all: .PHONY