From 17b80845b0ba13495186831d3505af8c20eeb6ac Mon Sep 17 00:00:00 2001 From: jmmv Date: Sat, 28 Dec 2013 23:08:58 +0000 Subject: Plug the ATF tests into the build. This is a MFC into stable/10 of: - r257849 Add libatf-c++ to the prebuild libs. - r257853 Build and install the atf tests. - r258233 Move all atf directories to the tests mtree. - r258285 Fix the build of some ATF tests. This change is "make tinderbox" clean on ref10-amd64 with the default settings of WITHOUT_TESTS. It is likely for the WITH_TESTS build to still be broken because not all relevant changes have been merged yet. --- lib/atf/Makefile | 10 ++++-- lib/atf/Makefile.inc | 2 -- lib/atf/libatf-c++/Makefile | 5 +++ lib/atf/libatf-c++/Makefile.inc | 3 ++ lib/atf/libatf-c++/tests/Makefile | 47 +++++++++++++++++++++++++++ lib/atf/libatf-c/Makefile | 5 +++ lib/atf/libatf-c/Makefile.inc | 3 ++ lib/atf/libatf-c/tests/Makefile | 62 ++++++++++++++++++++++++++++++++++++ lib/atf/tests/Makefile | 12 +++++++ lib/atf/tests/test-programs/Makefile | 24 ++++++++++++++ 10 files changed, 168 insertions(+), 5 deletions(-) create mode 100644 lib/atf/libatf-c++/Makefile.inc create mode 100644 lib/atf/libatf-c++/tests/Makefile create mode 100644 lib/atf/libatf-c/Makefile.inc create mode 100644 lib/atf/libatf-c/tests/Makefile create mode 100644 lib/atf/tests/Makefile create mode 100644 lib/atf/tests/test-programs/Makefile (limited to 'lib/atf') diff --git a/lib/atf/Makefile b/lib/atf/Makefile index 0da9aa8..a191f0d 100644 --- a/lib/atf/Makefile +++ b/lib/atf/Makefile @@ -27,9 +27,13 @@ .include -SUBDIR= \ - libatf-c \ - libatf-c++ +SUBDIR= libatf-c \ + libatf-c++ \ + ${_tests} + +.if ${MK_TESTS} != "no" +_tests= tests +.endif .ORDER: ${SUBDIR} diff --git a/lib/atf/Makefile.inc b/lib/atf/Makefile.inc index 937187a..15e7517 100644 --- a/lib/atf/Makefile.inc +++ b/lib/atf/Makefile.inc @@ -25,8 +25,6 @@ # # $FreeBSD$ -ATF= ${.CURDIR}/../../../contrib/atf - _CFLAGS:= ${CFLAGS} _CPPFLAGS:= ${CPPFLAGS} _CXXFLAGS:= ${CXXFLAGS} diff --git a/lib/atf/libatf-c++/Makefile b/lib/atf/libatf-c++/Makefile index 37d6073..96f620b 100644 --- a/lib/atf/libatf-c++/Makefile +++ b/lib/atf/libatf-c++/Makefile @@ -36,6 +36,7 @@ LDADD= -latf-c LDFLAGS+= -L${.OBJDIR}/../libatf-c +ATF= ${.CURDIR:H:H:H}/contrib/atf .PATH: ${ATF} .PATH: ${ATF}/atf-c++ .PATH: ${ATF}/atf-c++/detail @@ -73,4 +74,8 @@ INCSDIR_atf-c++.hpp= ${INCLUDEDIR} MAN= atf-c++-api.3 +.if ${MK_TESTS} != "no" +SUBDIR= tests +.endif + .include diff --git a/lib/atf/libatf-c++/Makefile.inc b/lib/atf/libatf-c++/Makefile.inc new file mode 100644 index 0000000..265f86d --- /dev/null +++ b/lib/atf/libatf-c++/Makefile.inc @@ -0,0 +1,3 @@ +# $FreeBSD$ + +.include "../Makefile.inc" diff --git a/lib/atf/libatf-c++/tests/Makefile b/lib/atf/libatf-c++/tests/Makefile new file mode 100644 index 0000000..db10fce --- /dev/null +++ b/lib/atf/libatf-c++/tests/Makefile @@ -0,0 +1,47 @@ +# $FreeBSD$ + +.include + +TESTSDIR= ${TESTSBASE}/lib/atf/libatf-c++ + +ATF= ${.CURDIR:H:H:H:H}/contrib/atf +.PATH: ${ATF}/atf-c++ +.PATH: ${ATF}/atf-c++/detail + +CFLAGS+= -I${ATF} + +FILESDIR= ${TESTSDIR} +FILES= macros_hpp_test.cpp +FILES+= unused_test.cpp + +# Tests in atf-c++. +.for _T in atf_c++_test \ + build_test \ + check_test \ + config_test \ + macros_test \ + tests_test \ + utils_test +ATF_TESTS_CXX+= ${_T} +SRCS.${_T}= ${_T}.cpp test_helpers.cpp +.endfor + +ATF_TESTS_SH= pkg_config_test + +# Tests in atf-c++/detail. + +.for _T in application_test \ + env_test \ + exceptions_test \ + expand_test \ + fs_test \ + parser_test \ + process_test \ + sanity_test \ + text_test \ + ui_test +ATF_TESTS_CXX+= ${_T} +SRCS.${_T}= ${_T}.cpp test_helpers.cpp +.endfor + +.include diff --git a/lib/atf/libatf-c/Makefile b/lib/atf/libatf-c/Makefile index 26fba5c..b197958 100644 --- a/lib/atf/libatf-c/Makefile +++ b/lib/atf/libatf-c/Makefile @@ -30,6 +30,7 @@ LIB= atf-c SHLIB_MAJOR= 1 +ATF= ${.CURDIR:H:H:H}/contrib/atf .PATH: ${ATF} .PATH: ${ATF}/atf-c .PATH: ${ATF}/atf-c/detail @@ -73,4 +74,8 @@ INCSDIR_atf-c.h= ${INCLUDEDIR} MAN= atf-c-api.3 +.if ${MK_TESTS} != "no" +SUBDIR= tests +.endif + .include diff --git a/lib/atf/libatf-c/Makefile.inc b/lib/atf/libatf-c/Makefile.inc new file mode 100644 index 0000000..265f86d --- /dev/null +++ b/lib/atf/libatf-c/Makefile.inc @@ -0,0 +1,3 @@ +# $FreeBSD$ + +.include "../Makefile.inc" diff --git a/lib/atf/libatf-c/tests/Makefile b/lib/atf/libatf-c/tests/Makefile new file mode 100644 index 0000000..856c3d7 --- /dev/null +++ b/lib/atf/libatf-c/tests/Makefile @@ -0,0 +1,62 @@ +# $FreeBSD$ + +.include + +TESTSDIR= ${TESTSBASE}/lib/atf/libatf-c + +ATF= ${.CURDIR:H:H:H:H}/contrib/atf +.PATH: ${ATF}/atf-c +.PATH: ${ATF}/atf-c/detail + +CFLAGS+= -I${ATF} + +.if ${COMPILER_TYPE} == "clang" +# macros_test.c contains a double 'const const' which will be gone with +# the import of atf-0.18. +# TODO(jmmv): Remove this workaround once we do that update. +CFLAGS+= -Wno-duplicate-decl-specifier +.endif + +FILESDIR= ${TESTSDIR} +FILES= macros_h_test.c +FILES+= unused_test.c + +# Tests in atf-c. + +.for _T in atf_c_test \ + build_test \ + check_test \ + config_test \ + error_test \ + macros_test \ + tc_test \ + tp_test \ + utils_test +ATF_TESTS_C+= ${_T} +SRCS.${_T}= ${_T}.c test_helpers.c +.endfor + +ATF_TESTS_SH= pkg_config_test + +# Tests in atf-c/detail. + +.for _T in dynstr_test \ + env_test \ + fs_test \ + list_test \ + map_test \ + process_test \ + sanity_test \ + test_helpers_test \ + text_test \ + user_test +ATF_TESTS_C+= ${_T} +SRCS.${_T}= ${_T}.c test_helpers.c +.endfor + +PROGS+= process_helpers +SRCS.process_helpers= process_helpers.c +MAN.process_helpers= # defined +BINDIR.process_helpers= ${TESTSDIR} + +.include diff --git a/lib/atf/tests/Makefile b/lib/atf/tests/Makefile new file mode 100644 index 0000000..7bc96c9 --- /dev/null +++ b/lib/atf/tests/Makefile @@ -0,0 +1,12 @@ +# $FreeBSD$ + +.include + +TESTSDIR= ${TESTSBASE}/lib/atf + +.PATH: ${.CURDIR:H:H:H}/tests +KYUAFILE= yes + +SUBDIR= test-programs + +.include diff --git a/lib/atf/tests/test-programs/Makefile b/lib/atf/tests/test-programs/Makefile new file mode 100644 index 0000000..f1ba9f5 --- /dev/null +++ b/lib/atf/tests/test-programs/Makefile @@ -0,0 +1,24 @@ +# $FreeBSD$ + +.include + +TESTSDIR= ${TESTSBASE}/lib/atf/test-programs +KYUAFILE= yes + +ATF= ${.CURDIR:H:H:H:H}/contrib/atf +.PATH: ${ATF}/test-programs + +CFLAGS+= -I${ATF} + +ATF_TESTS_C= c_helpers + +ATF_TESTS_CXX= cpp_helpers +SRCS.cpp_helpers= cpp_helpers.cpp + +ATF_TESTS_SH= sh_helpers +.for _T in config_test expect_test fork_test meta_data_test result_test srcdir_test +ATF_TESTS_SH+= ${_T} +ATF_TESTS_SH_SRC_${_T}= common.sh ${_T}.sh +.endfor + +.include -- cgit v1.1