diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist index 1f61599eddd4..64bf426d0e02 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -87,6 +87,8 @@ .. libmp .. + libnv + .. .. libexec atf diff --git a/lib/libnv/Makefile b/lib/libnv/Makefile index 710c2950671c..cad1ea4eba63 100644 --- a/lib/libnv/Makefile +++ b/lib/libnv/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + LIB= nv SHLIBDIR?= /lib SHLIB_MAJOR= 0 @@ -158,4 +160,8 @@ MLINKS+=nv.3 nvlist_existsv.3 \ WARNS?= 6 +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include diff --git a/lib/libnv/tests/Makefile b/lib/libnv/tests/Makefile new file mode 100644 index 000000000000..df1054960cd2 --- /dev/null +++ b/lib/libnv/tests/Makefile @@ -0,0 +1,17 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/lib/libnv + +TAP_TESTS_C+= nvlist_add_test +TAP_TESTS_C+= nvlist_exists_test +TAP_TESTS_C+= nvlist_free_test +TAP_TESTS_C+= nvlist_get_test +TAP_TESTS_C+= nvlist_move_test +TAP_TESTS_C+= nvlist_send_recv_test + +DPADD+= ${LIBNV} +LDADD+= -lnv + +WARNS?= 6 + +.include diff --git a/tools/regression/lib/libnv/nvlist_add.c b/lib/libnv/tests/nvlist_add_test.c similarity index 100% rename from tools/regression/lib/libnv/nvlist_add.c rename to lib/libnv/tests/nvlist_add_test.c diff --git a/tools/regression/lib/libnv/nvlist_exists.c b/lib/libnv/tests/nvlist_exists_test.c similarity index 100% rename from tools/regression/lib/libnv/nvlist_exists.c rename to lib/libnv/tests/nvlist_exists_test.c diff --git a/tools/regression/lib/libnv/nvlist_free.c b/lib/libnv/tests/nvlist_free_test.c similarity index 100% rename from tools/regression/lib/libnv/nvlist_free.c rename to lib/libnv/tests/nvlist_free_test.c diff --git a/tools/regression/lib/libnv/nvlist_get.c b/lib/libnv/tests/nvlist_get_test.c similarity index 100% rename from tools/regression/lib/libnv/nvlist_get.c rename to lib/libnv/tests/nvlist_get_test.c diff --git a/tools/regression/lib/libnv/nvlist_move.c b/lib/libnv/tests/nvlist_move_test.c similarity index 100% rename from tools/regression/lib/libnv/nvlist_move.c rename to lib/libnv/tests/nvlist_move_test.c diff --git a/tools/regression/lib/libnv/nvlist_send_recv.c b/lib/libnv/tests/nvlist_send_recv_test.c similarity index 100% rename from tools/regression/lib/libnv/nvlist_send_recv.c rename to lib/libnv/tests/nvlist_send_recv_test.c diff --git a/tools/regression/lib/libnv/Makefile b/tools/regression/lib/libnv/Makefile deleted file mode 100644 index a64cb63fbe66..000000000000 --- a/tools/regression/lib/libnv/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# $FreeBSD$ - -TESTS= nvlist_add -TESTS+= nvlist_exists -TESTS+= nvlist_free -TESTS+= nvlist_get -TESTS+= nvlist_move -TESTS+= nvlist_send_recv - -CFLAGS= -O2 -pipe -fstack-protector -CFLAGS+=-Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -CFLAGS+=-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -CFLAGS+=-Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -CFLAGS+=-Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -CFLAGS+=-Wold-style-definition -Wno-pointer-sign -Wextra - -LDFLAGS+=-lnv - -all: ${TESTS} ${TESTS:=.t} - -.for TEST in ${TESTS} - -${TEST}: ${TEST}.c - ${CC} ${CFLAGS} ${LDFLAGS} ${@}.c -o $@ - -${TEST}.t: ${TEST} - @printf "#!/bin/sh\n\n%s/%s\n" ${.CURDIR} ${@:.t=} > $@ - -.endfor - -test: all - @prove -r ${.CURDIR} - -clean: - rm -f ${TESTS} ${TESTS:=.t}