[BACK]Return to Makefile CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / usr.bin / make / unit-tests

Annotation of src/usr.bin/make/unit-tests/Makefile, Revision 1.257

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

CVSweb <webmaster@jp.NetBSD.org>