12c3632d1SSimon J. Gerraty# This is a generated file, do NOT edit!
22c3632d1SSimon J. Gerraty# See contrib/bmake/bsd.after-import.mk
3d4d90f10SMarcel Moolenaar#
42c3632d1SSimon J. Gerraty# $FreeBSD$
5*bd8bde13SSimon J. Gerraty# $Id: Makefile,v 1.174 2022/02/09 02:42:59 sjg Exp $
62c3632d1SSimon J. Gerraty#
7*bd8bde13SSimon J. Gerraty# $NetBSD: Makefile,v 1.303 2022/02/07 22:43:50 rillig Exp $
8d4d90f10SMarcel Moolenaar#
9d4d90f10SMarcel Moolenaar# Unit tests for make(1)
103841c287SSimon J. Gerraty#
11d4d90f10SMarcel Moolenaar# The main targets are:
12d4d90f10SMarcel Moolenaar#
133841c287SSimon J. Gerraty# all:
143841c287SSimon J. Gerraty#	run all the tests
153841c287SSimon J. Gerraty# test:
163841c287SSimon J. Gerraty#	run 'all', and compare to expected results
173841c287SSimon J. Gerraty# accept:
183841c287SSimon J. Gerraty#	move generated output to expected results
19d4d90f10SMarcel Moolenaar#
203841c287SSimon J. Gerraty# Settable variables
213841c287SSimon J. Gerraty#
223841c287SSimon J. Gerraty# TEST_MAKE
233841c287SSimon J. Gerraty#	The make program to be tested.
243841c287SSimon J. Gerraty#
253841c287SSimon J. Gerraty#
263841c287SSimon J. Gerraty# Adding a test case
273841c287SSimon J. Gerraty#
28d4d90f10SMarcel Moolenaar# Each feature should get its own set of tests in its own suitably
29db29cad8SSimon J. Gerraty# named makefile (*.mk), with its own set of expected results (*.exp),
303841c287SSimon J. Gerraty# and it should be added to the TESTS list.
313841c287SSimon J. Gerraty#
322c3632d1SSimon J. Gerraty# A few *.mk files are helper files for other tests (such as include-sub.mk)
332c3632d1SSimon J. Gerraty# and are thus not added to TESTS.  Such files must be ignored in
342c3632d1SSimon J. Gerraty# src/tests/usr.bin/make/t_make.sh.
35d4d90f10SMarcel Moolenaar#
36d4d90f10SMarcel Moolenaar
3778968ce3SSimon J. Gerraty.MAIN: all
3878968ce3SSimon J. Gerraty
3906b9b3e0SSimon J. Gerraty# we use these below but we might be an older make
4006b9b3e0SSimon J. Gerraty.MAKE.OS?= ${uname -s:L:sh}
4106b9b3e0SSimon J. Gerraty.MAKE.UID?= ${id -u:L:sh}
4206b9b3e0SSimon J. Gerraty
433841c287SSimon J. Gerraty# Each test is in a sub-makefile.
443841c287SSimon J. Gerraty# Keep the list sorted.
452c3632d1SSimon J. Gerraty# Any test that is commented out must be ignored in
462c3632d1SSimon J. Gerraty# src/tests/usr.bin/make/t_make.sh as well.
47956e45f6SSimon J. Gerraty#TESTS+=		archive
4806b9b3e0SSimon J. Gerraty#TESTS+=		archive-suffix
49e2eeea75SSimon J. GerratyTESTS+=		cmd-errors
5006b9b3e0SSimon J. GerratyTESTS+=		cmd-errors-jobs
51e2eeea75SSimon J. GerratyTESTS+=		cmd-errors-lint
522c3632d1SSimon J. GerratyTESTS+=		cmd-interrupt
532c3632d1SSimon J. GerratyTESTS+=		cmdline
5478968ce3SSimon J. GerratyTESTS+=		cmdline-redirect-stdin
55e2eeea75SSimon J. GerratyTESTS+=		cmdline-undefined
563841c287SSimon J. GerratyTESTS+=		comment
5706b9b3e0SSimon J. GerratyTESTS+=		compat-error
582c3632d1SSimon J. GerratyTESTS+=		cond-cmp-numeric
592c3632d1SSimon J. GerratyTESTS+=		cond-cmp-numeric-eq
602c3632d1SSimon J. GerratyTESTS+=		cond-cmp-numeric-ge
612c3632d1SSimon J. GerratyTESTS+=		cond-cmp-numeric-gt
622c3632d1SSimon J. GerratyTESTS+=		cond-cmp-numeric-le
632c3632d1SSimon J. GerratyTESTS+=		cond-cmp-numeric-lt
642c3632d1SSimon J. GerratyTESTS+=		cond-cmp-numeric-ne
652c3632d1SSimon J. GerratyTESTS+=		cond-cmp-string
66956e45f6SSimon J. GerratyTESTS+=		cond-cmp-unary
6706b9b3e0SSimon J. GerratyTESTS+=		cond-eof
682c3632d1SSimon J. GerratyTESTS+=		cond-func
692c3632d1SSimon J. GerratyTESTS+=		cond-func-commands
702c3632d1SSimon J. GerratyTESTS+=		cond-func-defined
712c3632d1SSimon J. GerratyTESTS+=		cond-func-empty
722c3632d1SSimon J. GerratyTESTS+=		cond-func-exists
732c3632d1SSimon J. GerratyTESTS+=		cond-func-make
7406b9b3e0SSimon J. GerratyTESTS+=		cond-func-make-main
752c3632d1SSimon J. GerratyTESTS+=		cond-func-target
763841c287SSimon J. GerratyTESTS+=		cond-late
772c3632d1SSimon J. GerratyTESTS+=		cond-op
782c3632d1SSimon J. GerratyTESTS+=		cond-op-and
79e2eeea75SSimon J. GerratyTESTS+=		cond-op-and-lint
802c3632d1SSimon J. GerratyTESTS+=		cond-op-not
812c3632d1SSimon J. GerratyTESTS+=		cond-op-or
82e2eeea75SSimon J. GerratyTESTS+=		cond-op-or-lint
832c3632d1SSimon J. GerratyTESTS+=		cond-op-parentheses
843841c287SSimon J. GerratyTESTS+=		cond-short
852c3632d1SSimon J. GerratyTESTS+=		cond-token-number
862c3632d1SSimon J. GerratyTESTS+=		cond-token-plain
872c3632d1SSimon J. GerratyTESTS+=		cond-token-string
882c3632d1SSimon J. GerratyTESTS+=		cond-token-var
89956e45f6SSimon J. GerratyTESTS+=		cond-undef-lint
903841c287SSimon J. GerratyTESTS+=		cond1
912c3632d1SSimon J. GerratyTESTS+=		counter
92956e45f6SSimon J. GerratyTESTS+=		counter-append
932c3632d1SSimon J. GerratyTESTS+=		dep
942c3632d1SSimon J. GerratyTESTS+=		dep-colon
95956e45f6SSimon J. GerratyTESTS+=		dep-colon-bug-cross-file
962c3632d1SSimon J. GerratyTESTS+=		dep-double-colon
97956e45f6SSimon J. GerratyTESTS+=		dep-double-colon-indep
9822ade366SSimon J. GerratyTESTS+=		dep-duplicate
992c3632d1SSimon J. GerratyTESTS+=		dep-exclam
1002c3632d1SSimon J. GerratyTESTS+=		dep-none
10122ade366SSimon J. GerratyTESTS+=		dep-op-missing
102956e45f6SSimon J. GerratyTESTS+=		dep-percent
1032c3632d1SSimon J. GerratyTESTS+=		dep-var
1042c3632d1SSimon J. GerratyTESTS+=		dep-wildcards
1052c3632d1SSimon J. GerratyTESTS+=		depsrc
106956e45f6SSimon J. GerratyTESTS+=		depsrc-end
1072c3632d1SSimon J. GerratyTESTS+=		depsrc-exec
1082c3632d1SSimon J. GerratyTESTS+=		depsrc-ignore
1092c3632d1SSimon J. GerratyTESTS+=		depsrc-made
1102c3632d1SSimon J. GerratyTESTS+=		depsrc-make
1112c3632d1SSimon J. GerratyTESTS+=		depsrc-meta
1122c3632d1SSimon J. GerratyTESTS+=		depsrc-nometa
1132c3632d1SSimon J. GerratyTESTS+=		depsrc-nometa_cmp
1142c3632d1SSimon J. GerratyTESTS+=		depsrc-nopath
1152c3632d1SSimon J. GerratyTESTS+=		depsrc-notmain
1162c3632d1SSimon J. GerratyTESTS+=		depsrc-optional
1172c3632d1SSimon J. GerratyTESTS+=		depsrc-phony
1182c3632d1SSimon J. GerratyTESTS+=		depsrc-precious
1192c3632d1SSimon J. GerratyTESTS+=		depsrc-recursive
1202c3632d1SSimon J. GerratyTESTS+=		depsrc-silent
1212c3632d1SSimon J. GerratyTESTS+=		depsrc-use
1222c3632d1SSimon J. GerratyTESTS+=		depsrc-usebefore
1232c3632d1SSimon J. GerratyTESTS+=		depsrc-usebefore-double-colon
1242c3632d1SSimon J. GerratyTESTS+=		depsrc-wait
1252c3632d1SSimon J. GerratyTESTS+=		deptgt
1262c3632d1SSimon J. GerratyTESTS+=		deptgt-begin
12706b9b3e0SSimon J. GerratyTESTS+=		deptgt-begin-fail
12806b9b3e0SSimon J. GerratyTESTS+=		deptgt-begin-fail-indirect
1292c3632d1SSimon J. GerratyTESTS+=		deptgt-default
1302c3632d1SSimon J. GerratyTESTS+=		deptgt-delete_on_error
1312c3632d1SSimon J. GerratyTESTS+=		deptgt-end
13206b9b3e0SSimon J. GerratyTESTS+=		deptgt-end-fail
13306b9b3e0SSimon J. GerratyTESTS+=		deptgt-end-fail-all
13406b9b3e0SSimon J. GerratyTESTS+=		deptgt-end-fail-indirect
135956e45f6SSimon J. GerratyTESTS+=		deptgt-end-jobs
1362c3632d1SSimon J. GerratyTESTS+=		deptgt-error
1372c3632d1SSimon J. GerratyTESTS+=		deptgt-ignore
1382c3632d1SSimon J. GerratyTESTS+=		deptgt-interrupt
1392c3632d1SSimon J. GerratyTESTS+=		deptgt-main
1402c3632d1SSimon J. GerratyTESTS+=		deptgt-makeflags
1412c3632d1SSimon J. GerratyTESTS+=		deptgt-no_parallel
1422c3632d1SSimon J. GerratyTESTS+=		deptgt-nopath
1432c3632d1SSimon J. GerratyTESTS+=		deptgt-notparallel
1442c3632d1SSimon J. GerratyTESTS+=		deptgt-objdir
1452c3632d1SSimon J. GerratyTESTS+=		deptgt-order
1462c3632d1SSimon J. GerratyTESTS+=		deptgt-path
1472c3632d1SSimon J. GerratyTESTS+=		deptgt-path-suffix
1482c3632d1SSimon J. GerratyTESTS+=		deptgt-phony
1492c3632d1SSimon J. GerratyTESTS+=		deptgt-precious
1502c3632d1SSimon J. GerratyTESTS+=		deptgt-shell
1512c3632d1SSimon J. GerratyTESTS+=		deptgt-silent
1522c3632d1SSimon J. GerratyTESTS+=		deptgt-stale
1532c3632d1SSimon J. GerratyTESTS+=		deptgt-suffixes
1542c3632d1SSimon J. GerratyTESTS+=		dir
1552c3632d1SSimon J. GerratyTESTS+=		dir-expand-path
1562c3632d1SSimon J. GerratyTESTS+=		directive
157956e45f6SSimon J. GerratyTESTS+=		directive-dinclude
1582c3632d1SSimon J. GerratyTESTS+=		directive-elif
1592c3632d1SSimon J. GerratyTESTS+=		directive-elifdef
1602c3632d1SSimon J. GerratyTESTS+=		directive-elifmake
1612c3632d1SSimon J. GerratyTESTS+=		directive-elifndef
1622c3632d1SSimon J. GerratyTESTS+=		directive-elifnmake
1632c3632d1SSimon J. GerratyTESTS+=		directive-else
16406b9b3e0SSimon J. GerratyTESTS+=		directive-endfor
1652c3632d1SSimon J. GerratyTESTS+=		directive-endif
1662c3632d1SSimon J. GerratyTESTS+=		directive-error
1672c3632d1SSimon J. GerratyTESTS+=		directive-export
1682c3632d1SSimon J. GerratyTESTS+=		directive-export-env
16906b9b3e0SSimon J. GerratyTESTS+=		directive-export-impl
170956e45f6SSimon J. GerratyTESTS+=		directive-export-gmake
1712c3632d1SSimon J. GerratyTESTS+=		directive-export-literal
1722c3632d1SSimon J. GerratyTESTS+=		directive-for
17306b9b3e0SSimon J. GerratyTESTS+=		directive-for-errors
17406b9b3e0SSimon J. GerratyTESTS+=		directive-for-escape
1752c3632d1SSimon J. GerratyTESTS+=		directive-for-generating-endif
1767f1879d6SSimon J. GerratyTESTS+=		directive-for-if
17706b9b3e0SSimon J. GerratyTESTS+=		directive-for-lines
17806b9b3e0SSimon J. GerratyTESTS+=		directive-for-null
179956e45f6SSimon J. GerratyTESTS+=		directive-hyphen-include
1802c3632d1SSimon J. GerratyTESTS+=		directive-if
181e2eeea75SSimon J. GerratyTESTS+=		directive-if-nested
1822c3632d1SSimon J. GerratyTESTS+=		directive-ifdef
1832c3632d1SSimon J. GerratyTESTS+=		directive-ifmake
1842c3632d1SSimon J. GerratyTESTS+=		directive-ifndef
1852c3632d1SSimon J. GerratyTESTS+=		directive-ifnmake
186956e45f6SSimon J. GerratyTESTS+=		directive-include
187956e45f6SSimon J. GerratyTESTS+=		directive-include-fatal
1882c3632d1SSimon J. GerratyTESTS+=		directive-info
18906b9b3e0SSimon J. GerratyTESTS+=		directive-misspellings
190956e45f6SSimon J. GerratyTESTS+=		directive-sinclude
1912c3632d1SSimon J. GerratyTESTS+=		directive-undef
1922c3632d1SSimon J. GerratyTESTS+=		directive-unexport
1932c3632d1SSimon J. GerratyTESTS+=		directive-unexport-env
1942c3632d1SSimon J. GerratyTESTS+=		directive-warning
1953841c287SSimon J. GerratyTESTS+=		dollar
1963841c287SSimon J. GerratyTESTS+=		doterror
1973841c287SSimon J. GerratyTESTS+=		dotwait
1983841c287SSimon J. GerratyTESTS+=		error
1993841c287SSimon J. GerratyTESTS+=		# escape	# broken by reverting POSIX changes
2003841c287SSimon J. GerratyTESTS+=		export
2013841c287SSimon J. GerratyTESTS+=		export-all
2023841c287SSimon J. GerratyTESTS+=		export-env
2032c3632d1SSimon J. GerratyTESTS+=		export-variants
2043841c287SSimon J. GerratyTESTS+=		forloop
2053841c287SSimon J. GerratyTESTS+=		forsubst
206e2eeea75SSimon J. GerratyTESTS+=		gnode-submake
207956e45f6SSimon J. GerratyTESTS+=		hanoi-include
2082c3632d1SSimon J. GerratyTESTS+=		impsrc
2093841c287SSimon J. GerratyTESTS+=		include-main
210e2eeea75SSimon J. GerratyTESTS+=		job-flags
211956e45f6SSimon J. Gerraty#TESTS+=		job-output-long-lines
2129956ced9SSimon J. GerratyTESTS+=		job-output-null
21378968ce3SSimon J. GerratyTESTS+=		jobs-empty-commands
2149956ced9SSimon J. GerratyTESTS+=		jobs-empty-commands-error
21506b9b3e0SSimon J. GerratyTESTS+=		jobs-error-indirect
21606b9b3e0SSimon J. GerratyTESTS+=		jobs-error-nested
21706b9b3e0SSimon J. GerratyTESTS+=		jobs-error-nested-make
2182c3632d1SSimon J. GerratyTESTS+=		lint
2192c3632d1SSimon J. GerratyTESTS+=		make-exported
22006b9b3e0SSimon J. GerratyTESTS+=		meta-cmd-cmp
2213841c287SSimon J. GerratyTESTS+=		moderrs
2223841c287SSimon J. GerratyTESTS+=		modmatch
2233841c287SSimon J. GerratyTESTS+=		modmisc
22406b9b3e0SSimon J. Gerraty.if ${.MAKE.UID} > 0
225e2eeea75SSimon J. GerratyTESTS+=		objdir-writable
22606b9b3e0SSimon J. Gerraty.endif
2272c3632d1SSimon J. GerratyTESTS+=		opt
2282c3632d1SSimon J. GerratyTESTS+=		opt-backwards
2292c3632d1SSimon J. GerratyTESTS+=		opt-chdir
2302c3632d1SSimon J. GerratyTESTS+=		opt-debug
231956e45f6SSimon J. GerratyTESTS+=		opt-debug-all
232956e45f6SSimon J. GerratyTESTS+=		opt-debug-archive
233956e45f6SSimon J. GerratyTESTS+=		opt-debug-curdir
234956e45f6SSimon J. GerratyTESTS+=		opt-debug-cond
235956e45f6SSimon J. GerratyTESTS+=		opt-debug-dir
236956e45f6SSimon J. GerratyTESTS+=		opt-debug-errors
2379956ced9SSimon J. GerratyTESTS+=		opt-debug-errors-jobs
238956e45f6SSimon J. GerratyTESTS+=		opt-debug-file
239956e45f6SSimon J. GerratyTESTS+=		opt-debug-for
240956e45f6SSimon J. GerratyTESTS+=		opt-debug-graph1
241956e45f6SSimon J. GerratyTESTS+=		opt-debug-graph2
242956e45f6SSimon J. GerratyTESTS+=		opt-debug-graph3
243956e45f6SSimon J. GerratyTESTS+=		opt-debug-hash
244956e45f6SSimon J. Gerraty#TESTS+=		opt-debug-jobs
245956e45f6SSimon J. GerratyTESTS+=		opt-debug-lint
246956e45f6SSimon J. GerratyTESTS+=		opt-debug-loud
247956e45f6SSimon J. GerratyTESTS+=		opt-debug-meta
248956e45f6SSimon J. GerratyTESTS+=		opt-debug-making
249956e45f6SSimon J. GerratyTESTS+=		opt-debug-no-rm
250956e45f6SSimon J. GerratyTESTS+=		opt-debug-parse
251956e45f6SSimon J. GerratyTESTS+=		opt-debug-suff
252956e45f6SSimon J. GerratyTESTS+=		opt-debug-targets
253956e45f6SSimon J. GerratyTESTS+=		opt-debug-varraw
254956e45f6SSimon J. GerratyTESTS+=		opt-debug-var
255956e45f6SSimon J. GerratyTESTS+=		opt-debug-x-trace
2562c3632d1SSimon J. GerratyTESTS+=		opt-define
2572c3632d1SSimon J. GerratyTESTS+=		opt-env
2582c3632d1SSimon J. GerratyTESTS+=		opt-file
2592c3632d1SSimon J. GerratyTESTS+=		opt-ignore
2602c3632d1SSimon J. GerratyTESTS+=		opt-include-dir
2612c3632d1SSimon J. GerratyTESTS+=		opt-jobs
2622c3632d1SSimon J. GerratyTESTS+=		opt-jobs-internal
26306b9b3e0SSimon J. GerratyTESTS+=		opt-jobs-no-action
2642c3632d1SSimon J. GerratyTESTS+=		opt-keep-going
26506b9b3e0SSimon J. GerratyTESTS+=		opt-keep-going-multiple
2662c3632d1SSimon J. GerratyTESTS+=		opt-m-include-dir
2672c3632d1SSimon J. GerratyTESTS+=		opt-no-action
2682c3632d1SSimon J. GerratyTESTS+=		opt-no-action-at-all
26906b9b3e0SSimon J. GerratyTESTS+=		opt-no-action-runflags
27078968ce3SSimon J. GerratyTESTS+=		opt-no-action-touch
2712c3632d1SSimon J. GerratyTESTS+=		opt-query
2722c3632d1SSimon J. GerratyTESTS+=		opt-raw
2732c3632d1SSimon J. GerratyTESTS+=		opt-silent
2742c3632d1SSimon J. GerratyTESTS+=		opt-touch
275e2eeea75SSimon J. GerratyTESTS+=		opt-touch-jobs
2762c3632d1SSimon J. GerratyTESTS+=		opt-tracefile
2772c3632d1SSimon J. GerratyTESTS+=		opt-var-expanded
2782c3632d1SSimon J. GerratyTESTS+=		opt-var-literal
27922ade366SSimon J. GerratyTESTS+=		opt-version
2802c3632d1SSimon J. GerratyTESTS+=		opt-warnings-as-errors
2812c3632d1SSimon J. GerratyTESTS+=		opt-where-am-i
2822c3632d1SSimon J. GerratyTESTS+=		opt-x-reduce-exported
2833841c287SSimon J. GerratyTESTS+=		order
28422ade366SSimon J. GerratyTESTS+=		parse
285956e45f6SSimon J. GerratyTESTS+=		parse-var
2862c3632d1SSimon J. GerratyTESTS+=		phony-end
2873841c287SSimon J. GerratyTESTS+=		posix
2883841c287SSimon J. GerratyTESTS+=		# posix1	# broken by reverting POSIX changes
2892c3632d1SSimon J. GerratyTESTS+=		recursive
2902c3632d1SSimon J. GerratyTESTS+=		sh
2912c3632d1SSimon J. GerratyTESTS+=		sh-dots
29206b9b3e0SSimon J. GerratyTESTS+=		sh-errctl
29306b9b3e0SSimon J. GerratyTESTS+=		sh-flags
2942c3632d1SSimon J. GerratyTESTS+=		sh-jobs
2952c3632d1SSimon J. GerratyTESTS+=		sh-jobs-error
2962c3632d1SSimon J. GerratyTESTS+=		sh-leading-at
2972c3632d1SSimon J. GerratyTESTS+=		sh-leading-hyphen
2982c3632d1SSimon J. GerratyTESTS+=		sh-leading-plus
2992c3632d1SSimon J. GerratyTESTS+=		sh-meta-chars
3002c3632d1SSimon J. GerratyTESTS+=		sh-multi-line
3012c3632d1SSimon J. GerratyTESTS+=		sh-single-line
302956e45f6SSimon J. GerratyTESTS+=		shell-csh
303956e45f6SSimon J. GerratyTESTS+=		shell-custom
304e2eeea75SSimon J. Gerraty.if exists(/bin/ksh)
305956e45f6SSimon J. GerratyTESTS+=		shell-ksh
306e2eeea75SSimon J. Gerraty.endif
307956e45f6SSimon J. GerratyTESTS+=		shell-sh
308956e45f6SSimon J. GerratyTESTS+=		suff-add-later
309956e45f6SSimon J. GerratyTESTS+=		suff-clear-regular
310956e45f6SSimon J. GerratyTESTS+=		suff-clear-single
31106b9b3e0SSimon J. GerratyTESTS+=		suff-incomplete
312956e45f6SSimon J. GerratyTESTS+=		suff-lookup
313956e45f6SSimon J. GerratyTESTS+=		suff-main
31406b9b3e0SSimon J. GerratyTESTS+=		suff-main-several
31506b9b3e0SSimon J. GerratyTESTS+=		suff-phony
316956e45f6SSimon J. GerratyTESTS+=		suff-rebuild
317e2eeea75SSimon J. GerratyTESTS+=		suff-self
31806b9b3e0SSimon J. GerratyTESTS+=		suff-transform-debug
319956e45f6SSimon J. GerratyTESTS+=		suff-transform-endless
320956e45f6SSimon J. GerratyTESTS+=		suff-transform-expand
321956e45f6SSimon J. GerratyTESTS+=		suff-transform-select
322*bd8bde13SSimon J. GerratyTESTS+=		suff-use
3233841c287SSimon J. GerratyTESTS+=		sunshcmd
3243841c287SSimon J. GerratyTESTS+=		ternary
3253841c287SSimon J. GerratyTESTS+=		unexport
3263841c287SSimon J. GerratyTESTS+=		unexport-env
3272c3632d1SSimon J. GerratyTESTS+=		use-inference
32822ade366SSimon J. GerratyTESTS+=		var-scope
32922ade366SSimon J. GerratyTESTS+=		var-scope-cmdline
33022ade366SSimon J. GerratyTESTS+=		var-scope-env
33122ade366SSimon J. GerratyTESTS+=		var-scope-global
33222ade366SSimon J. GerratyTESTS+=		var-scope-local
33322ade366SSimon J. GerratyTESTS+=		var-scope-local-legacy
3349956ced9SSimon J. GerratyTESTS+=		var-eval-short
3352c3632d1SSimon J. GerratyTESTS+=		var-op
3362c3632d1SSimon J. GerratyTESTS+=		var-op-append
3372c3632d1SSimon J. GerratyTESTS+=		var-op-assign
3382c3632d1SSimon J. GerratyTESTS+=		var-op-default
3392c3632d1SSimon J. GerratyTESTS+=		var-op-expand
3402c3632d1SSimon J. GerratyTESTS+=		var-op-shell
341956e45f6SSimon J. GerratyTESTS+=		var-op-sunsh
342956e45f6SSimon J. GerratyTESTS+=		var-recursive
3433841c287SSimon J. GerratyTESTS+=		varcmd
3442c3632d1SSimon J. GerratyTESTS+=		vardebug
3452c3632d1SSimon J. GerratyTESTS+=		varfind
3463841c287SSimon J. GerratyTESTS+=		varmisc
3472c3632d1SSimon J. GerratyTESTS+=		varmod
3482c3632d1SSimon J. GerratyTESTS+=		varmod-assign
34922ade366SSimon J. GerratyTESTS+=		varmod-assign-shell
3502c3632d1SSimon J. GerratyTESTS+=		varmod-defined
3513841c287SSimon J. GerratyTESTS+=		varmod-edge
3522c3632d1SSimon J. GerratyTESTS+=		varmod-exclam-shell
3532c3632d1SSimon J. GerratyTESTS+=		varmod-extension
3542c3632d1SSimon J. GerratyTESTS+=		varmod-gmtime
3552c3632d1SSimon J. GerratyTESTS+=		varmod-hash
3562c3632d1SSimon J. GerratyTESTS+=		varmod-head
3572c3632d1SSimon J. GerratyTESTS+=		varmod-ifelse
35806b9b3e0SSimon J. GerratyTESTS+=		varmod-indirect
3592c3632d1SSimon J. GerratyTESTS+=		varmod-l-name-to-value
3602c3632d1SSimon J. GerratyTESTS+=		varmod-localtime
3612c3632d1SSimon J. GerratyTESTS+=		varmod-loop
3627f1879d6SSimon J. GerratyTESTS+=		varmod-loop-delete
3639956ced9SSimon J. GerratyTESTS+=		varmod-loop-varname
3642c3632d1SSimon J. GerratyTESTS+=		varmod-match
3652c3632d1SSimon J. GerratyTESTS+=		varmod-match-escape
3662c3632d1SSimon J. GerratyTESTS+=		varmod-no-match
3672c3632d1SSimon J. GerratyTESTS+=		varmod-order
3687f1879d6SSimon J. GerratyTESTS+=		varmod-order-numeric
3692c3632d1SSimon J. GerratyTESTS+=		varmod-order-reverse
3702c3632d1SSimon J. GerratyTESTS+=		varmod-order-shuffle
3717f1879d6SSimon J. GerratyTESTS+=		varmod-order-string
3722c3632d1SSimon J. GerratyTESTS+=		varmod-path
3732c3632d1SSimon J. GerratyTESTS+=		varmod-quote
3742c3632d1SSimon J. GerratyTESTS+=		varmod-quote-dollar
3752c3632d1SSimon J. GerratyTESTS+=		varmod-range
3762c3632d1SSimon J. GerratyTESTS+=		varmod-remember
3772c3632d1SSimon J. GerratyTESTS+=		varmod-root
3782c3632d1SSimon J. GerratyTESTS+=		varmod-select-words
3792c3632d1SSimon J. GerratyTESTS+=		varmod-shell
3802c3632d1SSimon J. GerratyTESTS+=		varmod-subst
3812c3632d1SSimon J. GerratyTESTS+=		varmod-subst-regex
3829956ced9SSimon J. GerratyTESTS+=		varmod-sun-shell
3832c3632d1SSimon J. GerratyTESTS+=		varmod-sysv
3842c3632d1SSimon J. GerratyTESTS+=		varmod-tail
3852c3632d1SSimon J. GerratyTESTS+=		varmod-to-abs
3862c3632d1SSimon J. GerratyTESTS+=		varmod-to-lower
3872c3632d1SSimon J. GerratyTESTS+=		varmod-to-many-words
3882c3632d1SSimon J. GerratyTESTS+=		varmod-to-one-word
3892c3632d1SSimon J. GerratyTESTS+=		varmod-to-separator
3902c3632d1SSimon J. GerratyTESTS+=		varmod-to-upper
3912c3632d1SSimon J. GerratyTESTS+=		varmod-undefined
3922c3632d1SSimon J. GerratyTESTS+=		varmod-unique
3932c3632d1SSimon J. GerratyTESTS+=		varname
3942c3632d1SSimon J. GerratyTESTS+=		varname-dollar
3952c3632d1SSimon J. GerratyTESTS+=		varname-dot-alltargets
3962c3632d1SSimon J. GerratyTESTS+=		varname-dot-curdir
3972c3632d1SSimon J. GerratyTESTS+=		varname-dot-includes
3982c3632d1SSimon J. GerratyTESTS+=		varname-dot-includedfromdir
3992c3632d1SSimon J. GerratyTESTS+=		varname-dot-includedfromfile
4002c3632d1SSimon J. GerratyTESTS+=		varname-dot-libs
4012c3632d1SSimon J. GerratyTESTS+=		varname-dot-make-dependfile
4022c3632d1SSimon J. GerratyTESTS+=		varname-dot-make-expand_variables
4032c3632d1SSimon J. GerratyTESTS+=		varname-dot-make-exported
4042c3632d1SSimon J. GerratyTESTS+=		varname-dot-make-jobs
4052c3632d1SSimon J. GerratyTESTS+=		varname-dot-make-jobs-prefix
4062c3632d1SSimon J. GerratyTESTS+=		varname-dot-make-level
4072c3632d1SSimon J. GerratyTESTS+=		varname-dot-make-makefile_preference
4082c3632d1SSimon J. GerratyTESTS+=		varname-dot-make-makefiles
4092c3632d1SSimon J. GerratyTESTS+=		varname-dot-make-meta-bailiwick
4102c3632d1SSimon J. GerratyTESTS+=		varname-dot-make-meta-created
4112c3632d1SSimon J. GerratyTESTS+=		varname-dot-make-meta-files
4122c3632d1SSimon J. GerratyTESTS+=		varname-dot-make-meta-ignore_filter
4132c3632d1SSimon J. GerratyTESTS+=		varname-dot-make-meta-ignore_paths
4142c3632d1SSimon J. GerratyTESTS+=		varname-dot-make-meta-ignore_patterns
4152c3632d1SSimon J. GerratyTESTS+=		varname-dot-make-meta-prefix
4162c3632d1SSimon J. GerratyTESTS+=		varname-dot-make-mode
4172c3632d1SSimon J. GerratyTESTS+=		varname-dot-make-path_filemon
4182c3632d1SSimon J. GerratyTESTS+=		varname-dot-make-pid
4192c3632d1SSimon J. GerratyTESTS+=		varname-dot-make-ppid
4202c3632d1SSimon J. GerratyTESTS+=		varname-dot-make-save_dollars
42106b9b3e0SSimon J. GerratyTESTS+=		varname-dot-makeflags
4222c3632d1SSimon J. GerratyTESTS+=		varname-dot-makeoverrides
4232c3632d1SSimon J. GerratyTESTS+=		varname-dot-newline
4242c3632d1SSimon J. GerratyTESTS+=		varname-dot-objdir
4252c3632d1SSimon J. GerratyTESTS+=		varname-dot-parsedir
4262c3632d1SSimon J. GerratyTESTS+=		varname-dot-parsefile
4272c3632d1SSimon J. GerratyTESTS+=		varname-dot-path
4282c3632d1SSimon J. GerratyTESTS+=		varname-dot-shell
4297f1879d6SSimon J. GerratyTESTS+=		varname-dot-suffixes
4302c3632d1SSimon J. GerratyTESTS+=		varname-dot-targets
4312c3632d1SSimon J. GerratyTESTS+=		varname-empty
4322c3632d1SSimon J. GerratyTESTS+=		varname-make
4332c3632d1SSimon J. GerratyTESTS+=		varname-make_print_var_on_error
434956e45f6SSimon J. GerratyTESTS+=		varname-make_print_var_on_error-jobs
435956e45f6SSimon J. GerratyTESTS+=		varname-makefile
4362c3632d1SSimon J. GerratyTESTS+=		varname-makeflags
4372c3632d1SSimon J. GerratyTESTS+=		varname-pwd
4382c3632d1SSimon J. GerratyTESTS+=		varname-vpath
4392c3632d1SSimon J. GerratyTESTS+=		varparse-dynamic
440e2eeea75SSimon J. GerratyTESTS+=		varparse-errors
441956e45f6SSimon J. GerratyTESTS+=		varparse-mod
442956e45f6SSimon J. GerratyTESTS+=		varparse-undef-partial
4433841c287SSimon J. GerratyTESTS+=		varquote
4443841c287SSimon J. Gerraty
4457f1879d6SSimon J. Gerraty# for now at least
4467f1879d6SSimon J. Gerraty.if ${.SHELL:T} == "ksh"
4477f1879d6SSimon J. GerratyBROKEN_TESTS+= sh-flags
4487f1879d6SSimon J. Gerraty.endif
4497f1879d6SSimon J. Gerraty.if ${.MAKE.OS:NDarwin} == ""
4507f1879d6SSimon J. GerratyBROKEN_TESTS+= shell-ksh
4517f1879d6SSimon J. Gerraty.endif
452*bd8bde13SSimon J. Gerraty.if ${.MAKE.OS} == "Linux" && ${.SHELL:tA:T} != "bash"
453*bd8bde13SSimon J. Gerraty.if exists(/etc/os-release)
454*bd8bde13SSimon J. Gerratydistro!= . /etc/os-release && echo $$NAME
455*bd8bde13SSimon J. Gerraty.endif
456*bd8bde13SSimon J. Gerraty# dash fails -x output
457*bd8bde13SSimon J. Gerraty# .SHELL is not bash so may be dash
458*bd8bde13SSimon J. Gerraty# if distro is Ubuntu or we cannot tell, assume the worst
459*bd8bde13SSimon J. Gerraty.if ${distro:U:NUbuntu} == ""
460*bd8bde13SSimon J. GerratyBROKEN_TESTS+= opt-debug-x-trace
461*bd8bde13SSimon J. Gerraty.endif
462*bd8bde13SSimon J. Gerraty.endif
4637f1879d6SSimon J. Gerraty.if ${.MAKE.OS} == "SCO_SV"
4647f1879d6SSimon J. GerratyBROKEN_TESTS+= \
4657f1879d6SSimon J. Gerraty	opt-debug-graph[23] \
4667f1879d6SSimon J. Gerraty	varmod-localtime \
4677f1879d6SSimon J. Gerraty	varmod-to-separator \
4687f1879d6SSimon J. Gerraty
4697f1879d6SSimon J. Gerraty.if ${.SHELL:T} == "bash"
4707f1879d6SSimon J. GerratyBROKEN_TESTS+= job-output-null
4717f1879d6SSimon J. Gerraty.else
4727f1879d6SSimon J. GerratyBROKEN_TESTS+= \
4737f1879d6SSimon J. Gerraty	cmd-interrupt \
4747f1879d6SSimon J. Gerraty	job-flags \
4757f1879d6SSimon J. Gerraty
4767f1879d6SSimon J. Gerraty.endif
4777f1879d6SSimon J. Gerraty.endif
4787f1879d6SSimon J. Gerraty
4797f1879d6SSimon J. Gerraty# Some tests just do not work on some platforms or environments
4807f1879d6SSimon J. Gerraty# so allow for some filtering.
4817f1879d6SSimon J. Gerraty.if !empty(BROKEN_TESTS)
4827f1879d6SSimon J. Gerraty.warning Skipping broken tests: ${BROKEN_TESTS:O:u}
4837f1879d6SSimon J. GerratyTESTS:= ${TESTS:${BROKEN_TESTS:S,^,N,:ts:}}
4847f1879d6SSimon J. Gerraty.endif
4857f1879d6SSimon J. Gerraty
486e2eeea75SSimon J. Gerraty# Ideas for more tests:
487e2eeea75SSimon J. Gerraty#	char-0020-space.mk
488e2eeea75SSimon J. Gerraty#	char-005C-backslash.mk
489e2eeea75SSimon J. Gerraty#	escape-cond-str.mk
490e2eeea75SSimon J. Gerraty#	escape-cond-func-arg.mk
491e2eeea75SSimon J. Gerraty#	escape-varmod.mk
492e2eeea75SSimon J. Gerraty#	escape-varmod-define.mk
493e2eeea75SSimon J. Gerraty#	escape-varmod-match.mk
494e2eeea75SSimon J. Gerraty#	escape-varname.mk
495e2eeea75SSimon J. Gerraty#	escape-varassign-varname.mk
496e2eeea75SSimon J. Gerraty#	escape-varassign-varname-cmdline.mk
497e2eeea75SSimon J. Gerraty#	escape-varassign-value.mk
498e2eeea75SSimon J. Gerraty#	escape-varassign-value-cmdline.mk
499e2eeea75SSimon J. Gerraty#	escape-dependency-source.mk
500e2eeea75SSimon J. Gerraty#	escape-dependency-target.mk
501e2eeea75SSimon J. Gerraty#	escape-for-varname.mk
502e2eeea75SSimon J. Gerraty#	escape-for-item.mk
503e2eeea75SSimon J. Gerraty#	posix-*.mk (see posix.mk and posix1.mk)
504e2eeea75SSimon J. Gerraty
5052c3632d1SSimon J. Gerraty# Additional environment variables for some of the tests.
5062c3632d1SSimon J. Gerraty# The base environment is -i PATH="$PATH".
507e2eeea75SSimon J. GerratyENV.depsrc-optional+=   TZ=UTC
5082c3632d1SSimon J. GerratyENV.envfirst=		FROM_ENV=value-from-env
5092c3632d1SSimon J. GerratyENV.varmisc=		FROM_ENV=env
5102c3632d1SSimon J. GerratyENV.varmisc+=		FROM_ENV_BEFORE=env
5112c3632d1SSimon J. GerratyENV.varmisc+=		FROM_ENV_AFTER=env
5127f1879d6SSimon J. GerratyENV.varmod-localtime+=	TZ=${UTC_1:UEurope/Berlin}
513e2eeea75SSimon J. GerratyENV.varname-vpath+=	VPATH=varname-vpath.dir:varname-vpath.dir2
5142c3632d1SSimon J. Gerraty
5152c3632d1SSimon J. Gerraty# Override make flags for some of the tests; default is -k.
5162c3632d1SSimon J. Gerraty# If possible, write ".MAKEFLAGS: -dv" in the test .mk file instead of
5172c3632d1SSimon J. Gerraty# settings FLAGS.test=-dv here, since that is closer to the test code.
518956e45f6SSimon J. GerratyFLAGS.cond-func-make=		via-cmdline
519e2eeea75SSimon J. GerratyFLAGS.doterror=			# none, especially not -k
52006b9b3e0SSimon J. GerratyFLAGS.jobs-error-indirect=	# none, especially not -k
52106b9b3e0SSimon J. GerratyFLAGS.jobs-error-nested=	# none, especially not -k
52206b9b3e0SSimon J. GerratyFLAGS.jobs-error-nested-make=	# none, especially not -k
523e2eeea75SSimon J. GerratyFLAGS.varname-empty=		-dv '$${:U}=cmdline-u' '=cmdline-plain'
5243841c287SSimon J. Gerraty
525956e45f6SSimon J. Gerraty# Some tests need extra postprocessing.
52606b9b3e0SSimon J. GerratySED_CMDS.dir=		${:D remove output from -DCLEANUP mode }
52706b9b3e0SSimon J. GerratySED_CMDS.dir+=		-e '/^OpenDirs_Done:/d'
52806b9b3e0SSimon J. GerratySED_CMDS.dir+=		-e '/^CachedDir /d'
52906b9b3e0SSimon J. GerratySED_CMDS.export=	-e '/^[^=_A-Za-z0-9]*=/d'
53006b9b3e0SSimon J. GerratySED_CMDS.export-all=	${SED_CMDS.export}
53106b9b3e0SSimon J. GerratySED_CMDS.export-env=	${SED_CMDS.export}
53206b9b3e0SSimon J. GerratySED_CMDS.cmdline=	-e 's,uid${.MAKE.UID}/,,'
533956e45f6SSimon J. GerratySED_CMDS.job-output-long-lines= \
534956e45f6SSimon J. Gerraty	${:D Job separators on their own line are ok. } \
535956e45f6SSimon J. Gerraty	-e '/^--- job-[ab] ---$$/d' \
536956e45f6SSimon J. Gerraty	${:D Plain output lines are ok as well. } \
537956e45f6SSimon J. Gerraty	${:D They may come in multiples of 1024 or as 10000. } \
538956e45f6SSimon J. Gerraty	-e '/^aa*$$/d' \
539956e45f6SSimon J. Gerraty	-e '/^bb*$$/d' \
540956e45f6SSimon J. Gerraty	${:D The following lines should rather not occur since the job } \
541956e45f6SSimon J. Gerraty	${:D marker should always be at the beginning of the line. } \
542956e45f6SSimon J. Gerraty	-e '/^aa*--- job-b ---$$/d' \
543956e45f6SSimon J. Gerraty	-e '/^bb*--- job-a ---$$/d'
5447f1879d6SSimon J. GerratySED_CMDS.opt-chdir=		-e 's,\(nonexistent\).[1-9][0-9]*,\1,' \
5457f1879d6SSimon J. Gerraty	-e '/name/s,file,File,' \
5467f1879d6SSimon J. Gerraty	-e 's,no such,No such,' \
5477f1879d6SSimon J. Gerraty	-e 's,Filename,File name,'
54806b9b3e0SSimon J. GerratySED_CMDS.opt-debug-graph1=	${STD_SED_CMDS.dg1}
54978968ce3SSimon J. GerratySED_CMDS.opt-debug-graph2=	${STD_SED_CMDS.dg2}
55078968ce3SSimon J. GerratySED_CMDS.opt-debug-graph3=	${STD_SED_CMDS.dg3}
55122ade366SSimon J. GerratySED_CMDS.opt-debug-hash=	-e 's,\(numEntries\)=[1-9][0-9],\1=<entries>,'
552956e45f6SSimon J. GerratySED_CMDS.opt-debug-jobs=	-e 's,([0-9][0-9]*),(<pid>),'
553956e45f6SSimon J. GerratySED_CMDS.opt-debug-jobs+=	-e 's,pid [0-9][0-9]*,pid <pid>,'
554956e45f6SSimon J. GerratySED_CMDS.opt-debug-jobs+=	-e 's,Process [0-9][0-9]*,Process <pid>,'
555956e45f6SSimon J. GerratySED_CMDS.opt-debug-jobs+=	-e 's,JobFinish: [0-9][0-9]*,JobFinish: <pid>,'
55606b9b3e0SSimon J. GerratySED_CMDS.opt-debug-jobs+=	-e 's,Command: ${.SHELL:T},Command: <shell>,'
557956e45f6SSimon J. Gerraty# The "-q" may be there or not, see jobs.c, variable shells.
55806b9b3e0SSimon J. GerratySED_CMDS.opt-debug-jobs+=	-e 's,^\(.Command: <shell>\) -q,\1,'
5599956ced9SSimon J. GerratySED_CMDS.opt-debug-lint+=	${STD_SED_CMDS.regex}
56006b9b3e0SSimon J. GerratySED_CMDS.opt-jobs-no-action=	${STD_SED_CMDS.hide-from-output}
56106b9b3e0SSimon J. GerratySED_CMDS.opt-no-action-runflags= ${STD_SED_CMDS.hide-from-output}
56222ade366SSimon J. GerratySED_CMDS.opt-where-am-i=	-e '/usr.obj/d'
5639956ced9SSimon J. Gerraty# For Compat_RunCommand, useShell == false.
56406b9b3e0SSimon J. GerratySED_CMDS.sh-dots=		-e 's,^.*\.\.\.:.*,<not found: ...>,'
5659956ced9SSimon J. Gerraty# For Compat_RunCommand, useShell == true.
56606b9b3e0SSimon J. GerratySED_CMDS.sh-dots+=		-e 's,^make: exec(\(.*\)) failed (.*)$$,<not found: \1>,'
56706b9b3e0SSimon J. GerratySED_CMDS.sh-dots+=		-e 's,^\(\*\*\* Error code \)[1-9][0-9]*,\1<nonzero>,'
56806b9b3e0SSimon J. GerratySED_CMDS.sh-errctl=		${STD_SED_CMDS.dj}
56906b9b3e0SSimon J. GerratySED_CMDS.sh-flags=		${STD_SED_CMDS.hide-from-output}
5707f1879d6SSimon J. GerratySED_CMDS.shell-csh=		${STD_SED_CMDS.white-space}
57106b9b3e0SSimon J. GerratySED_CMDS.suff-main+=		${STD_SED_CMDS.dg1}
57206b9b3e0SSimon J. GerratySED_CMDS.suff-main-several+=	${STD_SED_CMDS.dg1}
57306b9b3e0SSimon J. GerratySED_CMDS.suff-transform-debug+=	${STD_SED_CMDS.dg1}
57478968ce3SSimon J. GerratySED_CMDS.var-op-shell+=		${STD_SED_CMDS.shell}
57578968ce3SSimon J. GerratySED_CMDS.var-op-shell+=		-e '/command/s,No such.*,not found,'
5767f1879d6SSimon J. GerratySED_CMDS.var-op-shell+=		${STD_SED_CMDS.white-space}
57706b9b3e0SSimon J. GerratySED_CMDS.vardebug+=		-e 's,${.SHELL},</path/to/shell>,'
5789956ced9SSimon J. GerratySED_CMDS.varmod-subst-regex+=	${STD_SED_CMDS.regex}
579956e45f6SSimon J. GerratySED_CMDS.varname-dot-parsedir=	-e '/in some cases/ s,^make: "[^"]*,make: "<normalized>,'
580956e45f6SSimon J. GerratySED_CMDS.varname-dot-parsefile=	-e '/in some cases/ s,^make: "[^"]*,make: "<normalized>,'
581956e45f6SSimon J. GerratySED_CMDS.varname-dot-shell=	-e 's, = /[^ ]*, = (details omitted),g'
582956e45f6SSimon J. GerratySED_CMDS.varname-dot-shell+=	-e 's,"/[^" ]*","(details omitted)",g'
583956e45f6SSimon J. GerratySED_CMDS.varname-dot-shell+=	-e 's,\[/[^] ]*\],[(details omitted)],g'
5847f1879d6SSimon J. GerratySED_CMDS.varname-empty=		${.OBJDIR .PARSEDIR .PATH .SHELL:L:@v@-e '/\\$v/d'@}
5852c3632d1SSimon J. Gerraty
5862c3632d1SSimon J. Gerraty# Some tests need an additional round of postprocessing.
58706b9b3e0SSimon J. GerratyPOSTPROC.deptgt-suffixes=	awk '/^\#\*\*\* Suffixes/,/^never-stop/'
588e2eeea75SSimon J. GerratyPOSTPROC.gnode-submake=		awk '/Input graph/, /^$$/'
5892c3632d1SSimon J. Gerraty
5902c3632d1SSimon J. Gerraty# Some tests reuse other tests, which makes them unnecessarily fragile.
5912c3632d1SSimon J. Gerratyexport-all.rawout: export.mk
5922c3632d1SSimon J. Gerratyunexport.rawout: export.mk
5932c3632d1SSimon J. Gerratyunexport-env.rawout: export.mk
5943841c287SSimon J. Gerraty
5953841c287SSimon J. Gerraty# End of the configuration section.
596d4d90f10SMarcel Moolenaar
59706b9b3e0SSimon J. Gerraty# Some standard sed commands, to be used in the SED_CMDS above.
59806b9b3e0SSimon J. Gerraty
59906b9b3e0SSimon J. Gerraty# Omit details such as process IDs from the output of the -dg1 option.
6007f1879d6SSimon J. GerratySTD_SED_CMDS.dg1=	-e '/\#.* \.$$/d'
60106b9b3e0SSimon J. GerratySTD_SED_CMDS.dg1+=	-e '/\.MAKE.PATH_FILEMON/d'
60206b9b3e0SSimon J. GerratySTD_SED_CMDS.dg1+=	-e '/^MAKE_VERSION/d;/^\#.*\/mk/d'
60306b9b3e0SSimon J. GerratySTD_SED_CMDS.dg1+=	-e 's,  ${DEFSYSPATH:U/usr/share/mk}$$,  <defsyspath>,'
60406b9b3e0SSimon J. GerratySTD_SED_CMDS.dg1+=	-e 's,^\(\.MAKE *=\) .*,\1 <details omitted>,'
60506b9b3e0SSimon J. GerratySTD_SED_CMDS.dg1+=	-e 's,^\(\.MAKE\.[A-Z_]* *=\) .*,\1 <details omitted>,'
60606b9b3e0SSimon J. GerratySTD_SED_CMDS.dg1+=	-e 's,^\(MACHINE[_ARCH]* *=\) .*,\1 <details omitted>,'
60706b9b3e0SSimon J. GerratySTD_SED_CMDS.dg1+=	-e 's,^\(MAKE *=\) .*,\1 <details omitted>,'
60878968ce3SSimon J. GerratySTD_SED_CMDS.dg1+=	-e 's,^\(\.SHELL *=\) .*,\1 <details omitted>,'
60978968ce3SSimon J. Gerraty
61078968ce3SSimon J. GerratySTD_SED_CMDS.dg2=	${STD_SED_CMDS.dg1}
61178968ce3SSimon J. GerratySTD_SED_CMDS.dg2+=	-e 's,\(last modified\) ..:..:.. ... ..\, ....,\1 <timestamp>,'
61278968ce3SSimon J. GerratySTD_SED_CMDS.dg3=	${STD_SED_CMDS.dg2}
61306b9b3e0SSimon J. Gerraty
61406b9b3e0SSimon J. Gerraty# Omit details such as process IDs from the output of the -dj option.
61506b9b3e0SSimon J. GerratySTD_SED_CMDS.dj= \
61606b9b3e0SSimon J. Gerraty	-e '/Process/d;/JobFinish:/d' \
61706b9b3e0SSimon J. Gerraty	-e 's,^\(Job_TokenWithdraw\)([0-9]*),\1(<pid>),' \
61806b9b3e0SSimon J. Gerraty	-e 's,^([0-9][0-9]*) \(withdrew token\),(<pid>) \1,' \
61906b9b3e0SSimon J. Gerraty	-e 's, \(pid\) [0-9][0-9]*, \1 <pid>,' \
62006b9b3e0SSimon J. Gerraty	-e 's,^\(	Command:\) .*,\1 <shell>,'
62106b9b3e0SSimon J. Gerraty
62206b9b3e0SSimon J. Gerraty# Reduce the noise for tests running with the -n option, since there is no
62306b9b3e0SSimon J. Gerraty# other way to suppress the echoing of the commands.
62406b9b3e0SSimon J. GerratySTD_SED_CMDS.hide-from-output= \
62506b9b3e0SSimon J. Gerraty	-e '/^echo hide-from-output/d' \
62606b9b3e0SSimon J. Gerraty	-e 's,hide-from-output ,,' \
62706b9b3e0SSimon J. Gerraty	-e 's,hide-from-output,,'
62806b9b3e0SSimon J. Gerraty
62978968ce3SSimon J. Gerraty# Normalize the output for error messages from the shell.
63078968ce3SSimon J. Gerraty#
63178968ce3SSimon J. Gerraty# $shell -c '...'
63278968ce3SSimon J. Gerraty#	NetBSD sh	...: not found
63378968ce3SSimon J. Gerraty#	NetBSD ksh	ksh: ...: not found
63478968ce3SSimon J. Gerraty#	bash 5.0.18	bash: ...: command not found
63578968ce3SSimon J. Gerraty#	bash 5.1.0	bash: line 1: ...: command not found
63678968ce3SSimon J. Gerraty#	dash		dash: 1: ...: not found
63778968ce3SSimon J. Gerraty#
63878968ce3SSimon J. Gerraty# $shell -c '< /nonexistent'
63978968ce3SSimon J. Gerraty#	NetBSD sh	sh: cannot open /nonexistent: no such file
64078968ce3SSimon J. Gerraty#	NetBSD ksh	ksh: cannot open /nonexistent: No such file or directory
64178968ce3SSimon J. Gerraty#	bash 5.0.18	bash: /nonexistent: No such file or directory
64278968ce3SSimon J. Gerraty#	bash 5.1.0	bash: line 1: /nonexistent: No such file or directory
64378968ce3SSimon J. Gerraty#	dash		dash: 1: cannot open /nonexistent: No such file
64478968ce3SSimon J. Gerraty#
64578968ce3SSimon J. Gerraty# echo '< /nonexistent' | $shell
64678968ce3SSimon J. Gerraty#	NetBSD sh	sh: cannot open /nonexistent: no such file
64778968ce3SSimon J. Gerraty#	NetBSD ksh	ksh: <stdin>[1]: cannot open /nonexistent: No such file or directory
64878968ce3SSimon J. Gerraty#	bash 5.0.18	bash: line 1: /nonexistent: No such file or directory
64978968ce3SSimon J. Gerraty#	bash 5.1.0	bash: line 1: /nonexistent: No such file or directory
65078968ce3SSimon J. Gerraty#	dash		dash: 1: cannot open /nonexistent: No such file
65178968ce3SSimon J. Gerraty#
65278968ce3SSimon J. GerratySTD_SED_CMDS.shell+=		-e 's,^${.SHELL:T}: line [0-9][0-9]*: ,,'
65378968ce3SSimon J. GerratySTD_SED_CMDS.shell+=		-e 's,^${.SHELL:T}: [0-9][0-9]*: ,,'
65478968ce3SSimon J. GerratySTD_SED_CMDS.shell+=		-e 's,^${.SHELL:T}: ,,'
65506b9b3e0SSimon J. Gerraty
6567f1879d6SSimon J. GerratySTD_SED_CMDS.white-space=	-e 's,   *, ,g' -e 's,  *$$,,'
6577f1879d6SSimon J. Gerraty
6589956ced9SSimon J. Gerraty# The actual error messages for a failed regcomp or regexec differ between the
6599956ced9SSimon J. Gerraty# implementations.
6609956ced9SSimon J. GerratySTD_SED_CMDS.regex= \
6619956ced9SSimon J. Gerraty	-e 's,\(Regex compilation error:\).*,\1 (details omitted),'
6629956ced9SSimon J. Gerraty
66378968ce3SSimon J. Gerraty# End of the configuration helpers section.
664d4d90f10SMarcel Moolenaar
6652c3632d1SSimon J. Gerraty.sinclude "Makefile.inc"
6662c3632d1SSimon J. Gerraty.sinclude "Makefile.config"
6673841c287SSimon J. Gerraty
668d4d90f10SMarcel MoolenaarUNIT_TESTS:= ${srcdir}
669db29cad8SSimon J. Gerraty.PATH: ${UNIT_TESTS}
670d4d90f10SMarcel Moolenaar
671956e45f6SSimon J. Gerraty.if ${USE_ABSOLUTE_TESTNAMES:Uno} == yes
672956e45f6SSimon J. GerratyOUTFILES=	${TESTS:@test@${.CURDIR:tA}/${test}.out@}
673956e45f6SSimon J. Gerraty.else
6743841c287SSimon J. GerratyOUTFILES=	${TESTS:=.out}
675956e45f6SSimon J. Gerraty.endif
676db29cad8SSimon J. Gerraty
677db29cad8SSimon J. Gerratyall: ${OUTFILES}
678db29cad8SSimon J. Gerraty
6792c3632d1SSimon J. GerratyCLEANFILES=		*.rawout *.out *.status *.tmp *.core *.tmp
680db29cad8SSimon J. GerratyCLEANFILES+=		obj*.[och] lib*.a	# posix1.mk
681db29cad8SSimon J. GerratyCLEANFILES+=		issue* .[ab]*		# suffixes.mk
6822c3632d1SSimon J. GerratyCLEANDIRS=		dir dummy		# posix1.mk
683d4d90f10SMarcel Moolenaar
684d4d90f10SMarcel Moolenaarclean:
685db29cad8SSimon J. Gerraty	rm -f ${CLEANFILES}
6862c3632d1SSimon J. Gerraty	rm -rf ${CLEANDIRS}
687d4d90f10SMarcel Moolenaar
688d4d90f10SMarcel MoolenaarTEST_MAKE?=	${.MAKE}
689d4d90f10SMarcel MoolenaarTOOL_SED?=	sed
690d4d90f10SMarcel MoolenaarTOOL_TR?=	tr
691d4d90f10SMarcel MoolenaarTOOL_DIFF?=	diff
692d4d90f10SMarcel MoolenaarDIFF_FLAGS?=	-u
693d4d90f10SMarcel Moolenaar
6944639b858SSimon J. Gerraty.if defined(.PARSEDIR)
695d4d90f10SMarcel Moolenaar# ensure consistent results from sort(1)
696d4d90f10SMarcel MoolenaarLC_ALL=		C
697d4d90f10SMarcel MoolenaarLANG=		C
698d4d90f10SMarcel Moolenaar.export LANG LC_ALL
6994639b858SSimon J. Gerraty.endif
700d4d90f10SMarcel Moolenaar
7012c3632d1SSimon J. Gerraty.if ${.MAKE.MODE:Unormal:Mmeta} != ""
7022c3632d1SSimon J. Gerraty# we don't need the noise
7032c3632d1SSimon J. Gerraty_MKMSG_TEST= :
7042c3632d1SSimon J. Gerraty.endif
7052c3632d1SSimon J. Gerraty
70678968ce3SSimon J. Gerraty
70778968ce3SSimon J. Gerraty# for many tests we need a TMPDIR that will not collide
70878968ce3SSimon J. Gerraty# with other users.
70978968ce3SSimon J. Gerraty.if ${.OBJDIR} != ${.CURDIR}
71078968ce3SSimon J. Gerraty# easy
71178968ce3SSimon J. GerratyTMPDIR:=	${.OBJDIR}/tmp
7129956ced9SSimon J. Gerraty.elif defined(TMPDIR)
7139956ced9SSimon J. GerratyTMPDIR:=	${TMPDIR}/uid${.MAKE.UID}
71478968ce3SSimon J. Gerraty.else
7159956ced9SSimon J. GerratyTMPDIR:=	/tmp/uid${.MAKE.UID}
71678968ce3SSimon J. Gerraty.endif
71778968ce3SSimon J. Gerraty# make sure it exists
71878968ce3SSimon J. Gerraty.if !exist(${TMPDIR})
71978968ce3SSimon J. Gerratyx!= echo; mkdir -p ${TMPDIR}
72078968ce3SSimon J. Gerraty.endif
72178968ce3SSimon J. Gerraty
7227f1879d6SSimon J. GerratyMAKE_TEST_ENV=	MALLOC_OPTIONS="JA"	# for jemalloc 100
7237f1879d6SSimon J. GerratyMAKE_TEST_ENV+=	MALLOC_CONF="junk:true"	# for jemalloc 510
72478968ce3SSimon J. GerratyMAKE_TEST_ENV+= TMPDIR=${TMPDIR}
725956e45f6SSimon J. Gerraty
72606b9b3e0SSimon J. Gerraty.if ${.MAKE.OS} == "NetBSD"
72706b9b3e0SSimon J. GerratyLIMIT_RESOURCES?=	ulimit -v 200000
72806b9b3e0SSimon J. Gerraty.endif
72906b9b3e0SSimon J. GerratyLIMIT_RESOURCES?=	:
73006b9b3e0SSimon J. Gerraty
731956e45f6SSimon J. Gerraty# Each test is run in a sub-make, to keep the tests for interfering with
732956e45f6SSimon J. Gerraty# each other, and because they use different environment variables and
733956e45f6SSimon J. Gerraty# command line options.
734db29cad8SSimon J. Gerraty.SUFFIXES: .mk .rawout .out
735db29cad8SSimon J. Gerraty.mk.rawout:
7362c3632d1SSimon J. Gerraty	@${_MKMSG_TEST:Uecho '#      test '} ${.PREFIX}
7372c3632d1SSimon J. Gerraty	@set -eu; \
73806b9b3e0SSimon J. Gerraty	${LIMIT_RESOURCES}; \
7392c3632d1SSimon J. Gerraty	cd ${.OBJDIR}; \
740956e45f6SSimon J. Gerraty	env -i PATH="$$PATH" ${MAKE_TEST_ENV} ${ENV.${.PREFIX:T}} \
7412c3632d1SSimon J. Gerraty	  ${TEST_MAKE} \
7422c3632d1SSimon J. Gerraty	    -r -C ${.CURDIR} -f ${.IMPSRC} \
743956e45f6SSimon J. Gerraty	    ${FLAGS.${.PREFIX:T}:U-k} \
7442c3632d1SSimon J. Gerraty	    > ${.TARGET}.tmp 2>&1 \
7452c3632d1SSimon J. Gerraty	&& status=$$? || status=$$?; \
7462c3632d1SSimon J. Gerraty	echo $$status > ${.TARGET:R}.status
747db29cad8SSimon J. Gerraty	@mv ${.TARGET}.tmp ${.TARGET}
748db29cad8SSimon J. Gerraty
749956e45f6SSimon J. Gerraty# Postprocess the test output so that the results can be compared.
7503841c287SSimon J. Gerraty#
7513841c287SSimon J. Gerraty# always pretend .MAKE was called 'make'
7523841c287SSimon J. Gerraty_SED_CMDS+=	-e 's,^${TEST_MAKE:T:S,.,\\.,g}[][0-9]*:,make:,'
7533841c287SSimon J. Gerraty_SED_CMDS+=	-e 's,${TEST_MAKE:S,.,\\.,g},make,'
754e2eeea75SSimon J. Gerraty_SED_CMDS+=	-e 's,${TEST_MAKE:T:S,.,\\.,g}[][0-9]* warning,make warning,'
755e2eeea75SSimon J. Gerraty_SED_CMDS+=	-e 's,^usage: ${TEST_MAKE:T:S,.,\\.,g} ,usage: make ,'
7563841c287SSimon J. Gerraty# replace anything after 'stopped in' with unit-tests
7573841c287SSimon J. Gerraty_SED_CMDS+=	-e '/stopped/s, /.*, unit-tests,'
75822ade366SSimon J. Gerraty# Allow the test files to be placed anywhere.
75922ade366SSimon J. Gerraty_SED_CMDS+=	-e 's,\(\.PARSEDIR}\) = `'"/[^']*'"',\1 = <some-dir>,'
76022ade366SSimon J. Gerraty_SED_CMDS+=	-e 's,\(\.INCLUDEDFROMDIR}\) = `'"/[^']*'"',\1 = <some-dir>,'
76178968ce3SSimon J. Gerraty_SED_CMDS+=	-e 's,${TMPDIR},TMPDIR,g'
7627f1879d6SSimon J. Gerraty# canonicalize ${.OBJDIR} and ${.CURDIR}
7637f1879d6SSimon J. Gerraty.if ${.OBJDIR} != ${.CURDIR}
7647f1879d6SSimon J. Gerraty# yes this is inaccurate but none of the tests expect <objdir> anywhere
7657f1879d6SSimon J. Gerraty# which we get depending on how MAKEOBJDIR is set.
7667f1879d6SSimon J. Gerraty_SED_CMDS+=	-e 's,${.OBJDIR},<curdir>,g'
7677f1879d6SSimon J. Gerraty.endif
7687f1879d6SSimon J. Gerraty_SED_CMDS+=	-e 's,${.CURDIR},<curdir>,g'
7697f1879d6SSimon J. Gerraty_SED_CMDS+=	-e 's,<curdir>/,,g'
7703841c287SSimon J. Gerraty_SED_CMDS+=	-e 's,${UNIT_TESTS:S,.,\\.,g}/,,g'
7717f1879d6SSimon J. Gerraty# on AT&T derived systems: false exits 255 not 1
77206b9b3e0SSimon J. Gerraty.if ${.MAKE.OS:N*BSD} != ""
77306b9b3e0SSimon J. Gerraty_SED_CMDS+=	-e 's,\(Error code\) 255,\1 1,'
77406b9b3e0SSimon J. Gerraty.endif
7757f1879d6SSimon J. Gerraty.if ${.SHELL:T} == "ksh"
7767f1879d6SSimon J. Gerraty_SED_CMDS+=	-e '/^set [+-]v/d'
7777f1879d6SSimon J. Gerraty.endif
7783841c287SSimon J. Gerraty
779db29cad8SSimon J. Gerraty.rawout.out:
780956e45f6SSimon J. Gerraty	@${TOOL_SED} ${_SED_CMDS} ${SED_CMDS.${.PREFIX:T}} \
7812c3632d1SSimon J. Gerraty	  < ${.IMPSRC} > ${.TARGET}.tmp1
782956e45f6SSimon J. Gerraty	@${POSTPROC.${.PREFIX:T}:Ucat} < ${.TARGET}.tmp1 > ${.TARGET}.tmp2
7832c3632d1SSimon J. Gerraty	@rm ${.TARGET}.tmp1
7842c3632d1SSimon J. Gerraty	@echo "exit status `cat ${.TARGET:R}.status`" >> ${.TARGET}.tmp2
7852c3632d1SSimon J. Gerraty	@mv ${.TARGET}.tmp2 ${.TARGET}
786db29cad8SSimon J. Gerraty
78706b9b3e0SSimon J. Gerraty.if empty(DIFF_FLAGS)
78806b9b3e0SSimon J. GerratyDIFF_ECHO= echo
78906b9b3e0SSimon J. Gerraty.else
79006b9b3e0SSimon J. GerratyDIFF_ECHO= :
79106b9b3e0SSimon J. Gerraty.endif
79206b9b3e0SSimon J. Gerraty
793db29cad8SSimon J. Gerraty# Compare all output files
794db29cad8SSimon J. Gerratytest:	${OUTFILES} .PHONY
795db29cad8SSimon J. Gerraty	@failed= ; \
7963841c287SSimon J. Gerraty	for test in ${TESTS}; do \
79706b9b3e0SSimon J. Gerraty	  cmp -s ${UNIT_TESTS}/$${test}.exp $${test}.out && continue || \
79806b9b3e0SSimon J. Gerraty	  ${DIFF_ECHO} diff ${UNIT_TESTS}/$${test}.exp $${test}.out; \
799ac3446e9SSimon J. Gerraty	  ${TOOL_DIFF} ${DIFF_FLAGS} ${UNIT_TESTS}/$${test}.exp $${test}.out \
800db29cad8SSimon J. Gerraty	  || failed="$${failed}$${failed:+ }$${test}" ; \
801db29cad8SSimon J. Gerraty	done ; \
802db29cad8SSimon J. Gerraty	if [ -n "$${failed}" ]; then \
803db29cad8SSimon J. Gerraty	  echo "Failed tests: $${failed}" ; false ; \
804db29cad8SSimon J. Gerraty	else \
805db29cad8SSimon J. Gerraty	  echo "All tests passed" ; \
806db29cad8SSimon J. Gerraty	fi
807d4d90f10SMarcel Moolenaar
808d4d90f10SMarcel Moolenaaraccept:
8093841c287SSimon J. Gerraty	@for test in ${TESTS}; do \
810db29cad8SSimon J. Gerraty	  cmp -s ${UNIT_TESTS}/$${test}.exp $${test}.out \
811db29cad8SSimon J. Gerraty	  || { echo "Replacing $${test}.exp" ; \
812db29cad8SSimon J. Gerraty	       cp $${test}.out ${UNIT_TESTS}/$${test}.exp ; } \
813db29cad8SSimon J. Gerraty	done
814d4d90f10SMarcel Moolenaar
815db29cad8SSimon J. Gerraty.if exists(${TEST_MAKE})
816956e45f6SSimon J. Gerraty${TESTS:=.rawout}: ${TEST_MAKE}
817956e45f6SSimon J. Gerraty# in meta mode, we *know* if a target script is impacted
818956e45f6SSimon J. Gerraty# by a makefile change.
819956e45f6SSimon J. Gerraty.if ${.MAKE.MODE:Unormal:Mmeta} == ""
820956e45f6SSimon J. Gerraty${TESTS:=.rawout}: ${.PARSEDIR}/Makefile
821956e45f6SSimon J. Gerraty.endif
822db29cad8SSimon J. Gerraty.endif
823db29cad8SSimon J. Gerraty
8242c3632d1SSimon J. Gerraty.sinclude <bsd.obj.mk>
825