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