aboutsummaryrefslogtreecommitdiff
path: root/cddl/usr.sbin
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2019-03-15 21:49:19 +0000
committerEnji Cooper <ngie@FreeBSD.org>2019-03-15 21:49:19 +0000
commita530b610636be65c4948ba01a65da56627d7ffe2 (patch)
tree599ab22e9f25335e157487c3c2146422c8ae34e8 /cddl/usr.sbin
parent7840b63a780f99969388ab141c50c1fd6c822228 (diff)
downloadsrc-a530b610636be65c4948ba01a65da56627d7ffe2.tar.gz
src-a530b610636be65c4948ba01a65da56627d7ffe2.zip
Integrate cddl/usr.sbin/zfds/tests into the FreeBSD test suite
This change integrates the unit tests for zfsd into the test suite using the integration method described in r345203. This change removes the `LOCALBASE` includes added for the port version of googlemock/googletest, as well as unnecessary `LIBADD`/`DPADD` and `CXXFLAGS` defines, which are included in the `GTEST_CXXFLAGS` variable, as part of r345203. Reviewed by: asomers Approved by: emaste (mentor) MFC after: 2 months MFC with: r345203 Differential Revision: https://reviews.freebsd.org/D19552
Notes
Notes: svn path=/head/; revision=345205
Diffstat (limited to 'cddl/usr.sbin')
-rw-r--r--cddl/usr.sbin/zfsd/Makefile9
-rw-r--r--cddl/usr.sbin/zfsd/Makefile.common5
-rw-r--r--cddl/usr.sbin/zfsd/tests/Makefile28
3 files changed, 12 insertions, 30 deletions
diff --git a/cddl/usr.sbin/zfsd/Makefile b/cddl/usr.sbin/zfsd/Makefile
index 436ae70ea5e7..88eb9220a8cc 100644
--- a/cddl/usr.sbin/zfsd/Makefile
+++ b/cddl/usr.sbin/zfsd/Makefile
@@ -1,12 +1,13 @@
# $FreeBSD$
+.include <src.opts.mk>
+
.include "Makefile.common"
PROG_CXX= zfsd
MAN= zfsd.8
-.include <bsd.prog.mk>
+HAS_TESTS=
+SUBDIR.${MK_GOOGLETEST}+= tests
-# The unittests require devel/googletest and devel/googlemock from ports.
-# Don't automatically build them.
-SUBDIR=
+.include <bsd.prog.mk>
diff --git a/cddl/usr.sbin/zfsd/Makefile.common b/cddl/usr.sbin/zfsd/Makefile.common
index 061a26a28343..2f1b7b9f5a32 100644
--- a/cddl/usr.sbin/zfsd/Makefile.common
+++ b/cddl/usr.sbin/zfsd/Makefile.common
@@ -28,12 +28,11 @@ INCFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair
INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
+INCFLAGS+= -I${SRCTOP}/cddl/usr.sbin
CFLAGS= -g -DNEED_SOLARIS_BOOLEAN ${INCFLAGS}
-DPADD= ${LIBDEVDCTL} ${LIBZFS} ${LIBZFS_CORE} ${LIBUTIL} ${LIBGEOM} \
- ${LIBBSDXML} ${LIBSBUF} ${LIBNVPAIR} ${LIBUUTIL}
-LIBADD= devdctl zfs zfs_core util geom bsdxml sbuf nvpair uutil
+LIBADD+= devdctl zfs zfs_core util geom bsdxml sbuf nvpair uutil
cscope:
find ${.CURDIR} -type f -a \( -name "*.[ch]" -o -name "*.cc" \) \
diff --git a/cddl/usr.sbin/zfsd/tests/Makefile b/cddl/usr.sbin/zfsd/tests/Makefile
index 40cb3ce2f057..1b776b217776 100644
--- a/cddl/usr.sbin/zfsd/tests/Makefile
+++ b/cddl/usr.sbin/zfsd/tests/Makefile
@@ -3,30 +3,12 @@
.include "${.CURDIR}/../Makefile.common"
.PATH: ${.CURDIR:H}
-PLAIN_TESTS_CXX= zfsd_unittest
-SRCS.zfsd_unittest:= ${SRCS:Nzfsd_main.cc}
-SRCS.zfsd_unittest+= libmocks.c zfsd_unittest.cc
-SRCS=
+GTESTS= zfsd_unittest
-# Use #include <zfsd/xxx.h> in test programs.
-INCFLAGS+= -I${.CURDIR:H:H}
+SRCS.zfsd_unittest:= ${SRCS:Nzfsd_main.cc}
+SRCS.zfsd_unittest+= libmocks.c zfsd_unittest.cc
+.undef SRCS
-.if defined(DESTDIR) || defined(SYSROOT)
-INCFLAGS+= -I${SYSROOT:U${DESTDIR}}/usr/include
-LDFLAGS.zfsd_unittest+= -L${SYSROOT:U${DESTDIR}}/lib \
- -L${SYSROOT:U${DESTDIR}}/usr/lib
-.endif
-
-# Googletest options
-INCFLAGS+= -I${LOCALBASE}/include -D_THREAD_SAFE -pthread
-LDFLAGS.zfsd_unittest+= -L${LOCALBASE}/lib -D_THREAD_SAFE -pthread
-LDADD.zfsd_unittest+= ${LOCALBASE}/lib/libgtest.a
-
-# GoogleMock options
-LDADD.zfsd_unittest+= ${LOCALBASE}/lib/libgmock.a ${LOCALBASE}/lib/libgmock_main.a
-
-# Googlemock fails if we don't have this line
-# https://groups.google.com/forum/#!msg/googletestframework/h8ixEPCFm0o/amwfu4xGJb0J
-CFLAGS.zfsd_unittest+= -DGTEST_HAS_PTHREAD
+LIBADD.zfsd_unittest+= gmock_main
.include <bsd.test.mk>