Module Name: src Committed By: rillig Date: Sun Sep 25 21:26:23 UTC 2022
Modified Files: src/usr.bin/make/unit-tests: parse-var.exp parse-var.mk Log Message: tests/make: document how variable evaluation needs to be tested It's about 100_000 combinations to cover the basic edge cases. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/parse-var.exp cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/parse-var.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/unit-tests/parse-var.exp diff -u src/usr.bin/make/unit-tests/parse-var.exp:1.4 src/usr.bin/make/unit-tests/parse-var.exp:1.5 --- src/usr.bin/make/unit-tests/parse-var.exp:1.4 Tue Aug 23 19:22:01 2022 +++ src/usr.bin/make/unit-tests/parse-var.exp Sun Sep 25 21:26:23 2022 @@ -1,5 +1,5 @@ make: Unfinished modifier for "BRACE_GROUP" (',' missing) -make: "parse-var.mk" line 57: Malformed conditional (0 && ${BRACE_GROUP:S,${BRACE_PAIR:S,{,{{,},<lbraces>,}) +make: "parse-var.mk" line 130: Malformed conditional (0 && ${BRACE_GROUP:S,${BRACE_PAIR:S,{,{{,},<lbraces>,}) make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/parse-var.mk diff -u src/usr.bin/make/unit-tests/parse-var.mk:1.5 src/usr.bin/make/unit-tests/parse-var.mk:1.6 --- src/usr.bin/make/unit-tests/parse-var.mk:1.5 Tue Aug 23 19:22:01 2022 +++ src/usr.bin/make/unit-tests/parse-var.mk Sun Sep 25 21:26:23 2022 @@ -1,6 +1,79 @@ -# $NetBSD: parse-var.mk,v 1.5 2022/08/23 19:22:01 rillig Exp $ +# $NetBSD: parse-var.mk,v 1.6 2022/09/25 21:26:23 rillig Exp $ # # Tests for parsing variable expressions. +# +# TODO: Add systematic tests for all of the below combinations. +# +# Written form: +# short form +# long form with braces endc == '}' +# long form with parentheses endc == ')' +# indirect modifiers endc == '\0' +# +# Based on: +# undefined variable +# global variable +# command-line variable +# environment variable +# target-local variable +# legacy variable '@F' +# +# VarEvalMode: +# parse +# eval +# eval-undeferr +# eval-keep-dollar +# eval-keep-undef +# eval-keep-dollar-undef +# +# Global mode: +# without -dL +# with -dL +# +# Modifiers: +# no +# yes, stay undefined +# convert to defined +# indirect modifiers, involving changes to VarEvalMode +# +# Error conditions: +# for the short form, EOF after the '$' +# for the short form, each character +# for the long forms, EOF right after '${' +# for the long forms, EOF after the variable name +# for the long forms, EOF after the ':' +# for the long forms, EOF after parsing a modifier +# for the long forms, ':}' +# for each modifier: syntactic error +# for each modifier: evaluation error +# +# Context: +# in a condition, only operand, unquoted +# in a condition, only operand, quoted +# in a condition, left-hand side, unquoted +# in a condition, left-hand side, quoted +# in a condition, right-hand side, unquoted +# in a condition, right-hand side, quoted +# left-hand side of a variable assignment +# right-hand side of a ':=' variable assignment +# right-hand side of a '!=' variable assignment +# shell command in a target +# .info directive +# dependency line +# items in a .for loop +# everywhere else Var_Parse is called +# +# Further influences: +# multi-level evaluations like 'other=${OTHER}' with OTHER='$$ ${THIRD}' +# +# Effects: +# How much does the parsing position advance (pp)? +# What's the value of the expression (out_val)? +# What's the status after parsing the expression (VarParseResult)? +# What error messages are printed (Parse_Error)? +# What no-effect error messages are printed (Error)? +# What error messages should be printed but aren't? +# What other side effects are there? .MAKEFLAGS: -dL