2012-11-07 22:02:02 +00:00
|
|
|
# $FreeBSD$
|
|
|
|
#
|
2014-03-14 08:56:19 +00:00
|
|
|
# You must include bsd.test.mk instead of this file from your Makefile.
|
|
|
|
#
|
2013-10-19 06:48:49 +00:00
|
|
|
# Logic to build and install ATF test programs; i.e. test programs linked
|
|
|
|
# against the ATF libraries.
|
2012-11-07 22:02:02 +00:00
|
|
|
|
2014-03-14 08:56:19 +00:00
|
|
|
.if !target(__<bsd.test.mk>__)
|
|
|
|
.error atf.test.mk cannot be included directly.
|
|
|
|
.endif
|
2012-11-07 22:02:02 +00:00
|
|
|
|
2013-10-19 06:48:49 +00:00
|
|
|
# List of C, C++ and shell test programs to build.
|
|
|
|
#
|
|
|
|
# Programs listed here are built using PROGS, PROGS_CXX and SCRIPTS,
|
|
|
|
# respectively, from bsd.prog.mk. However, the build rules are tweaked to
|
|
|
|
# require the ATF libraries.
|
|
|
|
#
|
|
|
|
# Test programs registered in this manner are set to be installed into TESTSDIR
|
2018-07-27 10:44:38 +00:00
|
|
|
# (which should be overridden by the Makefile) and are not required to provide a
|
2013-10-19 06:48:49 +00:00
|
|
|
# manpage.
|
|
|
|
ATF_TESTS_C?=
|
|
|
|
ATF_TESTS_CXX?=
|
|
|
|
ATF_TESTS_SH?=
|
Add the ZFS test suite
It was originally written by Sun as part of the STF (Solaris test framework).
They open sourced it in OpenSolaris, then HighCloud partially ported it to
FreeBSD, and Spectra Logic finished the port. We also added many testcases,
fixed many broken ones, and converted them all to the ATF framework. We've had
help along the way from avg, araujo, smh, and brd.
By default most of the tests are disabled. Set the disks Kyua variable to
enable them.
Submitted by: asomers, will, justing, ken, brd, avg, araujo, smh
Sponsored by: Spectra Logic Corp, HighCloud
2018-02-23 16:31:00 +00:00
|
|
|
ATF_TESTS_KSH93?=
|
2022-06-25 19:01:45 +00:00
|
|
|
ATF_TESTS_PYTEST?=
|
2013-10-19 06:48:49 +00:00
|
|
|
|
|
|
|
.if !empty(ATF_TESTS_C)
|
|
|
|
PROGS+= ${ATF_TESTS_C}
|
2013-10-19 06:50:56 +00:00
|
|
|
_TESTS+= ${ATF_TESTS_C}
|
2013-10-19 06:48:49 +00:00
|
|
|
.for _T in ${ATF_TESTS_C}
|
|
|
|
BINDIR.${_T}= ${TESTSDIR}
|
|
|
|
MAN.${_T}?= # empty
|
2012-11-07 22:02:02 +00:00
|
|
|
SRCS.${_T}?= ${_T}.c
|
|
|
|
DPADD.${_T}+= ${LIBATF_C}
|
2014-10-22 18:11:10 +00:00
|
|
|
.if empty(LDFLAGS:M-static) && empty(LDFLAGS.${_T}:M-static)
|
2015-05-04 16:28:54 +00:00
|
|
|
LDADD.${_T}+= ${LDADD_atf_c}
|
2014-10-22 18:11:10 +00:00
|
|
|
.else
|
|
|
|
LDADD.${_T}+= ${LIBATF_C}
|
|
|
|
.endif
|
2013-10-19 06:50:56 +00:00
|
|
|
TEST_INTERFACE.${_T}= atf
|
2012-11-07 22:02:02 +00:00
|
|
|
.endfor
|
|
|
|
.endif
|
|
|
|
|
2013-10-19 06:48:49 +00:00
|
|
|
.if !empty(ATF_TESTS_CXX)
|
|
|
|
PROGS_CXX+= ${ATF_TESTS_CXX}
|
2013-10-19 06:50:56 +00:00
|
|
|
_TESTS+= ${ATF_TESTS_CXX}
|
2013-10-19 06:48:49 +00:00
|
|
|
.for _T in ${ATF_TESTS_CXX}
|
|
|
|
BINDIR.${_T}= ${TESTSDIR}
|
|
|
|
MAN.${_T}?= # empty
|
2012-11-07 22:02:02 +00:00
|
|
|
SRCS.${_T}?= ${_T}${CXX_SUFFIX:U.cc}
|
|
|
|
DPADD.${_T}+= ${LIBATF_CXX} ${LIBATF_C}
|
2014-10-22 18:11:10 +00:00
|
|
|
.if empty(LDFLAGS:M-static) && empty(LDFLAGS.${_T}:M-static)
|
2015-05-04 16:28:54 +00:00
|
|
|
LDADD.${_T}+= ${LDADD_atf_cxx} ${LDADD_atf_c}
|
2014-10-22 18:11:10 +00:00
|
|
|
.else
|
|
|
|
LDADD.${_T}+= ${LIBATF_CXX} ${LIBATF_C}
|
|
|
|
.endif
|
2013-10-19 06:50:56 +00:00
|
|
|
TEST_INTERFACE.${_T}= atf
|
2012-11-07 22:02:02 +00:00
|
|
|
.endfor
|
2019-09-17 06:07:08 +00:00
|
|
|
# Silence warnings about usage of deprecated std::auto_ptr
|
|
|
|
CXXWARNFLAGS+= -Wno-deprecated-declarations
|
2012-11-07 22:02:02 +00:00
|
|
|
.endif
|
|
|
|
|
2013-10-19 06:48:49 +00:00
|
|
|
.if !empty(ATF_TESTS_SH)
|
|
|
|
SCRIPTS+= ${ATF_TESTS_SH}
|
2013-10-19 06:50:56 +00:00
|
|
|
_TESTS+= ${ATF_TESTS_SH}
|
2013-10-19 06:48:49 +00:00
|
|
|
.for _T in ${ATF_TESTS_SH}
|
|
|
|
SCRIPTSDIR_${_T}= ${TESTSDIR}
|
2013-10-19 06:50:56 +00:00
|
|
|
TEST_INTERFACE.${_T}= atf
|
2012-11-07 22:02:02 +00:00
|
|
|
CLEANFILES+= ${_T} ${_T}.tmp
|
2014-06-06 17:53:05 +00:00
|
|
|
# TODO(jmmv): It seems to me that this SED and SRC functionality should
|
|
|
|
# exist in bsd.prog.mk along the support for SCRIPTS. Move it there if
|
|
|
|
# this proves to be useful within the tests.
|
|
|
|
ATF_TESTS_SH_SED_${_T}?= # empty
|
2013-10-19 06:48:49 +00:00
|
|
|
ATF_TESTS_SH_SRC_${_T}?= ${_T}.sh
|
|
|
|
${_T}: ${ATF_TESTS_SH_SRC_${_T}}
|
2014-06-06 18:58:06 +00:00
|
|
|
echo '#! /usr/libexec/atf-sh' > ${.TARGET}.tmp
|
2014-11-04 01:57:31 +00:00
|
|
|
.if empty(ATF_TESTS_SH_SED_${_T})
|
|
|
|
cat ${.ALLSRC:N*Makefile*} >>${.TARGET}.tmp
|
|
|
|
.else
|
2014-07-09 00:55:50 +00:00
|
|
|
cat ${.ALLSRC:N*Makefile*} \
|
|
|
|
| sed ${ATF_TESTS_SH_SED_${_T}} >>${.TARGET}.tmp
|
2014-11-04 01:57:31 +00:00
|
|
|
.endif
|
2012-11-07 22:02:02 +00:00
|
|
|
chmod +x ${.TARGET}.tmp
|
|
|
|
mv ${.TARGET}.tmp ${.TARGET}
|
|
|
|
.endfor
|
|
|
|
.endif
|
Add the ZFS test suite
It was originally written by Sun as part of the STF (Solaris test framework).
They open sourced it in OpenSolaris, then HighCloud partially ported it to
FreeBSD, and Spectra Logic finished the port. We also added many testcases,
fixed many broken ones, and converted them all to the ATF framework. We've had
help along the way from avg, araujo, smh, and brd.
By default most of the tests are disabled. Set the disks Kyua variable to
enable them.
Submitted by: asomers, will, justing, ken, brd, avg, araujo, smh
Sponsored by: Spectra Logic Corp, HighCloud
2018-02-23 16:31:00 +00:00
|
|
|
|
|
|
|
.if !empty(ATF_TESTS_KSH93)
|
|
|
|
SCRIPTS+= ${ATF_TESTS_KSH93}
|
|
|
|
_TESTS+= ${ATF_TESTS_KSH93}
|
|
|
|
.for _T in ${ATF_TESTS_KSH93}
|
|
|
|
SCRIPTSDIR_${_T}= ${TESTSDIR}
|
|
|
|
TEST_INTERFACE.${_T}= atf
|
2018-02-24 15:13:20 +00:00
|
|
|
TEST_METADATA.${_T}+= required_programs="ksh93"
|
Add the ZFS test suite
It was originally written by Sun as part of the STF (Solaris test framework).
They open sourced it in OpenSolaris, then HighCloud partially ported it to
FreeBSD, and Spectra Logic finished the port. We also added many testcases,
fixed many broken ones, and converted them all to the ATF framework. We've had
help along the way from avg, araujo, smh, and brd.
By default most of the tests are disabled. Set the disks Kyua variable to
enable them.
Submitted by: asomers, will, justing, ken, brd, avg, araujo, smh
Sponsored by: Spectra Logic Corp, HighCloud
2018-02-23 16:31:00 +00:00
|
|
|
CLEANFILES+= ${_T} ${_T}.tmp
|
|
|
|
# TODO(jmmv): It seems to me that this SED and SRC functionality should
|
|
|
|
# exist in bsd.prog.mk along the support for SCRIPTS. Move it there if
|
|
|
|
# this proves to be useful within the tests.
|
|
|
|
ATF_TESTS_KSH93_SED_${_T}?= # empty
|
|
|
|
ATF_TESTS_KSH93_SRC_${_T}?= ${_T}.sh
|
|
|
|
${_T}: ${ATF_TESTS_KSH93_SRC_${_T}}
|
|
|
|
echo '#! /usr/libexec/atf-sh -s/usr/local/bin/ksh93' > ${.TARGET}.tmp
|
|
|
|
.if empty(ATF_TESTS_KSH93_SED_${_T})
|
|
|
|
cat ${.ALLSRC:N*Makefile*} >>${.TARGET}.tmp
|
|
|
|
.else
|
|
|
|
cat ${.ALLSRC:N*Makefile*} \
|
|
|
|
| sed ${ATF_TESTS_KSH93_SED_${_T}} >>${.TARGET}.tmp
|
|
|
|
.endif
|
|
|
|
chmod +x ${.TARGET}.tmp
|
|
|
|
mv ${.TARGET}.tmp ${.TARGET}
|
|
|
|
.endfor
|
|
|
|
.endif
|
2022-06-25 19:01:45 +00:00
|
|
|
|
|
|
|
.if !empty(ATF_TESTS_PYTEST)
|
|
|
|
# bsd.prog.mk SCRIPTS interface removes file extension unless
|
|
|
|
# SCRIPTSNAME is set, which is not possible to do here.
|
|
|
|
# Workaround this by appending another extension (.xtmp) to the
|
|
|
|
# file name. Use separate loop to avoid dealing with explicitly
|
|
|
|
# stating expansion for each and every variable.
|
|
|
|
#
|
|
|
|
# ATF_TESTS_PYTEST -> contains list of files as is (test_something.py ..)
|
|
|
|
# _ATF_TESTS_PYTEST -> (test_something.py.xtmp ..)
|
|
|
|
#
|
|
|
|
# Former array is iterated to construct Kyuafile, where original file
|
|
|
|
# names need to be written.
|
|
|
|
# Latter array is iterated to enable bsd.prog.mk scripts framework -
|
|
|
|
# namely, installing scripts without .xtmp prefix. Note: this allows to
|
|
|
|
# not bother about the fact that make target needs to be different from
|
|
|
|
# the source file.
|
|
|
|
_TESTS+= ${ATF_TESTS_PYTEST}
|
|
|
|
_ATF_TESTS_PYTEST=
|
|
|
|
.for _T in ${ATF_TESTS_PYTEST}
|
|
|
|
_ATF_TESTS_PYTEST += ${_T}.xtmp
|
|
|
|
TEST_INTERFACE.${_T}= atf
|
|
|
|
TEST_METADATA.${_T}+= required_programs="pytest"
|
|
|
|
.endfor
|
|
|
|
|
|
|
|
SCRIPTS+= ${_ATF_TESTS_PYTEST}
|
|
|
|
.for _T in ${_ATF_TESTS_PYTEST}
|
|
|
|
SCRIPTSDIR_${_T}= ${TESTSDIR}
|
|
|
|
CLEANFILES+= ${_T} ${_T}.tmp
|
|
|
|
# TODO(jmmv): It seems to me that this SED and SRC functionality should
|
|
|
|
# exist in bsd.prog.mk along the support for SCRIPTS. Move it there if
|
|
|
|
# this proves to be useful within the tests.
|
|
|
|
ATF_TESTS_PYTEST_SED_${_T}?= # empty
|
|
|
|
ATF_TESTS_PYTEST_SRC_${_T}?= ${.CURDIR}/${_T:S,.xtmp$,,}
|
|
|
|
${_T}:
|
2022-06-26 11:46:37 +00:00
|
|
|
echo "#! /usr/libexec/atf_pytest_wrapper -P ${TESTSBASE}" > ${.TARGET}.tmp
|
2022-06-25 19:01:45 +00:00
|
|
|
.if empty(ATF_TESTS_PYTEST_SED_${_T})
|
|
|
|
cat ${ATF_TESTS_PYTEST_SRC_${_T}} >>${.TARGET}.tmp
|
|
|
|
.else
|
|
|
|
cat ${ATF_TESTS_PYTEST_SRC_${_T}} \
|
|
|
|
| sed ${ATF_TESTS_PYTEST_SED_${_T}} >>${.TARGET}.tmp
|
|
|
|
.endif
|
|
|
|
chmod +x ${.TARGET}.tmp
|
|
|
|
mv ${.TARGET}.tmp ${.TARGET}
|
|
|
|
.endfor
|
|
|
|
.endif
|