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 tests/make: extend test suite, move ...
details: https://anonhg.NetBSD.org/src/rev/8f92776448d1
branches: trunk
changeset: 359797:8f92776448d1
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jan 23 16:09:38 2022 +0000
description:
tests/make: extend test suite, move old tests to 2020 scheme
The tests from envfirst.mk are now in opt-env.mk.
The tests from modword.mk are now in varmod-select-words.mk.
diffstat:
distrib/sets/lists/tests/mi | 10 +-
usr.bin/make/unit-tests/Makefile | 4 +-
usr.bin/make/unit-tests/directive-sinclude.exp | 5 +-
usr.bin/make/unit-tests/directive-sinclude.mk | 16 +-
usr.bin/make/unit-tests/directive-unexport-env.mk | 5 +-
usr.bin/make/unit-tests/directive-warning.exp | 16 +-
usr.bin/make/unit-tests/directive-warning.mk | 9 +-
usr.bin/make/unit-tests/directive.exp | 12 +-
usr.bin/make/unit-tests/directive.mk | 15 +-
usr.bin/make/unit-tests/envfirst.exp | 1 -
usr.bin/make/unit-tests/envfirst.mk | 44 -----
usr.bin/make/unit-tests/modword.exp | 126 -----------------
usr.bin/make/unit-tests/modword.mk | 161 ---------------------
usr.bin/make/unit-tests/opt-debug-cond.exp | 5 +
usr.bin/make/unit-tests/opt-debug-cond.mk | 22 ++-
usr.bin/make/unit-tests/opt-debug-curdir.mk | 10 +-
usr.bin/make/unit-tests/opt-debug-var.exp | 6 +
usr.bin/make/unit-tests/opt-debug-var.mk | 30 +++-
usr.bin/make/unit-tests/opt-debug-x-trace.exp | 2 +
usr.bin/make/unit-tests/opt-debug-x-trace.mk | 10 +-
usr.bin/make/unit-tests/opt-define.mk | 30 +++-
usr.bin/make/unit-tests/opt-env.exp | 6 +-
usr.bin/make/unit-tests/opt-env.mk | 45 +++++-
usr.bin/make/unit-tests/opt-jobs-internal.exp | 7 +-
usr.bin/make/unit-tests/opt-jobs-internal.mk | 11 +-
usr.bin/make/unit-tests/opt-raw.mk | 16 +-
usr.bin/make/unit-tests/opt-silent.exp | 2 +
usr.bin/make/unit-tests/opt-silent.mk | 8 +-
usr.bin/make/unit-tests/sh.mk | 5 +-
usr.bin/make/unit-tests/var-class-global.mk | 18 +-
usr.bin/make/unit-tests/varmod-select-words.exp | 125 ++++++++++++++++
usr.bin/make/unit-tests/varmod-select-words.mk | 162 +++++++++++++++++++++-
32 files changed, 523 insertions(+), 421 deletions(-)
diffs (truncated from 1233 to 300 lines):
diff -r b054ed4c1a6d -r 8f92776448d1 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Sun Jan 23 14:55:28 2022 +0000
+++ b/distrib/sets/lists/tests/mi Sun Jan 23 16:09:38 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1182 2022/01/19 22:10:41 rillig Exp $
+# $NetBSD: mi,v 1.1183 2022/01/23 16:09:38 rillig Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -5659,8 +5659,8 @@
./usr/tests/usr.bin/make/unit-tests/doterror.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/dotwait.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/dotwait.mk tests-usr.bin-tests compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/envfirst.exp tests-usr.bin-tests compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/envfirst.mk tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/envfirst.exp tests-obsolete obsolete,atf
+./usr/tests/usr.bin/make/unit-tests/envfirst.mk tests-obsolete obsolete,atf
./usr/tests/usr.bin/make/unit-tests/error.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/error.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/escape.exp tests-usr.bin-tests compattestfile,atf
@@ -5723,8 +5723,8 @@
./usr/tests/usr.bin/make/unit-tests/modorder.mk tests-obsolete obsolete
./usr/tests/usr.bin/make/unit-tests/modts.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/modts.mk tests-usr.bin-tests compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/modword.exp tests-usr.bin-tests compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/modword.mk tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/modword.exp tests-obsolete obsolete,atf
+./usr/tests/usr.bin/make/unit-tests/modword.mk tests-obsolete obsolete,atf
./usr/tests/usr.bin/make/unit-tests/objdir-writable.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/objdir-writable.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/opt-backwards.exp tests-usr.bin-tests compattestfile,atf
diff -r b054ed4c1a6d -r 8f92776448d1 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile Sun Jan 23 14:55:28 2022 +0000
+++ b/usr.bin/make/unit-tests/Makefile Sun Jan 23 16:09:38 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.297 2022/01/22 16:23:56 rillig Exp $
+# $NetBSD: Makefile,v 1.298 2022/01/23 16:09:38 rillig Exp $
#
# Unit tests for make(1)
#
@@ -192,7 +192,6 @@
TESTS+= dollar
TESTS+= doterror
TESTS+= dotwait
-TESTS+= envfirst
TESTS+= error
TESTS+= # escape # broken by reverting POSIX changes
TESTS+= export
@@ -220,7 +219,6 @@
TESTS+= modmatch
TESTS+= modmisc
TESTS+= modts
-TESTS+= modword
.if ${.MAKE.UID} > 0
TESTS+= objdir-writable
.endif
diff -r b054ed4c1a6d -r 8f92776448d1 usr.bin/make/unit-tests/directive-sinclude.exp
--- a/usr.bin/make/unit-tests/directive-sinclude.exp Sun Jan 23 14:55:28 2022 +0000
+++ b/usr.bin/make/unit-tests/directive-sinclude.exp Sun Jan 23 16:09:38 2022 +0000
@@ -1,1 +1,4 @@
-exit status 0
+make: "directive-include-error.inc" line 1: Invalid line type
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
diff -r b054ed4c1a6d -r 8f92776448d1 usr.bin/make/unit-tests/directive-sinclude.mk
--- a/usr.bin/make/unit-tests/directive-sinclude.mk Sun Jan 23 14:55:28 2022 +0000
+++ b/usr.bin/make/unit-tests/directive-sinclude.mk Sun Jan 23 16:09:38 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: directive-sinclude.mk,v 1.2 2020/11/15 20:20:58 rillig Exp $
+# $NetBSD: directive-sinclude.mk,v 1.3 2022/01/23 16:09:38 rillig Exp $
#
# Tests for the .sinclude directive, which includes another file,
# silently skipping it if it cannot be opened.
@@ -7,7 +7,17 @@
# opened. Parse errors and other errors are handled the same way as in the
# other .include directives.
-# TODO: Implementation
+# No complaint that there is no such file.
+.sinclude "${.CURDIR}/directive-include-nonexistent.inc"
+
+# No complaint either, even though the operating system error is ENOTDIR, not
+# ENOENT.
+.sinclude "${MAKEFILE}/subdir"
+
+# Errors that are not related to opening the file are still reported.
+# expect: make: "directive-include-error.inc" line 1: Invalid line type
+_!= echo 'syntax error' > directive-include-error.inc
+.sinclude "${.CURDIR}/directive-include-error.inc"
+_!= rm directive-include-error.inc
all:
- @:;
diff -r b054ed4c1a6d -r 8f92776448d1 usr.bin/make/unit-tests/directive-unexport-env.mk
--- a/usr.bin/make/unit-tests/directive-unexport-env.mk Sun Jan 23 14:55:28 2022 +0000
+++ b/usr.bin/make/unit-tests/directive-unexport-env.mk Sun Jan 23 16:09:38 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: directive-unexport-env.mk,v 1.7 2020/12/12 18:11:42 rillig Exp $
+# $NetBSD: directive-unexport-env.mk,v 1.8 2022/01/23 16:09:38 rillig Exp $
#
# Tests for the .unexport-env directive.
#
@@ -21,5 +21,4 @@
.unexport-env UT_EXPORTED UT_UNEXPORTED
.MAKEFLAGS: -d0
-all:
- @:;
+all: .PHONY
diff -r b054ed4c1a6d -r 8f92776448d1 usr.bin/make/unit-tests/directive-warning.exp
--- a/usr.bin/make/unit-tests/directive-warning.exp Sun Jan 23 14:55:28 2022 +0000
+++ b/usr.bin/make/unit-tests/directive-warning.exp Sun Jan 23 16:09:38 2022 +0000
@@ -1,11 +1,11 @@
-make: "directive-warning.mk" line 11: Unknown directive "warn"
-make: "directive-warning.mk" line 12: Unknown directive "warn"
-make: "directive-warning.mk" line 13: Unknown directive "warnin"
-make: "directive-warning.mk" line 14: Unknown directive "warnin"
-make: "directive-warning.mk" line 15: Missing argument for ".warning"
-make: "directive-warning.mk" line 16: warning: message
-make: "directive-warning.mk" line 17: Unknown directive "warnings"
-make: "directive-warning.mk" line 18: Unknown directive "warnings"
+make: "directive-warning.mk" line 9: Unknown directive "warn"
+make: "directive-warning.mk" line 10: Unknown directive "warn"
+make: "directive-warning.mk" line 11: Unknown directive "warnin"
+make: "directive-warning.mk" line 12: Unknown directive "warnin"
+make: "directive-warning.mk" line 13: Missing argument for ".warning"
+make: "directive-warning.mk" line 14: warning: message
+make: "directive-warning.mk" line 15: Unknown directive "warnings"
+make: "directive-warning.mk" line 16: Unknown directive "warnings"
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff -r b054ed4c1a6d -r 8f92776448d1 usr.bin/make/unit-tests/directive-warning.mk
--- a/usr.bin/make/unit-tests/directive-warning.mk Sun Jan 23 14:55:28 2022 +0000
+++ b/usr.bin/make/unit-tests/directive-warning.mk Sun Jan 23 16:09:38 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: directive-warning.mk,v 1.6 2020/12/19 22:33:11 rillig Exp $
+# $NetBSD: directive-warning.mk,v 1.7 2022/01/23 16:09:38 rillig Exp $
#
# Tests for the .warning directive.
#
@@ -6,16 +6,13 @@
# produced the wrong error message "Unknown directive". Since parse.c 1.503
# from 2020-12-19, the correct "Missing argument" is produced.
-# TODO: Implementation
-
.warn # misspelled
.warn message # misspelled
.warnin # misspelled
.warnin message # misspelled
.warning # "Missing argument"
-.warning message # ok
+.warning message # expect+0: message
.warnings # misspelled
.warnings messages # Accepted before 2020-12-13 01:07:54.
-all:
- @:;
+all: .PHONY
diff -r b054ed4c1a6d -r 8f92776448d1 usr.bin/make/unit-tests/directive.exp
--- a/usr.bin/make/unit-tests/directive.exp Sun Jan 23 14:55:28 2022 +0000
+++ b/usr.bin/make/unit-tests/directive.exp Sun Jan 23 16:09:38 2022 +0000
@@ -1,14 +1,14 @@
-make: "directive.mk" line 9: Unknown directive "indented"
make: "directive.mk" line 10: Unknown directive "indented"
-make: "directive.mk" line 11: Unknown directive "indented"
-make: "directive.mk" line 15: Unknown directive "info"
+make: "directive.mk" line 12: Unknown directive "indented"
+make: "directive.mk" line 14: Unknown directive "indented"
+make: "directive.mk" line 21: Unknown directive "info"
Global: .info =
Global: .info = value
-make: "directive.mk" line 26: := value
+make: "directive.mk" line 33: := value
Global: .MAKEFLAGS = -r -k -d v -d
Global: .MAKEFLAGS = -r -k -d v -d 0
-make: "directive.mk" line 35: Invalid line type
-make: "directive.mk" line 38: Invalid line type
+make: "directive.mk" line 42: Invalid line type
+make: "directive.mk" line 45: Invalid line type
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff -r b054ed4c1a6d -r 8f92776448d1 usr.bin/make/unit-tests/directive.mk
--- a/usr.bin/make/unit-tests/directive.mk Sun Jan 23 14:55:28 2022 +0000
+++ b/usr.bin/make/unit-tests/directive.mk Sun Jan 23 16:09:38 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: directive.mk,v 1.5 2021/12/13 23:38:54 rillig Exp $
+# $NetBSD: directive.mk,v 1.6 2022/01/23 16:09:38 rillig Exp $
#
# Tests for the preprocessing directives, such as .if or .info.
@@ -6,23 +6,30 @@
# Unknown directives are correctly named in the error messages,
# even if they are indented.
+# expect+1: Unknown directive "indented"
.indented none
+# expect+1: Unknown directive "indented"
. indented 2 spaces
+# expect+1: Unknown directive "indented"
. indented tab
# Directives must be written directly, not indirectly via variable
# expressions.
+# FIXME: The error message is misleading because it shows the expanded text of
+# the line, while the parser works on the unexpanded line.
+# expect+1: Unknown directive "info"
.${:Uinfo} directives cannot be indirect
# There is no directive called '.target', therefore this is parsed as a
# dependency declaration with 2 targets and 1 source.
.target target: source
-# This looks ambiguous. It could be either an .info message or a variable
-# assignment. It is a variable assignment.
+# The following lines demonstrate how the parser tells an .info message apart
+# from a variable assignment to ".info", which syntactically is very similar.
.MAKEFLAGS: -dv
-.info:= value
+.info:= value # This is a variable assignment.
.info?= value # This is a variable assignment as well.
+# expect+1: := value
.info := value # The space after the '.info' makes this
# a directive.
.MAKEFLAGS: -d0
diff -r b054ed4c1a6d -r 8f92776448d1 usr.bin/make/unit-tests/envfirst.exp
--- a/usr.bin/make/unit-tests/envfirst.exp Sun Jan 23 14:55:28 2022 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-exit status 0
diff -r b054ed4c1a6d -r 8f92776448d1 usr.bin/make/unit-tests/envfirst.mk
--- a/usr.bin/make/unit-tests/envfirst.mk Sun Jan 23 14:55:28 2022 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-# $NetBSD: envfirst.mk,v 1.5 2021/02/04 21:42:47 rillig Exp $
-#
-# The -e option makes environment variables stronger than global variables.
-
-.MAKEFLAGS: -e
-
-.if ${FROM_ENV} != value-from-env
-. error ${FROM_ENV}
-.endif
-
-# Try to override the variable; this does not have any effect.
-FROM_ENV= value-from-mk
-.if ${FROM_ENV} != value-from-env
-. error ${FROM_ENV}
-.endif
-
-# Try to append to the variable; this also doesn't have any effect.
-FROM_ENV+= appended
-.if ${FROM_ENV} != value-from-env
-. error ${FROM_ENV}
-.endif
-
-# The default assignment also cannot change the variable.
-FROM_ENV?= default
-.if ${FROM_ENV} != value-from-env
-. error ${FROM_ENV}
-.endif
-
-# Neither can the assignment modifiers.
-.if ${FROM_ENV::=from-condition}
-.endif
-.if ${FROM_ENV} != value-from-env
-. error ${FROM_ENV}
-.endif
-
-# Even .undef doesn't work since it only affects the global scope,
-# which is independent from the environment variables.
-.undef FROM_ENV
-.if ${FROM_ENV} != value-from-env
-. error ${FROM_ENV}
-.endif
-
-all:
- @: nothing
diff -r b054ed4c1a6d -r 8f92776448d1 usr.bin/make/unit-tests/modword.exp
--- a/usr.bin/make/unit-tests/modword.exp Sun Jan 23 14:55:28 2022 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-make: Bad modifier ":[]" for variable "LIST"
-LIST:[]="" is an error
-LIST:[0]="one two three four five six"
-LIST:[0x0]="one two three four five six"
-LIST:[000]="one two three four five six"
-LIST:[*]="one two three four five six"
-LIST:[@]="one two three four five six"
-LIST:[0]:C/ /,/="one,two three four five six"
-LIST:[0]:C/ /,/g="one,two,three,four,five,six"
-LIST:[0]:C/ /,/1g="one,two,three,four,five,six"
-LIST:[*]:C/ /,/="one,two three four five six"
-LIST:[*]:C/ /,/g="one,two,three,four,five,six"
-LIST:[*]:C/ /,/1g="one,two,three,four,five,six"
-LIST:[@]:C/ /,/="one two three four five six"
-LIST:[@]:C/ /,/g="one two three four five six"
Home |
Main Index |
Thread Index |
Old Index