2023-04-24 23:44:30 +00:00
|
|
|
# $Id: Makefile,v 1.193 2023/02/25 20:03:25 sjg Exp $
|
2012-06-08 21:57:36 +00:00
|
|
|
#
|
2023-04-24 23:44:30 +00:00
|
|
|
# $NetBSD: Makefile,v 1.333 2023/02/25 19:30:32 sjg Exp $
|
2012-06-08 21:57:36 +00:00
|
|
|
#
|
|
|
|
# Unit tests for make(1)
|
2020-07-11 22:45:05 +00:00
|
|
|
#
|
2012-06-08 21:57:36 +00:00
|
|
|
# The main targets are:
|
|
|
|
#
|
2020-07-11 22:45:05 +00:00
|
|
|
# all:
|
|
|
|
# run all the tests
|
|
|
|
# test:
|
|
|
|
# run 'all', and compare to expected results
|
|
|
|
# accept:
|
|
|
|
# move generated output to expected results
|
|
|
|
#
|
|
|
|
# Settable variables
|
|
|
|
#
|
|
|
|
# TEST_MAKE
|
|
|
|
# The make program to be tested.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Adding a test case
|
|
|
|
#
|
2012-06-08 21:57:36 +00:00
|
|
|
# Each feature should get its own set of tests in its own suitably
|
2015-04-20 03:45:54 +00:00
|
|
|
# named makefile (*.mk), with its own set of expected results (*.exp),
|
2020-07-11 22:45:05 +00:00
|
|
|
# and it should be added to the TESTS list.
|
|
|
|
#
|
|
|
|
|
2021-02-11 01:51:11 +00:00
|
|
|
.MAIN: all
|
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
# we use these below but we might be an older make
|
|
|
|
.MAKE.OS?= ${uname -s:L:sh}
|
|
|
|
.MAKE.UID?= ${id -u:L:sh}
|
|
|
|
|
2023-04-24 23:44:30 +00:00
|
|
|
# for many tests we need a TMPDIR that will not collide
|
|
|
|
# with other users.
|
|
|
|
.if ${.OBJDIR} != ${.CURDIR}
|
|
|
|
# easy
|
|
|
|
TMPDIR:= ${.OBJDIR}/tmp
|
|
|
|
.elif defined(TMPDIR)
|
|
|
|
TMPDIR:= ${TMPDIR}/uid${.MAKE.UID}
|
|
|
|
.else
|
|
|
|
TMPDIR:= /tmp/uid${.MAKE.UID}
|
|
|
|
.endif
|
|
|
|
# make sure it exists
|
|
|
|
.if !exist(${TMPDIR})
|
|
|
|
_!= mkdir -p ${TMPDIR}
|
|
|
|
.endif
|
|
|
|
|
2020-07-11 22:45:05 +00:00
|
|
|
# Each test is in a sub-makefile.
|
|
|
|
# Keep the list sorted.
|
2020-09-05 16:11:04 +00:00
|
|
|
# Any test that is commented out must be ignored in
|
|
|
|
# src/tests/usr.bin/make/t_make.sh as well.
|
2020-11-07 19:39:21 +00:00
|
|
|
#TESTS+= archive
|
2021-01-14 01:24:34 +00:00
|
|
|
#TESTS+= archive-suffix
|
2020-11-20 03:54:37 +00:00
|
|
|
TESTS+= cmd-errors
|
2021-01-14 01:24:34 +00:00
|
|
|
TESTS+= cmd-errors-jobs
|
2020-11-20 03:54:37 +00:00
|
|
|
TESTS+= cmd-errors-lint
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= cmd-interrupt
|
|
|
|
TESTS+= cmdline
|
2021-02-11 01:51:11 +00:00
|
|
|
TESTS+= cmdline-redirect-stdin
|
2020-11-20 03:54:37 +00:00
|
|
|
TESTS+= cmdline-undefined
|
2020-07-11 22:45:05 +00:00
|
|
|
TESTS+= comment
|
2021-01-14 01:24:34 +00:00
|
|
|
TESTS+= compat-error
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= cond-cmp-numeric
|
|
|
|
TESTS+= cond-cmp-numeric-eq
|
|
|
|
TESTS+= cond-cmp-numeric-ge
|
|
|
|
TESTS+= cond-cmp-numeric-gt
|
|
|
|
TESTS+= cond-cmp-numeric-le
|
|
|
|
TESTS+= cond-cmp-numeric-lt
|
|
|
|
TESTS+= cond-cmp-numeric-ne
|
|
|
|
TESTS+= cond-cmp-string
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= cond-cmp-unary
|
2021-01-14 01:24:34 +00:00
|
|
|
TESTS+= cond-eof
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= cond-func
|
|
|
|
TESTS+= cond-func-commands
|
|
|
|
TESTS+= cond-func-defined
|
|
|
|
TESTS+= cond-func-empty
|
|
|
|
TESTS+= cond-func-exists
|
|
|
|
TESTS+= cond-func-make
|
2021-01-14 01:24:34 +00:00
|
|
|
TESTS+= cond-func-make-main
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= cond-func-target
|
2020-07-11 22:45:05 +00:00
|
|
|
TESTS+= cond-late
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= cond-op
|
|
|
|
TESTS+= cond-op-and
|
2020-11-20 03:54:37 +00:00
|
|
|
TESTS+= cond-op-and-lint
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= cond-op-not
|
|
|
|
TESTS+= cond-op-or
|
2020-11-20 03:54:37 +00:00
|
|
|
TESTS+= cond-op-or-lint
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= cond-op-parentheses
|
2020-07-11 22:45:05 +00:00
|
|
|
TESTS+= cond-short
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= cond-token-number
|
|
|
|
TESTS+= cond-token-plain
|
|
|
|
TESTS+= cond-token-string
|
|
|
|
TESTS+= cond-token-var
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= cond-undef-lint
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= counter
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= counter-append
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= dep
|
|
|
|
TESTS+= dep-colon
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= dep-colon-bug-cross-file
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= dep-double-colon
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= dep-double-colon-indep
|
2022-02-05 20:03:50 +00:00
|
|
|
TESTS+= dep-duplicate
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= dep-exclam
|
|
|
|
TESTS+= dep-none
|
2022-02-05 20:03:50 +00:00
|
|
|
TESTS+= dep-op-missing
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= dep-percent
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= dep-var
|
|
|
|
TESTS+= dep-wildcards
|
|
|
|
TESTS+= depsrc
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= depsrc-end
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= depsrc-exec
|
|
|
|
TESTS+= depsrc-ignore
|
|
|
|
TESTS+= depsrc-made
|
|
|
|
TESTS+= depsrc-make
|
|
|
|
TESTS+= depsrc-meta
|
|
|
|
TESTS+= depsrc-nometa
|
|
|
|
TESTS+= depsrc-nometa_cmp
|
|
|
|
TESTS+= depsrc-nopath
|
|
|
|
TESTS+= depsrc-notmain
|
|
|
|
TESTS+= depsrc-optional
|
|
|
|
TESTS+= depsrc-phony
|
|
|
|
TESTS+= depsrc-precious
|
|
|
|
TESTS+= depsrc-recursive
|
|
|
|
TESTS+= depsrc-silent
|
|
|
|
TESTS+= depsrc-use
|
|
|
|
TESTS+= depsrc-usebefore
|
|
|
|
TESTS+= depsrc-usebefore-double-colon
|
|
|
|
TESTS+= depsrc-wait
|
|
|
|
TESTS+= deptgt
|
|
|
|
TESTS+= deptgt-begin
|
2021-01-14 01:24:34 +00:00
|
|
|
TESTS+= deptgt-begin-fail
|
|
|
|
TESTS+= deptgt-begin-fail-indirect
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= deptgt-default
|
|
|
|
TESTS+= deptgt-delete_on_error
|
|
|
|
TESTS+= deptgt-end
|
2021-01-14 01:24:34 +00:00
|
|
|
TESTS+= deptgt-end-fail
|
|
|
|
TESTS+= deptgt-end-fail-all
|
|
|
|
TESTS+= deptgt-end-fail-indirect
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= deptgt-end-jobs
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= deptgt-error
|
|
|
|
TESTS+= deptgt-ignore
|
|
|
|
TESTS+= deptgt-interrupt
|
|
|
|
TESTS+= deptgt-main
|
|
|
|
TESTS+= deptgt-makeflags
|
|
|
|
TESTS+= deptgt-no_parallel
|
|
|
|
TESTS+= deptgt-nopath
|
|
|
|
TESTS+= deptgt-notparallel
|
|
|
|
TESTS+= deptgt-objdir
|
|
|
|
TESTS+= deptgt-order
|
|
|
|
TESTS+= deptgt-path
|
|
|
|
TESTS+= deptgt-path-suffix
|
|
|
|
TESTS+= deptgt-phony
|
2022-04-22 20:34:55 +00:00
|
|
|
TESTS+= deptgt-posix
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= deptgt-precious
|
|
|
|
TESTS+= deptgt-shell
|
|
|
|
TESTS+= deptgt-silent
|
2022-04-03 19:52:08 +00:00
|
|
|
TESTS+= deptgt-silent-jobs
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= deptgt-stale
|
|
|
|
TESTS+= deptgt-suffixes
|
|
|
|
TESTS+= dir
|
|
|
|
TESTS+= dir-expand-path
|
|
|
|
TESTS+= directive
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= directive-dinclude
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= directive-elif
|
|
|
|
TESTS+= directive-elifdef
|
|
|
|
TESTS+= directive-elifmake
|
|
|
|
TESTS+= directive-elifndef
|
|
|
|
TESTS+= directive-elifnmake
|
|
|
|
TESTS+= directive-else
|
2021-01-14 01:24:34 +00:00
|
|
|
TESTS+= directive-endfor
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= directive-endif
|
|
|
|
TESTS+= directive-error
|
|
|
|
TESTS+= directive-export
|
|
|
|
TESTS+= directive-export-env
|
2021-01-14 01:24:34 +00:00
|
|
|
TESTS+= directive-export-impl
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= directive-export-gmake
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= directive-export-literal
|
|
|
|
TESTS+= directive-for
|
2023-01-28 00:23:54 +00:00
|
|
|
TESTS+= directive-for-break
|
2022-07-26 15:52:53 +00:00
|
|
|
TESTS+= directive-for-empty
|
2021-01-14 01:24:34 +00:00
|
|
|
TESTS+= directive-for-errors
|
|
|
|
TESTS+= directive-for-escape
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= directive-for-generating-endif
|
2021-12-18 07:27:22 +00:00
|
|
|
TESTS+= directive-for-if
|
2021-01-14 01:24:34 +00:00
|
|
|
TESTS+= directive-for-lines
|
|
|
|
TESTS+= directive-for-null
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= directive-hyphen-include
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= directive-if
|
2020-11-20 03:54:37 +00:00
|
|
|
TESTS+= directive-if-nested
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= directive-ifdef
|
|
|
|
TESTS+= directive-ifmake
|
|
|
|
TESTS+= directive-ifndef
|
|
|
|
TESTS+= directive-ifnmake
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= directive-include
|
|
|
|
TESTS+= directive-include-fatal
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= directive-info
|
2021-01-14 01:24:34 +00:00
|
|
|
TESTS+= directive-misspellings
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= directive-sinclude
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= directive-undef
|
|
|
|
TESTS+= directive-unexport
|
|
|
|
TESTS+= directive-unexport-env
|
|
|
|
TESTS+= directive-warning
|
2020-07-11 22:45:05 +00:00
|
|
|
TESTS+= dollar
|
|
|
|
TESTS+= doterror
|
|
|
|
TESTS+= dotwait
|
|
|
|
TESTS+= error
|
|
|
|
TESTS+= # escape # broken by reverting POSIX changes
|
|
|
|
TESTS+= export
|
|
|
|
TESTS+= export-all
|
|
|
|
TESTS+= export-env
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= export-variants
|
2020-07-11 22:45:05 +00:00
|
|
|
TESTS+= forloop
|
|
|
|
TESTS+= forsubst
|
2020-11-20 03:54:37 +00:00
|
|
|
TESTS+= gnode-submake
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= hanoi-include
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= impsrc
|
2020-07-11 22:45:05 +00:00
|
|
|
TESTS+= include-main
|
2020-11-20 03:54:37 +00:00
|
|
|
TESTS+= job-flags
|
2020-11-07 19:39:21 +00:00
|
|
|
#TESTS+= job-output-long-lines
|
2021-06-25 18:16:24 +00:00
|
|
|
TESTS+= job-output-null
|
2021-02-11 01:51:11 +00:00
|
|
|
TESTS+= jobs-empty-commands
|
2021-06-25 18:16:24 +00:00
|
|
|
TESTS+= jobs-empty-commands-error
|
2021-01-14 01:24:34 +00:00
|
|
|
TESTS+= jobs-error-indirect
|
|
|
|
TESTS+= jobs-error-nested
|
|
|
|
TESTS+= jobs-error-nested-make
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= lint
|
|
|
|
TESTS+= make-exported
|
2021-01-14 01:24:34 +00:00
|
|
|
TESTS+= meta-cmd-cmp
|
2020-07-11 22:45:05 +00:00
|
|
|
TESTS+= moderrs
|
|
|
|
TESTS+= modmatch
|
|
|
|
TESTS+= modmisc
|
2021-01-14 01:24:34 +00:00
|
|
|
.if ${.MAKE.UID} > 0
|
2020-11-20 03:54:37 +00:00
|
|
|
TESTS+= objdir-writable
|
2021-01-14 01:24:34 +00:00
|
|
|
.endif
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= opt
|
|
|
|
TESTS+= opt-backwards
|
|
|
|
TESTS+= opt-chdir
|
|
|
|
TESTS+= opt-debug
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= opt-debug-all
|
|
|
|
TESTS+= opt-debug-archive
|
|
|
|
TESTS+= opt-debug-curdir
|
|
|
|
TESTS+= opt-debug-cond
|
|
|
|
TESTS+= opt-debug-dir
|
|
|
|
TESTS+= opt-debug-errors
|
2021-06-25 18:16:24 +00:00
|
|
|
TESTS+= opt-debug-errors-jobs
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= opt-debug-file
|
|
|
|
TESTS+= opt-debug-for
|
|
|
|
TESTS+= opt-debug-graph1
|
|
|
|
TESTS+= opt-debug-graph2
|
|
|
|
TESTS+= opt-debug-graph3
|
|
|
|
TESTS+= opt-debug-hash
|
|
|
|
#TESTS+= opt-debug-jobs
|
|
|
|
TESTS+= opt-debug-lint
|
|
|
|
TESTS+= opt-debug-loud
|
|
|
|
TESTS+= opt-debug-meta
|
|
|
|
TESTS+= opt-debug-making
|
|
|
|
TESTS+= opt-debug-no-rm
|
|
|
|
TESTS+= opt-debug-parse
|
|
|
|
TESTS+= opt-debug-suff
|
|
|
|
TESTS+= opt-debug-targets
|
|
|
|
TESTS+= opt-debug-varraw
|
|
|
|
TESTS+= opt-debug-var
|
|
|
|
TESTS+= opt-debug-x-trace
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= opt-define
|
|
|
|
TESTS+= opt-env
|
|
|
|
TESTS+= opt-file
|
|
|
|
TESTS+= opt-ignore
|
|
|
|
TESTS+= opt-include-dir
|
|
|
|
TESTS+= opt-jobs
|
|
|
|
TESTS+= opt-jobs-internal
|
2021-01-14 01:24:34 +00:00
|
|
|
TESTS+= opt-jobs-no-action
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= opt-keep-going
|
2022-04-03 19:52:08 +00:00
|
|
|
TESTS+= opt-keep-going-indirect
|
2021-01-14 01:24:34 +00:00
|
|
|
TESTS+= opt-keep-going-multiple
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= opt-m-include-dir
|
|
|
|
TESTS+= opt-no-action
|
|
|
|
TESTS+= opt-no-action-at-all
|
2021-01-14 01:24:34 +00:00
|
|
|
TESTS+= opt-no-action-runflags
|
2021-02-11 01:51:11 +00:00
|
|
|
TESTS+= opt-no-action-touch
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= opt-query
|
|
|
|
TESTS+= opt-raw
|
|
|
|
TESTS+= opt-silent
|
|
|
|
TESTS+= opt-touch
|
2020-11-20 03:54:37 +00:00
|
|
|
TESTS+= opt-touch-jobs
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= opt-tracefile
|
|
|
|
TESTS+= opt-var-expanded
|
|
|
|
TESTS+= opt-var-literal
|
2022-02-05 20:03:50 +00:00
|
|
|
TESTS+= opt-version
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= opt-warnings-as-errors
|
|
|
|
TESTS+= opt-where-am-i
|
|
|
|
TESTS+= opt-x-reduce-exported
|
2020-07-11 22:45:05 +00:00
|
|
|
TESTS+= order
|
2022-02-05 20:03:50 +00:00
|
|
|
TESTS+= parse
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= parse-var
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= phony-end
|
2020-07-11 22:45:05 +00:00
|
|
|
TESTS+= posix
|
|
|
|
TESTS+= # posix1 # broken by reverting POSIX changes
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= recursive
|
|
|
|
TESTS+= sh
|
|
|
|
TESTS+= sh-dots
|
2021-01-14 01:24:34 +00:00
|
|
|
TESTS+= sh-errctl
|
|
|
|
TESTS+= sh-flags
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= sh-jobs
|
|
|
|
TESTS+= sh-jobs-error
|
|
|
|
TESTS+= sh-leading-at
|
|
|
|
TESTS+= sh-leading-hyphen
|
|
|
|
TESTS+= sh-leading-plus
|
|
|
|
TESTS+= sh-meta-chars
|
|
|
|
TESTS+= sh-multi-line
|
|
|
|
TESTS+= sh-single-line
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= shell-csh
|
|
|
|
TESTS+= shell-custom
|
2020-11-20 03:54:37 +00:00
|
|
|
.if exists(/bin/ksh)
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= shell-ksh
|
2020-11-20 03:54:37 +00:00
|
|
|
.endif
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= shell-sh
|
|
|
|
TESTS+= suff-add-later
|
|
|
|
TESTS+= suff-clear-regular
|
|
|
|
TESTS+= suff-clear-single
|
2021-01-14 01:24:34 +00:00
|
|
|
TESTS+= suff-incomplete
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= suff-lookup
|
|
|
|
TESTS+= suff-main
|
2021-01-14 01:24:34 +00:00
|
|
|
TESTS+= suff-main-several
|
|
|
|
TESTS+= suff-phony
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= suff-rebuild
|
2020-11-20 03:54:37 +00:00
|
|
|
TESTS+= suff-self
|
2021-01-14 01:24:34 +00:00
|
|
|
TESTS+= suff-transform-debug
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= suff-transform-endless
|
|
|
|
TESTS+= suff-transform-expand
|
|
|
|
TESTS+= suff-transform-select
|
2022-02-09 17:22:21 +00:00
|
|
|
TESTS+= suff-use
|
2020-07-11 22:45:05 +00:00
|
|
|
TESTS+= sunshcmd
|
|
|
|
TESTS+= ternary
|
|
|
|
TESTS+= unexport
|
|
|
|
TESTS+= unexport-env
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= use-inference
|
2023-01-28 00:23:54 +00:00
|
|
|
TESTS+= var-readonly
|
2022-02-05 20:03:50 +00:00
|
|
|
TESTS+= var-scope
|
|
|
|
TESTS+= var-scope-cmdline
|
|
|
|
TESTS+= var-scope-env
|
|
|
|
TESTS+= var-scope-global
|
|
|
|
TESTS+= var-scope-local
|
|
|
|
TESTS+= var-scope-local-legacy
|
2021-06-25 18:16:24 +00:00
|
|
|
TESTS+= var-eval-short
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= var-op
|
|
|
|
TESTS+= var-op-append
|
|
|
|
TESTS+= var-op-assign
|
|
|
|
TESTS+= var-op-default
|
|
|
|
TESTS+= var-op-expand
|
|
|
|
TESTS+= var-op-shell
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= var-op-sunsh
|
|
|
|
TESTS+= var-recursive
|
2020-07-11 22:45:05 +00:00
|
|
|
TESTS+= varcmd
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= vardebug
|
|
|
|
TESTS+= varfind
|
2020-07-11 22:45:05 +00:00
|
|
|
TESTS+= varmisc
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= varmod
|
|
|
|
TESTS+= varmod-assign
|
2022-02-05 20:03:50 +00:00
|
|
|
TESTS+= varmod-assign-shell
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= varmod-defined
|
2020-07-11 22:45:05 +00:00
|
|
|
TESTS+= varmod-edge
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= varmod-exclam-shell
|
|
|
|
TESTS+= varmod-extension
|
|
|
|
TESTS+= varmod-gmtime
|
|
|
|
TESTS+= varmod-hash
|
|
|
|
TESTS+= varmod-head
|
|
|
|
TESTS+= varmod-ifelse
|
2021-01-14 01:24:34 +00:00
|
|
|
TESTS+= varmod-indirect
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= varmod-l-name-to-value
|
|
|
|
TESTS+= varmod-localtime
|
|
|
|
TESTS+= varmod-loop
|
2021-12-18 07:27:22 +00:00
|
|
|
TESTS+= varmod-loop-delete
|
2021-06-25 18:16:24 +00:00
|
|
|
TESTS+= varmod-loop-varname
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= varmod-match
|
|
|
|
TESTS+= varmod-match-escape
|
|
|
|
TESTS+= varmod-no-match
|
|
|
|
TESTS+= varmod-order
|
2021-12-18 07:27:22 +00:00
|
|
|
TESTS+= varmod-order-numeric
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= varmod-order-reverse
|
|
|
|
TESTS+= varmod-order-shuffle
|
2021-12-18 07:27:22 +00:00
|
|
|
TESTS+= varmod-order-string
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= varmod-path
|
|
|
|
TESTS+= varmod-quote
|
|
|
|
TESTS+= varmod-quote-dollar
|
|
|
|
TESTS+= varmod-range
|
|
|
|
TESTS+= varmod-remember
|
|
|
|
TESTS+= varmod-root
|
|
|
|
TESTS+= varmod-select-words
|
|
|
|
TESTS+= varmod-shell
|
|
|
|
TESTS+= varmod-subst
|
|
|
|
TESTS+= varmod-subst-regex
|
2021-06-25 18:16:24 +00:00
|
|
|
TESTS+= varmod-sun-shell
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= varmod-sysv
|
|
|
|
TESTS+= varmod-tail
|
|
|
|
TESTS+= varmod-to-abs
|
|
|
|
TESTS+= varmod-to-lower
|
|
|
|
TESTS+= varmod-to-many-words
|
|
|
|
TESTS+= varmod-to-one-word
|
|
|
|
TESTS+= varmod-to-separator
|
|
|
|
TESTS+= varmod-to-upper
|
|
|
|
TESTS+= varmod-undefined
|
|
|
|
TESTS+= varmod-unique
|
|
|
|
TESTS+= varname
|
|
|
|
TESTS+= varname-dollar
|
|
|
|
TESTS+= varname-dot-alltargets
|
|
|
|
TESTS+= varname-dot-curdir
|
|
|
|
TESTS+= varname-dot-includes
|
|
|
|
TESTS+= varname-dot-includedfromdir
|
|
|
|
TESTS+= varname-dot-includedfromfile
|
|
|
|
TESTS+= varname-dot-libs
|
|
|
|
TESTS+= varname-dot-make-dependfile
|
|
|
|
TESTS+= varname-dot-make-expand_variables
|
|
|
|
TESTS+= varname-dot-make-exported
|
|
|
|
TESTS+= varname-dot-make-jobs
|
|
|
|
TESTS+= varname-dot-make-jobs-prefix
|
|
|
|
TESTS+= varname-dot-make-level
|
|
|
|
TESTS+= varname-dot-make-makefile_preference
|
|
|
|
TESTS+= varname-dot-make-makefiles
|
|
|
|
TESTS+= varname-dot-make-meta-bailiwick
|
|
|
|
TESTS+= varname-dot-make-meta-created
|
|
|
|
TESTS+= varname-dot-make-meta-files
|
2023-04-24 23:44:30 +00:00
|
|
|
.if ${.MAKE.PATH_FILEMON:Uno:Nktrace:N/dev*} == "" && ${TMPDIR:N/tmp*:N/var/tmp*} != ""
|
|
|
|
# these tests will not work if TMPDIR is or is a subdir of
|
|
|
|
# /tmp or /var/tmp
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= varname-dot-make-meta-ignore_filter
|
|
|
|
TESTS+= varname-dot-make-meta-ignore_paths
|
|
|
|
TESTS+= varname-dot-make-meta-ignore_patterns
|
2023-04-24 23:44:30 +00:00
|
|
|
TESTS+= varname-dot-make-path_filemon
|
|
|
|
.endif
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= varname-dot-make-meta-prefix
|
|
|
|
TESTS+= varname-dot-make-mode
|
|
|
|
TESTS+= varname-dot-make-pid
|
|
|
|
TESTS+= varname-dot-make-ppid
|
|
|
|
TESTS+= varname-dot-make-save_dollars
|
2021-01-14 01:24:34 +00:00
|
|
|
TESTS+= varname-dot-makeflags
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= varname-dot-makeoverrides
|
|
|
|
TESTS+= varname-dot-newline
|
|
|
|
TESTS+= varname-dot-objdir
|
|
|
|
TESTS+= varname-dot-parsedir
|
|
|
|
TESTS+= varname-dot-parsefile
|
|
|
|
TESTS+= varname-dot-path
|
|
|
|
TESTS+= varname-dot-shell
|
2021-12-18 07:27:22 +00:00
|
|
|
TESTS+= varname-dot-suffixes
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= varname-dot-targets
|
|
|
|
TESTS+= varname-empty
|
|
|
|
TESTS+= varname-make
|
|
|
|
TESTS+= varname-make_print_var_on_error
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= varname-make_print_var_on_error-jobs
|
|
|
|
TESTS+= varname-makefile
|
2020-09-05 16:11:04 +00:00
|
|
|
TESTS+= varname-makeflags
|
|
|
|
TESTS+= varname-pwd
|
|
|
|
TESTS+= varname-vpath
|
|
|
|
TESTS+= varparse-dynamic
|
2020-11-20 03:54:37 +00:00
|
|
|
TESTS+= varparse-errors
|
2020-11-07 19:39:21 +00:00
|
|
|
TESTS+= varparse-mod
|
|
|
|
TESTS+= varparse-undef-partial
|
2020-07-11 22:45:05 +00:00
|
|
|
|
2022-04-22 20:34:55 +00:00
|
|
|
# some shells have quirks
|
|
|
|
_shell := ${.SHELL:tA:T}
|
|
|
|
.if ${_shell} == "dash"
|
|
|
|
# dash fails -x output
|
|
|
|
BROKEN_TESTS+= opt-debug-x-trace
|
|
|
|
.elif ${_shell} == "ksh"
|
2021-12-18 07:27:22 +00:00
|
|
|
BROKEN_TESTS+= sh-flags
|
|
|
|
.endif
|
2022-04-22 20:34:55 +00:00
|
|
|
|
2021-12-18 07:27:22 +00:00
|
|
|
.if ${.MAKE.OS:NDarwin} == ""
|
|
|
|
BROKEN_TESTS+= shell-ksh
|
|
|
|
.endif
|
2022-04-22 20:34:55 +00:00
|
|
|
|
2021-12-18 07:27:22 +00:00
|
|
|
.if ${.MAKE.OS} == "SCO_SV"
|
|
|
|
BROKEN_TESTS+= \
|
|
|
|
opt-debug-graph[23] \
|
|
|
|
varmod-localtime \
|
|
|
|
varmod-to-separator \
|
|
|
|
|
2022-04-22 20:34:55 +00:00
|
|
|
.if ${_shell} == "bash"
|
2021-12-18 07:27:22 +00:00
|
|
|
BROKEN_TESTS+= job-output-null
|
|
|
|
.else
|
|
|
|
BROKEN_TESTS+= \
|
|
|
|
cmd-interrupt \
|
|
|
|
job-flags \
|
|
|
|
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
|
|
|
# Some tests just do not work on some platforms or environments
|
|
|
|
# so allow for some filtering.
|
|
|
|
.if !empty(BROKEN_TESTS)
|
|
|
|
.warning Skipping broken tests: ${BROKEN_TESTS:O:u}
|
|
|
|
TESTS:= ${TESTS:${BROKEN_TESTS:S,^,N,:ts:}}
|
|
|
|
.endif
|
|
|
|
|
2020-11-20 03:54:37 +00:00
|
|
|
# Ideas for more tests:
|
|
|
|
# char-0020-space.mk
|
|
|
|
# char-005C-backslash.mk
|
|
|
|
# escape-cond-str.mk
|
|
|
|
# escape-cond-func-arg.mk
|
|
|
|
# escape-varmod.mk
|
|
|
|
# escape-varmod-define.mk
|
|
|
|
# escape-varmod-match.mk
|
|
|
|
# escape-varname.mk
|
|
|
|
# escape-varassign-varname.mk
|
|
|
|
# escape-varassign-varname-cmdline.mk
|
|
|
|
# escape-varassign-value.mk
|
|
|
|
# escape-varassign-value-cmdline.mk
|
|
|
|
# escape-dependency-source.mk
|
|
|
|
# escape-dependency-target.mk
|
|
|
|
# escape-for-varname.mk
|
|
|
|
# escape-for-item.mk
|
|
|
|
# posix-*.mk (see posix.mk and posix1.mk)
|
|
|
|
|
2020-09-05 16:11:04 +00:00
|
|
|
# Additional environment variables for some of the tests.
|
|
|
|
# The base environment is -i PATH="$PATH".
|
2020-11-20 03:54:37 +00:00
|
|
|
ENV.depsrc-optional+= TZ=UTC
|
2022-04-03 19:52:08 +00:00
|
|
|
ENV.deptgt-phony+= MAKESYSPATH=.
|
|
|
|
ENV.directive-undef= ENV_VAR=env-value
|
2023-01-28 00:23:54 +00:00
|
|
|
ENV.opt-env= FROM_ENV=value-from-env
|
2022-07-27 15:56:53 +00:00
|
|
|
ENV.opt-m-include-dir= ${MAKEOBJDIR:DMAKEOBJDIR=${MAKEOBJDIR}}
|
2020-09-05 16:11:04 +00:00
|
|
|
ENV.varmisc= FROM_ENV=env
|
|
|
|
ENV.varmisc+= FROM_ENV_BEFORE=env
|
|
|
|
ENV.varmisc+= FROM_ENV_AFTER=env
|
2021-12-18 07:27:22 +00:00
|
|
|
ENV.varmod-localtime+= TZ=${UTC_1:UEurope/Berlin}
|
2020-11-20 03:54:37 +00:00
|
|
|
ENV.varname-vpath+= VPATH=varname-vpath.dir:varname-vpath.dir2
|
2020-09-05 16:11:04 +00:00
|
|
|
|
|
|
|
# Override make flags for some of the tests; default is -k.
|
|
|
|
# If possible, write ".MAKEFLAGS: -dv" in the test .mk file instead of
|
|
|
|
# settings FLAGS.test=-dv here, since that is closer to the test code.
|
2021-01-14 01:24:34 +00:00
|
|
|
FLAGS.cond-func-make= via-cmdline
|
|
|
|
FLAGS.doterror= # none, especially not -k
|
|
|
|
FLAGS.jobs-error-indirect= # none, especially not -k
|
|
|
|
FLAGS.jobs-error-nested= # none, especially not -k
|
|
|
|
FLAGS.jobs-error-nested-make= # none, especially not -k
|
|
|
|
FLAGS.varname-empty= -dv '$${:U}=cmdline-u' '=cmdline-plain'
|
2020-07-11 22:45:05 +00:00
|
|
|
|
2020-11-07 19:39:21 +00:00
|
|
|
# Some tests need extra postprocessing.
|
2022-04-03 19:52:08 +00:00
|
|
|
SED_CMDS.deptgt-phony= ${STD_SED_CMDS.dd}
|
|
|
|
SED_CMDS.dir= ${STD_SED_CMDS.dd}
|
2021-01-14 01:24:34 +00:00
|
|
|
SED_CMDS.export= -e '/^[^=_A-Za-z0-9]*=/d'
|
|
|
|
SED_CMDS.export-all= ${SED_CMDS.export}
|
|
|
|
SED_CMDS.export-env= ${SED_CMDS.export}
|
|
|
|
SED_CMDS.cmdline= -e 's,uid${.MAKE.UID}/,,'
|
2020-11-07 19:39:21 +00:00
|
|
|
SED_CMDS.job-output-long-lines= \
|
|
|
|
${:D Job separators on their own line are ok. } \
|
|
|
|
-e '/^--- job-[ab] ---$$/d' \
|
|
|
|
${:D Plain output lines are ok as well. } \
|
|
|
|
${:D They may come in multiples of 1024 or as 10000. } \
|
|
|
|
-e '/^aa*$$/d' \
|
|
|
|
-e '/^bb*$$/d' \
|
|
|
|
${:D The following lines should rather not occur since the job } \
|
|
|
|
${:D marker should always be at the beginning of the line. } \
|
|
|
|
-e '/^aa*--- job-b ---$$/d' \
|
|
|
|
-e '/^bb*--- job-a ---$$/d'
|
2021-12-18 07:27:22 +00:00
|
|
|
SED_CMDS.opt-chdir= -e 's,\(nonexistent\).[1-9][0-9]*,\1,' \
|
|
|
|
-e '/name/s,file,File,' \
|
|
|
|
-e 's,no such,No such,' \
|
|
|
|
-e 's,Filename,File name,'
|
2023-04-24 23:44:30 +00:00
|
|
|
|
|
|
|
# meta line numbers can vary based on filemon implementation
|
|
|
|
SED_CMDS.meta-ignore= -e 's,\(\.meta:\) [1-9][0-9]*:,\1 <line>:,'
|
2021-01-14 01:24:34 +00:00
|
|
|
SED_CMDS.opt-debug-graph1= ${STD_SED_CMDS.dg1}
|
2021-02-11 01:51:11 +00:00
|
|
|
SED_CMDS.opt-debug-graph2= ${STD_SED_CMDS.dg2}
|
|
|
|
SED_CMDS.opt-debug-graph3= ${STD_SED_CMDS.dg3}
|
2022-02-05 20:03:50 +00:00
|
|
|
SED_CMDS.opt-debug-hash= -e 's,\(numEntries\)=[1-9][0-9],\1=<entries>,'
|
2020-11-07 19:39:21 +00:00
|
|
|
SED_CMDS.opt-debug-jobs= -e 's,([0-9][0-9]*),(<pid>),'
|
|
|
|
SED_CMDS.opt-debug-jobs+= -e 's,pid [0-9][0-9]*,pid <pid>,'
|
|
|
|
SED_CMDS.opt-debug-jobs+= -e 's,Process [0-9][0-9]*,Process <pid>,'
|
|
|
|
SED_CMDS.opt-debug-jobs+= -e 's,JobFinish: [0-9][0-9]*,JobFinish: <pid>,'
|
2021-01-14 01:24:34 +00:00
|
|
|
SED_CMDS.opt-debug-jobs+= -e 's,Command: ${.SHELL:T},Command: <shell>,'
|
2020-11-07 19:39:21 +00:00
|
|
|
# The "-q" may be there or not, see jobs.c, variable shells.
|
2021-01-14 01:24:34 +00:00
|
|
|
SED_CMDS.opt-debug-jobs+= -e 's,^\(.Command: <shell>\) -q,\1,'
|
2021-06-25 18:16:24 +00:00
|
|
|
SED_CMDS.opt-debug-lint+= ${STD_SED_CMDS.regex}
|
2021-01-14 01:24:34 +00:00
|
|
|
SED_CMDS.opt-jobs-no-action= ${STD_SED_CMDS.hide-from-output}
|
|
|
|
SED_CMDS.opt-no-action-runflags= ${STD_SED_CMDS.hide-from-output}
|
2022-02-05 20:03:50 +00:00
|
|
|
SED_CMDS.opt-where-am-i= -e '/usr.obj/d'
|
2021-06-25 18:16:24 +00:00
|
|
|
# For Compat_RunCommand, useShell == false.
|
2021-01-14 01:24:34 +00:00
|
|
|
SED_CMDS.sh-dots= -e 's,^.*\.\.\.:.*,<not found: ...>,'
|
2021-06-25 18:16:24 +00:00
|
|
|
# For Compat_RunCommand, useShell == true.
|
2021-01-14 01:24:34 +00:00
|
|
|
SED_CMDS.sh-dots+= -e 's,^make: exec(\(.*\)) failed (.*)$$,<not found: \1>,'
|
|
|
|
SED_CMDS.sh-dots+= -e 's,^\(\*\*\* Error code \)[1-9][0-9]*,\1<nonzero>,'
|
|
|
|
SED_CMDS.sh-errctl= ${STD_SED_CMDS.dj}
|
|
|
|
SED_CMDS.sh-flags= ${STD_SED_CMDS.hide-from-output}
|
2021-12-18 07:27:22 +00:00
|
|
|
SED_CMDS.shell-csh= ${STD_SED_CMDS.white-space}
|
2023-01-28 00:23:54 +00:00
|
|
|
SED_CMDS.sh-leading-hyphen= ${STD_SED_CMDS.shell}
|
2021-01-14 01:24:34 +00:00
|
|
|
SED_CMDS.suff-main+= ${STD_SED_CMDS.dg1}
|
|
|
|
SED_CMDS.suff-main-several+= ${STD_SED_CMDS.dg1}
|
|
|
|
SED_CMDS.suff-transform-debug+= ${STD_SED_CMDS.dg1}
|
2021-02-11 01:51:11 +00:00
|
|
|
SED_CMDS.var-op-shell+= ${STD_SED_CMDS.shell}
|
|
|
|
SED_CMDS.var-op-shell+= -e '/command/s,No such.*,not found,'
|
2021-12-18 07:27:22 +00:00
|
|
|
SED_CMDS.var-op-shell+= ${STD_SED_CMDS.white-space}
|
2021-02-11 01:51:11 +00:00
|
|
|
SED_CMDS.vardebug+= -e 's,${.SHELL},</path/to/shell>,'
|
2021-06-25 18:16:24 +00:00
|
|
|
SED_CMDS.varmod-subst-regex+= ${STD_SED_CMDS.regex}
|
2023-01-28 00:23:54 +00:00
|
|
|
SED_CMDS.varparse-errors+= ${STD_SED_CMDS.timestamp}
|
2023-04-24 23:44:30 +00:00
|
|
|
SED_CMDS.varname-dot-make-meta-ignore_filter+= ${SED_CMDS.meta-ignore}
|
|
|
|
SED_CMDS.varname-dot-make-meta-ignore_paths+= ${SED_CMDS.meta-ignore}
|
|
|
|
SED_CMDS.varname-dot-make-meta-ignore_patterns+= ${SED_CMDS.meta-ignore}
|
2020-11-07 19:39:21 +00:00
|
|
|
SED_CMDS.varname-dot-parsedir= -e '/in some cases/ s,^make: "[^"]*,make: "<normalized>,'
|
|
|
|
SED_CMDS.varname-dot-parsefile= -e '/in some cases/ s,^make: "[^"]*,make: "<normalized>,'
|
|
|
|
SED_CMDS.varname-dot-shell= -e 's, = /[^ ]*, = (details omitted),g'
|
|
|
|
SED_CMDS.varname-dot-shell+= -e 's,"/[^" ]*","(details omitted)",g'
|
|
|
|
SED_CMDS.varname-dot-shell+= -e 's,\[/[^] ]*\],[(details omitted)],g'
|
2023-01-28 00:23:54 +00:00
|
|
|
SED_CMDS.varname-empty= ${.OBJDIR .PARSEDIR .PATH .SHELL .SYSPATH:L:@v@-e '/\\$v/d'@}
|
2020-09-05 16:11:04 +00:00
|
|
|
|
|
|
|
# Some tests need an additional round of postprocessing.
|
2022-07-26 15:52:53 +00:00
|
|
|
POSTPROC.depsrc-wait= sed -e '/^---/d' -e 's,^\(: Making 3[abc]\)[123]$$,\1,'
|
2021-01-14 01:24:34 +00:00
|
|
|
POSTPROC.deptgt-suffixes= awk '/^\#\*\*\* Suffixes/,/^never-stop/'
|
|
|
|
POSTPROC.gnode-submake= awk '/Input graph/, /^$$/'
|
2022-07-26 15:52:53 +00:00
|
|
|
POSTPROC.varname-dot-make-mode= sed 's,^\(: Making [abc]\)[123]$$,\1,'
|
2020-09-05 16:11:04 +00:00
|
|
|
|
|
|
|
# Some tests reuse other tests, which makes them unnecessarily fragile.
|
|
|
|
export-all.rawout: export.mk
|
|
|
|
unexport.rawout: export.mk
|
|
|
|
unexport-env.rawout: export.mk
|
2020-07-11 22:45:05 +00:00
|
|
|
|
|
|
|
# End of the configuration section.
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
# Some standard sed commands, to be used in the SED_CMDS above.
|
|
|
|
|
2022-04-03 19:52:08 +00:00
|
|
|
# In tests that use the debugging option -dd, ignore debugging output that is
|
|
|
|
# only logged in -DCLEANUP mode.
|
|
|
|
STD_SED_CMDS.dd= -e '/^OpenDirs_Done:/d'
|
|
|
|
STD_SED_CMDS.dd+= -e '/^CachedDir /d'
|
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
# Omit details such as process IDs from the output of the -dg1 option.
|
2021-12-18 07:27:22 +00:00
|
|
|
STD_SED_CMDS.dg1= -e '/\#.* \.$$/d'
|
2021-01-14 01:24:34 +00:00
|
|
|
STD_SED_CMDS.dg1+= -e '/\.MAKE.PATH_FILEMON/d'
|
2023-01-28 00:23:54 +00:00
|
|
|
STD_SED_CMDS.dg1+= -e '/^\#.*\/mk/d'
|
2021-01-14 01:24:34 +00:00
|
|
|
STD_SED_CMDS.dg1+= -e 's, ${DEFSYSPATH:U/usr/share/mk}$$, <defsyspath>,'
|
|
|
|
STD_SED_CMDS.dg1+= -e 's,^\(\.MAKE *=\) .*,\1 <details omitted>,'
|
|
|
|
STD_SED_CMDS.dg1+= -e 's,^\(\.MAKE\.[A-Z_]* *=\) .*,\1 <details omitted>,'
|
|
|
|
STD_SED_CMDS.dg1+= -e 's,^\(MACHINE[_ARCH]* *=\) .*,\1 <details omitted>,'
|
|
|
|
STD_SED_CMDS.dg1+= -e 's,^\(MAKE *=\) .*,\1 <details omitted>,'
|
2021-02-11 01:51:11 +00:00
|
|
|
STD_SED_CMDS.dg1+= -e 's,^\(\.SHELL *=\) .*,\1 <details omitted>,'
|
2023-01-28 00:23:54 +00:00
|
|
|
STD_SED_CMDS.dg1+= -e '/\.SYSPATH/d'
|
2021-02-11 01:51:11 +00:00
|
|
|
|
|
|
|
STD_SED_CMDS.dg2= ${STD_SED_CMDS.dg1}
|
|
|
|
STD_SED_CMDS.dg2+= -e 's,\(last modified\) ..:..:.. ... ..\, ....,\1 <timestamp>,'
|
|
|
|
STD_SED_CMDS.dg3= ${STD_SED_CMDS.dg2}
|
2021-01-14 01:24:34 +00:00
|
|
|
|
|
|
|
# Omit details such as process IDs from the output of the -dj option.
|
|
|
|
STD_SED_CMDS.dj= \
|
|
|
|
-e '/Process/d;/JobFinish:/d' \
|
|
|
|
-e 's,^\(Job_TokenWithdraw\)([0-9]*),\1(<pid>),' \
|
|
|
|
-e 's,^([0-9][0-9]*) \(withdrew token\),(<pid>) \1,' \
|
|
|
|
-e 's, \(pid\) [0-9][0-9]*, \1 <pid>,' \
|
|
|
|
-e 's,^\( Command:\) .*,\1 <shell>,'
|
|
|
|
|
|
|
|
# Reduce the noise for tests running with the -n option, since there is no
|
|
|
|
# other way to suppress the echoing of the commands.
|
|
|
|
STD_SED_CMDS.hide-from-output= \
|
|
|
|
-e '/^echo hide-from-output/d' \
|
|
|
|
-e 's,hide-from-output ,,' \
|
|
|
|
-e 's,hide-from-output,,'
|
|
|
|
|
2021-02-11 01:51:11 +00:00
|
|
|
# Normalize the output for error messages from the shell.
|
|
|
|
#
|
|
|
|
# $shell -c '...'
|
|
|
|
# NetBSD sh ...: not found
|
|
|
|
# NetBSD ksh ksh: ...: not found
|
|
|
|
# bash 5.0.18 bash: ...: command not found
|
|
|
|
# bash 5.1.0 bash: line 1: ...: command not found
|
|
|
|
# dash dash: 1: ...: not found
|
|
|
|
#
|
|
|
|
# $shell -c '< /nonexistent'
|
|
|
|
# NetBSD sh sh: cannot open /nonexistent: no such file
|
|
|
|
# NetBSD ksh ksh: cannot open /nonexistent: No such file or directory
|
|
|
|
# bash 5.0.18 bash: /nonexistent: No such file or directory
|
|
|
|
# bash 5.1.0 bash: line 1: /nonexistent: No such file or directory
|
|
|
|
# dash dash: 1: cannot open /nonexistent: No such file
|
|
|
|
#
|
|
|
|
# echo '< /nonexistent' | $shell
|
|
|
|
# NetBSD sh sh: cannot open /nonexistent: no such file
|
|
|
|
# NetBSD ksh ksh: <stdin>[1]: cannot open /nonexistent: No such file or directory
|
|
|
|
# bash 5.0.18 bash: line 1: /nonexistent: No such file or directory
|
|
|
|
# bash 5.1.0 bash: line 1: /nonexistent: No such file or directory
|
|
|
|
# dash dash: 1: cannot open /nonexistent: No such file
|
|
|
|
#
|
2023-01-28 00:23:54 +00:00
|
|
|
STD_SED_CMDS.shell+= -e 's,^${.SHELL},${.SHELL:T},'
|
2021-02-11 01:51:11 +00:00
|
|
|
STD_SED_CMDS.shell+= -e 's,^${.SHELL:T}: line [0-9][0-9]*: ,,'
|
|
|
|
STD_SED_CMDS.shell+= -e 's,^${.SHELL:T}: [0-9][0-9]*: ,,'
|
|
|
|
STD_SED_CMDS.shell+= -e 's,^${.SHELL:T}: ,,'
|
2023-01-28 00:23:54 +00:00
|
|
|
STD_SED_CMDS.shell+= -e 's,: command not found,: not found,'
|
2021-01-14 01:24:34 +00:00
|
|
|
|
2021-12-18 07:27:22 +00:00
|
|
|
STD_SED_CMDS.white-space= -e 's, *, ,g' -e 's, *$$,,'
|
|
|
|
|
2021-06-25 18:16:24 +00:00
|
|
|
# The actual error messages for a failed regcomp or regexec differ between the
|
|
|
|
# implementations.
|
|
|
|
STD_SED_CMDS.regex= \
|
|
|
|
-e 's,\(Regex compilation error:\).*,\1 (details omitted),'
|
|
|
|
|
2023-01-28 00:23:54 +00:00
|
|
|
# Normalize timestamps from ':gmtime' or ':localtime' to '<timestamp>'.
|
|
|
|
# See STD_SED_CMDS.dg2 for timestamps from the debug log.
|
|
|
|
STD_SED_CMDS.timestamp= \
|
|
|
|
-e 's,[A-Z][a-z][a-z] [A-Z][a-z][a-z] [ 0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [12][0-9][0-9][0-9],<timestamp>,'
|
|
|
|
|
2021-02-11 01:51:11 +00:00
|
|
|
# End of the configuration helpers section.
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2020-09-05 16:11:04 +00:00
|
|
|
.-include "Makefile.inc"
|
2020-05-20 19:34:48 +00:00
|
|
|
.-include "Makefile.config"
|
|
|
|
|
2020-07-11 22:45:05 +00:00
|
|
|
UNIT_TESTS:= ${.PARSEDIR}
|
2015-04-20 03:45:54 +00:00
|
|
|
.PATH: ${UNIT_TESTS}
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2020-11-07 19:39:21 +00:00
|
|
|
.if ${USE_ABSOLUTE_TESTNAMES:Uno} == yes
|
|
|
|
OUTFILES= ${TESTS:@test@${.CURDIR:tA}/${test}.out@}
|
|
|
|
.else
|
2020-07-11 22:45:05 +00:00
|
|
|
OUTFILES= ${TESTS:=.out}
|
2020-11-07 19:39:21 +00:00
|
|
|
.endif
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2015-04-20 03:45:54 +00:00
|
|
|
all: ${OUTFILES}
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2020-09-05 16:11:04 +00:00
|
|
|
CLEANFILES= *.rawout *.out *.status *.tmp *.core *.tmp
|
2020-07-11 22:45:05 +00:00
|
|
|
CLEANFILES+= obj*.[och] lib*.a # posix1.mk
|
|
|
|
CLEANFILES+= issue* .[ab]* # suffixes.mk
|
2020-09-05 16:11:04 +00:00
|
|
|
CLEANDIRS= dir dummy # posix1.mk
|
2015-04-20 03:45:54 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f ${CLEANFILES}
|
2020-09-05 16:11:04 +00:00
|
|
|
rm -rf ${CLEANDIRS}
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2020-07-11 22:45:05 +00:00
|
|
|
TEST_MAKE?= ${.MAKE}
|
|
|
|
TOOL_SED?= sed
|
|
|
|
TOOL_TR?= tr
|
|
|
|
TOOL_DIFF?= diff
|
|
|
|
DIFF_FLAGS?= -u
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2013-04-01 21:12:55 +00:00
|
|
|
.if defined(.PARSEDIR)
|
2012-06-08 21:57:36 +00:00
|
|
|
# ensure consistent results from sort(1)
|
2020-07-11 22:45:05 +00:00
|
|
|
LC_ALL= C
|
|
|
|
LANG= C
|
2012-06-08 21:57:36 +00:00
|
|
|
.export LANG LC_ALL
|
2013-04-01 21:12:55 +00:00
|
|
|
.endif
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2020-09-05 16:11:04 +00:00
|
|
|
.if ${.MAKE.MODE:Unormal:Mmeta} != ""
|
|
|
|
# we don't need the noise
|
|
|
|
_MKMSG_TEST= :
|
|
|
|
.endif
|
|
|
|
|
2023-01-28 00:23:54 +00:00
|
|
|
# Some Linux systems such as Fedora have deprecated egrep in favor of grep -E.
|
|
|
|
.if ${.MAKE.OS:NLinux} == ""
|
|
|
|
EGREP= grep -E
|
|
|
|
.endif
|
|
|
|
# Keep the classical definition for all other systems. Just as the bmake code
|
|
|
|
# is kept compatible with C90, the tests are kept compatible with systems that
|
|
|
|
# are several decades old and don't follow modern POSIX standards.
|
|
|
|
EGREP?= egrep
|
|
|
|
|
|
|
|
MAKE_TEST_ENV= EGREP="${EGREP}"
|
|
|
|
MAKE_TEST_ENV+= MALLOC_OPTIONS="JA" # for jemalloc 100
|
2021-12-18 07:27:22 +00:00
|
|
|
MAKE_TEST_ENV+= MALLOC_CONF="junk:true" # for jemalloc 510
|
2021-02-11 01:51:11 +00:00
|
|
|
MAKE_TEST_ENV+= TMPDIR=${TMPDIR}
|
2020-11-07 19:39:21 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
.if ${.MAKE.OS} == "NetBSD"
|
2022-07-26 15:52:53 +00:00
|
|
|
LIMIT_RESOURCES?= ulimit -v 300000
|
2021-01-14 01:24:34 +00:00
|
|
|
.endif
|
|
|
|
LIMIT_RESOURCES?= :
|
|
|
|
|
2022-04-03 19:52:08 +00:00
|
|
|
# Each test is run in a sub-make, to keep the tests from interfering with
|
2020-11-07 19:39:21 +00:00
|
|
|
# each other, and because they use different environment variables and
|
|
|
|
# command line options.
|
2015-04-20 03:45:54 +00:00
|
|
|
.SUFFIXES: .mk .rawout .out
|
|
|
|
.mk.rawout:
|
2020-09-05 16:11:04 +00:00
|
|
|
@${_MKMSG_TEST:Uecho '# test '} ${.PREFIX}
|
|
|
|
@set -eu; \
|
2021-01-14 01:24:34 +00:00
|
|
|
${LIMIT_RESOURCES}; \
|
2020-09-05 16:11:04 +00:00
|
|
|
cd ${.OBJDIR}; \
|
2020-11-07 19:39:21 +00:00
|
|
|
env -i PATH="$$PATH" ${MAKE_TEST_ENV} ${ENV.${.PREFIX:T}} \
|
2020-09-05 16:11:04 +00:00
|
|
|
${TEST_MAKE} \
|
|
|
|
-r -C ${.CURDIR} -f ${.IMPSRC} \
|
2020-11-07 19:39:21 +00:00
|
|
|
${FLAGS.${.PREFIX:T}:U-k} \
|
2020-09-05 16:11:04 +00:00
|
|
|
> ${.TARGET}.tmp 2>&1 \
|
|
|
|
&& status=$$? || status=$$?; \
|
|
|
|
echo $$status > ${.TARGET:R}.status
|
2015-04-20 03:45:54 +00:00
|
|
|
@mv ${.TARGET}.tmp ${.TARGET}
|
|
|
|
|
2022-07-26 15:52:53 +00:00
|
|
|
# Postprocess the test output to make the output platform-independent.
|
2020-07-11 22:45:05 +00:00
|
|
|
#
|
2023-04-24 23:44:30 +00:00
|
|
|
# Replace anything after 'stopped in' with unit-tests
|
2020-07-11 22:45:05 +00:00
|
|
|
_SED_CMDS+= -e '/stopped/s, /.*, unit-tests,'
|
2022-02-05 20:03:50 +00:00
|
|
|
# Allow the test files to be placed anywhere.
|
|
|
|
_SED_CMDS+= -e 's,\(\.PARSEDIR}\) = `'"/[^']*'"',\1 = <some-dir>,'
|
|
|
|
_SED_CMDS+= -e 's,\(\.INCLUDEDFROMDIR}\) = `'"/[^']*'"',\1 = <some-dir>,'
|
2023-04-24 23:44:30 +00:00
|
|
|
_SED_CMDS+= -e 's,${TMPDIR},<tmpdir>,g' -e 's,${TMPDIR:tA},<tmpdir>,g'
|
2021-12-18 07:27:22 +00:00
|
|
|
# canonicalize ${.OBJDIR} and ${.CURDIR}
|
2023-04-24 23:44:30 +00:00
|
|
|
_SED_CMDS+= -e 's,${.CURDIR},<curdir>,g'
|
2021-12-18 07:27:22 +00:00
|
|
|
.if ${.OBJDIR} != ${.CURDIR}
|
|
|
|
# yes this is inaccurate but none of the tests expect <objdir> anywhere
|
|
|
|
# which we get depending on how MAKEOBJDIR is set.
|
2023-04-24 23:44:30 +00:00
|
|
|
_SED_CMDS+= -e 's,${.OBJDIR},<curdir>,g' -e 's,${.OBJDIR:tA},<curdir>,g'
|
2021-12-18 07:27:22 +00:00
|
|
|
.endif
|
2023-04-24 23:44:30 +00:00
|
|
|
# always pretend .MAKE was called 'make'
|
|
|
|
_SED_CMDS+= -e 's,^${TEST_MAKE:T:S,.,\\.,g}[][0-9]*:,make:,'
|
|
|
|
_SED_CMDS+= -e 's,${TEST_MAKE:S,.,\\.,g},make,'
|
|
|
|
_SED_CMDS+= -e 's,^usage: ${TEST_MAKE:T:S,.,\\.,g} ,usage: make ,'
|
2021-12-18 07:27:22 +00:00
|
|
|
_SED_CMDS+= -e 's,<curdir>/,,g'
|
2020-07-11 22:45:05 +00:00
|
|
|
_SED_CMDS+= -e 's,${UNIT_TESTS:S,.,\\.,g}/,,g'
|
2023-01-28 00:23:54 +00:00
|
|
|
_SED_CMDS+= -e '/MAKE_VERSION/d'
|
|
|
|
_SED_CMDS+= -e '/EGREP=/d'
|
|
|
|
|
2021-12-18 07:27:22 +00:00
|
|
|
# on AT&T derived systems: false exits 255 not 1
|
2021-01-14 01:24:34 +00:00
|
|
|
.if ${.MAKE.OS:N*BSD} != ""
|
|
|
|
_SED_CMDS+= -e 's,\(Error code\) 255,\1 1,'
|
|
|
|
.endif
|
2021-12-18 07:27:22 +00:00
|
|
|
.if ${.SHELL:T} == "ksh"
|
|
|
|
_SED_CMDS+= -e '/^set [+-]v/d'
|
|
|
|
.endif
|
2020-07-11 22:45:05 +00:00
|
|
|
|
2015-04-20 03:45:54 +00:00
|
|
|
.rawout.out:
|
2020-11-07 19:39:21 +00:00
|
|
|
@${TOOL_SED} ${_SED_CMDS} ${SED_CMDS.${.PREFIX:T}} \
|
2020-09-05 16:11:04 +00:00
|
|
|
< ${.IMPSRC} > ${.TARGET}.tmp1
|
2020-11-07 19:39:21 +00:00
|
|
|
@${POSTPROC.${.PREFIX:T}:Ucat} < ${.TARGET}.tmp1 > ${.TARGET}.tmp2
|
2020-09-05 16:11:04 +00:00
|
|
|
@rm ${.TARGET}.tmp1
|
|
|
|
@echo "exit status `cat ${.TARGET:R}.status`" >> ${.TARGET}.tmp2
|
|
|
|
@mv ${.TARGET}.tmp2 ${.TARGET}
|
2015-04-20 03:45:54 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
.if empty(DIFF_FLAGS)
|
|
|
|
DIFF_ECHO= echo
|
|
|
|
.else
|
|
|
|
DIFF_ECHO= :
|
|
|
|
.endif
|
|
|
|
|
2015-04-20 03:45:54 +00:00
|
|
|
# Compare all output files
|
|
|
|
test: ${OUTFILES} .PHONY
|
|
|
|
@failed= ; \
|
2020-07-11 22:45:05 +00:00
|
|
|
for test in ${TESTS}; do \
|
2021-01-14 01:24:34 +00:00
|
|
|
cmp -s ${UNIT_TESTS}/$${test}.exp $${test}.out && continue || \
|
|
|
|
${DIFF_ECHO} diff ${UNIT_TESTS}/$${test}.exp $${test}.out; \
|
2015-12-07 22:51:25 +00:00
|
|
|
${TOOL_DIFF} ${DIFF_FLAGS} ${UNIT_TESTS}/$${test}.exp $${test}.out \
|
2015-04-20 03:45:54 +00:00
|
|
|
|| failed="$${failed}$${failed:+ }$${test}" ; \
|
|
|
|
done ; \
|
|
|
|
if [ -n "$${failed}" ]; then \
|
|
|
|
echo "Failed tests: $${failed}" ; false ; \
|
|
|
|
else \
|
|
|
|
echo "All tests passed" ; \
|
|
|
|
fi
|
2012-06-08 21:57:36 +00:00
|
|
|
|
|
|
|
accept:
|
2020-07-11 22:45:05 +00:00
|
|
|
@for test in ${TESTS}; do \
|
2015-04-20 03:45:54 +00:00
|
|
|
cmp -s ${UNIT_TESTS}/$${test}.exp $${test}.out \
|
|
|
|
|| { echo "Replacing $${test}.exp" ; \
|
|
|
|
cp $${test}.out ${UNIT_TESTS}/$${test}.exp ; } \
|
|
|
|
done
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2015-04-20 03:45:54 +00:00
|
|
|
.if exists(${TEST_MAKE})
|
2020-11-07 19:39:21 +00:00
|
|
|
${TESTS:=.rawout}: ${TEST_MAKE}
|
|
|
|
# in meta mode, we *know* if a target script is impacted
|
|
|
|
# by a makefile change.
|
|
|
|
.if ${.MAKE.MODE:Unormal:Mmeta} == ""
|
|
|
|
${TESTS:=.rawout}: ${.PARSEDIR}/Makefile
|
|
|
|
.endif
|
2015-04-20 03:45:54 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.-include <obj.mk>
|