Makefile revision 1.206 1 # $NetBSD: Makefile,v 1.206 2020/11/18 01:12:00 sjg Exp $
2 #
3 # Unit tests for make(1)
4 #
5 # The main targets are:
6 #
7 # all:
8 # run all the tests
9 # test:
10 # run 'all', and compare to expected results
11 # accept:
12 # move generated output to expected results
13 #
14 # Settable variables
15 #
16 # TEST_MAKE
17 # The make program to be tested.
18 #
19 #
20 # Adding a test case
21 #
22 # Each feature should get its own set of tests in its own suitably
23 # named makefile (*.mk), with its own set of expected results (*.exp),
24 # and it should be added to the TESTS list.
25 #
26 # Any added files must also be added to src/distrib/sets/lists/tests/mi.
27 # To do that, just run "make sync-mi" in this directory.
28 #
29 # A few *.mk files are helper files for other tests (such as include-sub.mk)
30 # and are thus not added to TESTS. Such files must be ignored in
31 # src/tests/usr.bin/make/t_make.sh.
32 #
33
34 # Each test is in a sub-makefile.
35 # Keep the list sorted.
36 # Any test that is commented out must be ignored in
37 # src/tests/usr.bin/make/t_make.sh as well.
38 TESTS+= archive
39 TESTS+= archive-suffix
40 TESTS+= cmd-errors
41 TESTS+= cmd-errors-lint
42 TESTS+= cmd-interrupt
43 TESTS+= cmdline
44 TESTS+= cmdline-undefined
45 TESTS+= comment
46 TESTS+= cond-cmp-numeric
47 TESTS+= cond-cmp-numeric-eq
48 TESTS+= cond-cmp-numeric-ge
49 TESTS+= cond-cmp-numeric-gt
50 TESTS+= cond-cmp-numeric-le
51 TESTS+= cond-cmp-numeric-lt
52 TESTS+= cond-cmp-numeric-ne
53 TESTS+= cond-cmp-string
54 TESTS+= cond-cmp-unary
55 TESTS+= cond-func
56 TESTS+= cond-func-commands
57 TESTS+= cond-func-defined
58 TESTS+= cond-func-empty
59 TESTS+= cond-func-exists
60 TESTS+= cond-func-make
61 TESTS+= cond-func-target
62 TESTS+= cond-late
63 TESTS+= cond-op
64 TESTS+= cond-op-and
65 TESTS+= cond-op-and-lint
66 TESTS+= cond-op-not
67 TESTS+= cond-op-or
68 TESTS+= cond-op-or-lint
69 TESTS+= cond-op-parentheses
70 TESTS+= cond-short
71 TESTS+= cond-token-number
72 TESTS+= cond-token-plain
73 TESTS+= cond-token-string
74 TESTS+= cond-token-var
75 TESTS+= cond-undef-lint
76 TESTS+= cond1
77 TESTS+= counter
78 TESTS+= counter-append
79 TESTS+= dep
80 TESTS+= dep-colon
81 TESTS+= dep-colon-bug-cross-file
82 TESTS+= dep-double-colon
83 TESTS+= dep-double-colon-indep
84 TESTS+= dep-exclam
85 TESTS+= dep-none
86 TESTS+= dep-percent
87 TESTS+= dep-var
88 TESTS+= dep-wildcards
89 TESTS+= depsrc
90 TESTS+= depsrc-end
91 TESTS+= depsrc-exec
92 TESTS+= depsrc-ignore
93 TESTS+= depsrc-made
94 TESTS+= depsrc-make
95 TESTS+= depsrc-meta
96 TESTS+= depsrc-nometa
97 TESTS+= depsrc-nometa_cmp
98 TESTS+= depsrc-nopath
99 TESTS+= depsrc-notmain
100 TESTS+= depsrc-optional
101 TESTS+= depsrc-phony
102 TESTS+= depsrc-precious
103 TESTS+= depsrc-recursive
104 TESTS+= depsrc-silent
105 TESTS+= depsrc-use
106 TESTS+= depsrc-usebefore
107 TESTS+= depsrc-usebefore-double-colon
108 TESTS+= depsrc-wait
109 TESTS+= deptgt
110 TESTS+= deptgt-begin
111 TESTS+= deptgt-default
112 TESTS+= deptgt-delete_on_error
113 TESTS+= deptgt-end
114 TESTS+= deptgt-end-jobs
115 TESTS+= deptgt-error
116 TESTS+= deptgt-ignore
117 TESTS+= deptgt-interrupt
118 TESTS+= deptgt-main
119 TESTS+= deptgt-makeflags
120 TESTS+= deptgt-no_parallel
121 TESTS+= deptgt-nopath
122 TESTS+= deptgt-notparallel
123 TESTS+= deptgt-objdir
124 TESTS+= deptgt-order
125 TESTS+= deptgt-path
126 TESTS+= deptgt-path-suffix
127 TESTS+= deptgt-phony
128 TESTS+= deptgt-precious
129 TESTS+= deptgt-shell
130 TESTS+= deptgt-silent
131 TESTS+= deptgt-stale
132 TESTS+= deptgt-suffixes
133 TESTS+= dir
134 TESTS+= dir-expand-path
135 TESTS+= directive
136 TESTS+= directive-dinclude
137 TESTS+= directive-elif
138 TESTS+= directive-elifdef
139 TESTS+= directive-elifmake
140 TESTS+= directive-elifndef
141 TESTS+= directive-elifnmake
142 TESTS+= directive-else
143 TESTS+= directive-endif
144 TESTS+= directive-error
145 TESTS+= directive-export
146 TESTS+= directive-export-env
147 TESTS+= directive-export-gmake
148 TESTS+= directive-export-literal
149 TESTS+= directive-for
150 TESTS+= directive-for-generating-endif
151 TESTS+= directive-hyphen-include
152 TESTS+= directive-if
153 TESTS+= directive-if-nested
154 TESTS+= directive-ifdef
155 TESTS+= directive-ifmake
156 TESTS+= directive-ifndef
157 TESTS+= directive-ifnmake
158 TESTS+= directive-include
159 TESTS+= directive-include-fatal
160 TESTS+= directive-info
161 TESTS+= directive-sinclude
162 TESTS+= directive-undef
163 TESTS+= directive-unexport
164 TESTS+= directive-unexport-env
165 TESTS+= directive-warning
166 TESTS+= dollar
167 TESTS+= doterror
168 TESTS+= dotwait
169 TESTS+= envfirst
170 TESTS+= error
171 TESTS+= # escape # broken by reverting POSIX changes
172 TESTS+= export
173 TESTS+= export-all
174 TESTS+= export-env
175 TESTS+= export-variants
176 TESTS+= forloop
177 TESTS+= forsubst
178 TESTS+= gnode-submake
179 TESTS+= hanoi-include
180 TESTS+= impsrc
181 TESTS+= include-main
182 TESTS+= job-flags
183 TESTS+= job-output-long-lines
184 TESTS+= lint
185 TESTS+= make-exported
186 TESTS+= moderrs
187 TESTS+= modmatch
188 TESTS+= modmisc
189 TESTS+= modts
190 TESTS+= modword
191 TESTS+= objdir-writable
192 TESTS+= opt
193 TESTS+= opt-backwards
194 TESTS+= opt-chdir
195 TESTS+= opt-debug
196 TESTS+= opt-debug-all
197 TESTS+= opt-debug-archive
198 TESTS+= opt-debug-curdir
199 TESTS+= opt-debug-cond
200 TESTS+= opt-debug-dir
201 TESTS+= opt-debug-errors
202 TESTS+= opt-debug-file
203 TESTS+= opt-debug-for
204 TESTS+= opt-debug-graph1
205 TESTS+= opt-debug-graph2
206 TESTS+= opt-debug-graph3
207 TESTS+= opt-debug-hash
208 TESTS+= opt-debug-jobs
209 TESTS+= opt-debug-lint
210 TESTS+= opt-debug-loud
211 TESTS+= opt-debug-meta
212 TESTS+= opt-debug-making
213 TESTS+= opt-debug-no-rm
214 TESTS+= opt-debug-parse
215 TESTS+= opt-debug-suff
216 TESTS+= opt-debug-targets
217 TESTS+= opt-debug-varraw
218 TESTS+= opt-debug-var
219 TESTS+= opt-debug-x-trace
220 TESTS+= opt-define
221 TESTS+= opt-env
222 TESTS+= opt-file
223 TESTS+= opt-ignore
224 TESTS+= opt-include-dir
225 TESTS+= opt-jobs
226 TESTS+= opt-jobs-internal
227 TESTS+= opt-keep-going
228 TESTS+= opt-m-include-dir
229 TESTS+= opt-no-action
230 TESTS+= opt-no-action-at-all
231 TESTS+= opt-query
232 TESTS+= opt-raw
233 TESTS+= opt-silent
234 TESTS+= opt-touch
235 TESTS+= opt-touch-jobs
236 TESTS+= opt-tracefile
237 TESTS+= opt-var-expanded
238 TESTS+= opt-var-literal
239 TESTS+= opt-warnings-as-errors
240 TESTS+= opt-where-am-i
241 TESTS+= opt-x-reduce-exported
242 TESTS+= order
243 TESTS+= parse-var
244 TESTS+= phony-end
245 TESTS+= posix
246 TESTS+= # posix1 # broken by reverting POSIX changes
247 TESTS+= qequals
248 TESTS+= recursive
249 TESTS+= sh
250 TESTS+= sh-dots
251 TESTS+= sh-jobs
252 TESTS+= sh-jobs-error
253 TESTS+= sh-leading-at
254 TESTS+= sh-leading-hyphen
255 TESTS+= sh-leading-plus
256 TESTS+= sh-meta-chars
257 TESTS+= sh-multi-line
258 TESTS+= sh-single-line
259 TESTS+= shell-csh
260 TESTS+= shell-custom
261 TESTS+= shell-ksh
262 TESTS+= shell-sh
263 TESTS+= suff-add-later
264 TESTS+= suff-clear-regular
265 TESTS+= suff-clear-single
266 TESTS+= suff-lookup
267 TESTS+= suff-main
268 TESTS+= suff-rebuild
269 TESTS+= suff-self
270 TESTS+= suff-transform-endless
271 TESTS+= suff-transform-expand
272 TESTS+= suff-transform-select
273 TESTS+= sunshcmd
274 TESTS+= ternary
275 TESTS+= unexport
276 TESTS+= unexport-env
277 TESTS+= use-inference
278 TESTS+= var-class
279 TESTS+= var-class-cmdline
280 TESTS+= var-class-env
281 TESTS+= var-class-global
282 TESTS+= var-class-local
283 TESTS+= var-class-local-legacy
284 TESTS+= var-op
285 TESTS+= var-op-append
286 TESTS+= var-op-assign
287 TESTS+= var-op-default
288 TESTS+= var-op-expand
289 TESTS+= var-op-shell
290 TESTS+= var-op-sunsh
291 TESTS+= var-recursive
292 TESTS+= varcmd
293 TESTS+= vardebug
294 TESTS+= varfind
295 TESTS+= varmisc
296 TESTS+= varmod
297 TESTS+= varmod-assign
298 TESTS+= varmod-defined
299 TESTS+= varmod-edge
300 TESTS+= varmod-exclam-shell
301 TESTS+= varmod-extension
302 TESTS+= varmod-gmtime
303 TESTS+= varmod-hash
304 TESTS+= varmod-head
305 TESTS+= varmod-ifelse
306 TESTS+= varmod-l-name-to-value
307 TESTS+= varmod-localtime
308 TESTS+= varmod-loop
309 TESTS+= varmod-match
310 TESTS+= varmod-match-escape
311 TESTS+= varmod-no-match
312 TESTS+= varmod-order
313 TESTS+= varmod-order-reverse
314 TESTS+= varmod-order-shuffle
315 TESTS+= varmod-path
316 TESTS+= varmod-quote
317 TESTS+= varmod-quote-dollar
318 TESTS+= varmod-range
319 TESTS+= varmod-remember
320 TESTS+= varmod-root
321 TESTS+= varmod-select-words
322 TESTS+= varmod-shell
323 TESTS+= varmod-subst
324 TESTS+= varmod-subst-regex
325 TESTS+= varmod-sysv
326 TESTS+= varmod-tail
327 TESTS+= varmod-to-abs
328 TESTS+= varmod-to-lower
329 TESTS+= varmod-to-many-words
330 TESTS+= varmod-to-one-word
331 TESTS+= varmod-to-separator
332 TESTS+= varmod-to-upper
333 TESTS+= varmod-undefined
334 TESTS+= varmod-unique
335 TESTS+= varname
336 TESTS+= varname-dollar
337 TESTS+= varname-dot-alltargets
338 TESTS+= varname-dot-curdir
339 TESTS+= varname-dot-includes
340 TESTS+= varname-dot-includedfromdir
341 TESTS+= varname-dot-includedfromfile
342 TESTS+= varname-dot-libs
343 TESTS+= varname-dot-make-dependfile
344 TESTS+= varname-dot-make-expand_variables
345 TESTS+= varname-dot-make-exported
346 TESTS+= varname-dot-make-jobs
347 TESTS+= varname-dot-make-jobs-prefix
348 TESTS+= varname-dot-make-level
349 TESTS+= varname-dot-make-makefile_preference
350 TESTS+= varname-dot-make-makefiles
351 TESTS+= varname-dot-make-meta-bailiwick
352 TESTS+= varname-dot-make-meta-created
353 TESTS+= varname-dot-make-meta-files
354 TESTS+= varname-dot-make-meta-ignore_filter
355 TESTS+= varname-dot-make-meta-ignore_paths
356 TESTS+= varname-dot-make-meta-ignore_patterns
357 TESTS+= varname-dot-make-meta-prefix
358 TESTS+= varname-dot-make-mode
359 TESTS+= varname-dot-make-path_filemon
360 TESTS+= varname-dot-make-pid
361 TESTS+= varname-dot-make-ppid
362 TESTS+= varname-dot-make-save_dollars
363 TESTS+= varname-dot-makeoverrides
364 TESTS+= varname-dot-newline
365 TESTS+= varname-dot-objdir
366 TESTS+= varname-dot-parsedir
367 TESTS+= varname-dot-parsefile
368 TESTS+= varname-dot-path
369 TESTS+= varname-dot-shell
370 TESTS+= varname-dot-targets
371 TESTS+= varname-empty
372 TESTS+= varname-make
373 TESTS+= varname-make_print_var_on_error
374 TESTS+= varname-make_print_var_on_error-jobs
375 TESTS+= varname-makefile
376 TESTS+= varname-makeflags
377 TESTS+= varname-pwd
378 TESTS+= varname-vpath
379 TESTS+= varparse-dynamic
380 TESTS+= varparse-errors
381 TESTS+= varparse-mod
382 TESTS+= varparse-undef-partial
383 TESTS+= varquote
384
385 # Ideas for more tests:
386 # char-0020-space.mk
387 # char-005C-backslash.mk
388 # escape-cond-str.mk
389 # escape-cond-func-arg.mk
390 # escape-cond-func-arg.mk
391 # escape-varmod.mk
392 # escape-varmod-define.mk
393 # escape-varmod-match.mk
394 # escape-varname.mk
395 # escape-varassign-varname.mk
396 # escape-varassign-varname-cmdline.mk
397 # escape-varassign-value.mk
398 # escape-varassign-value-cmdline.mk
399 # escape-dependency-source.mk
400 # escape-dependency-target.mk
401 # escape-for-varname.mk
402 # escape-for-item.mk
403 # posix-*.mk (see posix.mk and posix1.mk)
404
405 .if ${.OBJDIR} != ${.CURDIR}
406 RO_OBJDIR:= ${.OBJDIR}/roobj
407 .else
408 RO_OBJDIR:= ${TMPDIR:U/tmp}/roobj
409 .endif
410 # Additional environment variables for some of the tests.
411 # The base environment is -i PATH="$PATH".
412 ENV.depsrc-optional+= TZ=UTC
413 ENV.envfirst= FROM_ENV=value-from-env
414 ENV.objdir-writable+= RO_OBJDIR=${RO_OBJDIR}
415 ENV.varmisc= FROM_ENV=env
416 ENV.varmisc+= FROM_ENV_BEFORE=env
417 ENV.varmisc+= FROM_ENV_AFTER=env
418 ENV.varmod-localtime+= TZ=Europe/Berlin
419 ENV.varname-vpath+= VPATH=varname-vpath.dir:varname-vpath.dir2
420
421 # Override make flags for some of the tests; default is -k.
422 # If possible, write ".MAKEFLAGS: -dv" in the test .mk file instead of
423 # settings FLAGS.test=-dv here, since that is closer to the test code.
424 FLAGS.cond-func-make= via-cmdline
425 FLAGS.directive-ifmake= first second
426 FLAGS.doterror= # none, especially not -k
427 FLAGS.varname-empty= -dv '$${:U}=cmdline-u' '=cmdline-plain'
428
429 # Some tests need extra postprocessing.
430 SED_CMDS.export= \
431 -e '/^[^=_A-Za-z0-9]*=/d'
432 # these all share the same requirement
433 .for t in export-all export-env
434 SED_CMDS.$t= ${SED_CMDS.export}
435 .endfor
436 SED_CMDS.directive-export-gmake= \
437 ${:D dash is a pain } \
438 -e /non-zero/d
439 SED_CMDS.job-output-long-lines= \
440 ${:D Job separators on their own line are ok. } \
441 -e '/^--- job-[ab] ---$$/d' \
442 ${:D Plain output lines are ok as well. } \
443 ${:D They may come in multiples of 1024 or as 10000. } \
444 -e '/^aa*$$/d' \
445 -e '/^bb*$$/d' \
446 ${:D The following lines should rather not occur since the job } \
447 ${:D marker should always be at the beginning of the line. } \
448 -e '/^aa*--- job-b ---$$/d' \
449 -e '/^bb*--- job-a ---$$/d'
450 SED_CMDS.objdir-writable= -e 's,${RO_OBJDIR},OBJDIR/roobj,g'
451 SED_CMDS.opt-debug-graph1= \
452 -e 's,${.CURDIR},CURDIR,'
453 SED_CMDS.opt-debug-graph1+= \
454 -e '/Global Variables:/,/Suffixes:/d'
455 SED_CMDS.sh-dots= -e 's,^.*\.\.\.:.*,<normalized: ...: not found>,'
456 SED_CMDS.opt-debug-jobs= -e 's,([0-9][0-9]*),(<pid>),'
457 SED_CMDS.opt-debug-jobs+= -e 's,pid [0-9][0-9]*,pid <pid>,'
458 SED_CMDS.opt-debug-jobs+= -e 's,Process [0-9][0-9]*,Process <pid>,'
459 SED_CMDS.opt-debug-jobs+= -e 's,JobFinish: [0-9][0-9]*,JobFinish: <pid>,'
460 # The "-q" may be there or not, see jobs.c, variable shells.
461 SED_CMDS.opt-debug-jobs+= -e 's,^\(.Command: sh\) -q,\1,'
462 SED_CMDS.var-op-shell+= -e 's,^${.SHELL:T}: [ 0-9:]*,,'
463 SED_CMDS.var-op-shell+= -e '/command/{ s,^[1-9]: ,,;s,No such.*,not found,; }'
464 SED_CMDS.vardebug= \
465 ${:D canonicalize .SHELL } \
466 -e 's,${.SHELL},/bin/sh,'
467 SED_CMDS.vardebug+= -e 's,${.SHELL},</path/to/shell>,'
468 SED_CMDS.varmod-subst-regex+= \
469 -e 's,\(Regex compilation error:\).*,\1 (details omitted),'
470 SED_CMDS.varmod-edge+= -e 's, line [0-9]*:, line omitted:,'
471 SED_CMDS.varname-dot-parsedir= -e '/in some cases/ s,^make: "[^"]*,make: "<normalized>,'
472 SED_CMDS.varname-dot-parsefile= -e '/in some cases/ s,^make: "[^"]*,make: "<normalized>,'
473 SED_CMDS.varname-dot-shell= -e 's, = /[^ ]*, = (details omitted),g'
474 SED_CMDS.varname-dot-shell+= -e 's,"/[^" ]*","(details omitted)",g'
475 SED_CMDS.varname-dot-shell+= -e 's,\[/[^] ]*\],[(details omitted)],g'
476
477 # Some tests need an additional round of postprocessing.
478 POSTPROC.deptgt-suffixes= \
479 ${TOOL_SED} -n -e '/^\#\*\*\* Suffixes/,/^\#\*/p'
480 POSTPROC.gnode-submake= awk '/Input graph/, /^$$/'
481 POSTPROC.varname-empty= ${TOOL_SED} -n -e '/^Var_Set/p' -e '/^out:/p'
482
483 # Some tests reuse other tests, which makes them unnecessarily fragile.
484 export-all.rawout: export.mk
485 unexport.rawout: export.mk
486 unexport-env.rawout: export.mk
487
488 # End of the configuration section.
489
490 .MAIN: all
491
492 UNIT_TESTS:= ${.PARSEDIR}
493 .PATH: ${UNIT_TESTS}
494
495 .if ${USE_ABSOLUTE_TESTNAMES:Uno} == yes
496 OUTFILES= ${TESTS:@test@${.CURDIR:tA}/${test}.out@}
497 .else
498 OUTFILES= ${TESTS:=.out}
499 .endif
500
501 all: ${OUTFILES}
502
503 CLEANFILES= *.rawout *.out *.status *.tmp *.core *.tmp
504 CLEANFILES+= obj*.[och] lib*.a # posix1.mk
505 CLEANFILES+= issue* .[ab]* # suffixes.mk
506 CLEANDIRS= dir dummy # posix1.mk
507
508 clean:
509 rm -f ${CLEANFILES}
510 rm -rf ${CLEANDIRS}
511
512 TEST_MAKE?= ${.MAKE}
513 TOOL_SED?= sed
514
515 # ensure consistent results from sort(1)
516 LC_ALL= C
517 LANG= C
518 .export LANG LC_ALL
519
520 MAKE_TEST_ENV?= MALLOC_OPTIONS="JA" # for jemalloc
521
522 # Each test is run in a sub-make, to keep the tests for interfering with
523 # each other, and because they use different environment variables and
524 # command line options.
525 .SUFFIXES: .mk .rawout .out
526 .mk.rawout:
527 @${_MKMSG_TEST:Uecho '# test '} ${.PREFIX}
528 @set -eu; \
529 cd ${.OBJDIR}; \
530 env -i PATH="$$PATH" ${MAKE_TEST_ENV} ${ENV.${.PREFIX:T}} \
531 ${TEST_MAKE} \
532 -r -C ${.CURDIR} -f ${.IMPSRC} \
533 ${FLAGS.${.PREFIX:T}:U-k} \
534 > ${.TARGET}.tmp 2>&1 \
535 && status=$$? || status=$$?; \
536 echo $$status > ${.TARGET:R}.status
537 @mv ${.TARGET}.tmp ${.TARGET}
538
539 # Postprocess the test output so that the results can be compared.
540 #
541 # always pretend .MAKE was called 'make'
542 _SED_CMDS+= -e 's,^${TEST_MAKE:T:S,.,\\.,g}[][0-9]*:,make:,'
543 _SED_CMDS+= -e 's,${TEST_MAKE:S,.,\\.,g},make,'
544 _SED_CMDS+= -e 's,${TEST_MAKE:T:S,.,\\.,g}[][0-9]* warning,make warning,'
545 _SED_CMDS+= -e 's,^usage: ${TEST_MAKE:T:S,.,\\.,g} ,usage: make ,'
546 # replace anything after 'stopped in' with unit-tests
547 _SED_CMDS+= -e '/stopped/s, /.*, unit-tests,'
548 # strip ${.CURDIR}/ from the output
549 _SED_CMDS+= -e 's,${.CURDIR:S,.,\\.,g}/,,g'
550 _SED_CMDS+= -e 's,${UNIT_TESTS:S,.,\\.,g}/,,g'
551
552 .rawout.out:
553 @${TOOL_SED} ${_SED_CMDS} ${SED_CMDS.${.PREFIX:T}} \
554 < ${.IMPSRC} > ${.TARGET}.tmp1
555 @${POSTPROC.${.PREFIX:T}:Ucat} < ${.TARGET}.tmp1 > ${.TARGET}.tmp2
556 @rm ${.TARGET}.tmp1
557 @echo "exit status `cat ${.TARGET:R}.status`" >> ${.TARGET}.tmp2
558 @mv ${.TARGET}.tmp2 ${.TARGET}
559
560 # Compare all output files
561 test: ${OUTFILES} .PHONY
562 @failed= ; \
563 for test in ${TESTS}; do \
564 diff -u ${UNIT_TESTS}/$${test}.exp $${test}.out \
565 || failed="$${failed}$${failed:+ }$${test}" ; \
566 done ; \
567 if [ -n "$${failed}" ]; then \
568 echo "Failed tests: $${failed}" ; false ; \
569 else \
570 echo "All tests passed" ; \
571 fi
572
573 accept:
574 @for test in ${TESTS}; do \
575 cmp -s ${UNIT_TESTS}/$${test}.exp $${test}.out \
576 || { echo "Replacing $${test}.exp" ; \
577 cp $${test}.out ${UNIT_TESTS}/$${test}.exp ; } \
578 done
579
580 # Note: only works for adding tests.
581 # To remove a test, the $$mi file must be edited manually.
582 sync-mi:
583 @set -eu; \
584 cd "${MAKEFILE:tA:H}/../../.."; \
585 mi="distrib/sets/lists/tests/mi"; \
586 cvs update "$$mi"; \
587 testsdir="usr.bin/make/unit-tests"; \
588 fmt="./usr/tests/$$testsdir/%s\ttests-usr.bin-tests\tcompattestfile,atf\\n"; \
589 cat "$$mi" > "$$mi.tmp"; \
590 (cd "$$testsdir" && ls *.exp *.mk) | xargs printf "$$fmt" >> "$$mi.tmp"; \
591 distrib/sets/fmt-list "$$mi.tmp"; \
592 mv "$$mi.tmp" "$$mi"; \
593 cvs diff "$$mi" || true
594
595 .if exists(${TEST_MAKE})
596 ${TESTS:=.rawout}: ${TEST_MAKE}
597 # in meta mode, we *know* if a target script is impacted
598 # by a makefile change.
599 .if ${.MAKE.MODE:Unormal:Mmeta} == ""
600 ${TESTS:=.rawout}: ${.PARSEDIR}/Makefile
601 .endif
602 .endif
603
604 .-include <bsd.obj.mk>
605