Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Oct 2015 06:08:55 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r288977 - in user/ngie/more-tests2: etc/mtree usr.bin/cpio usr.bin/cpio/test usr.bin/cpio/tests usr.bin/tar usr.bin/tar/test usr.bin/tar/tests
Message-ID:  <201510070608.t9768tRl098332@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Wed Oct  7 06:08:55 2015
New Revision: 288977
URL: https://svnweb.freebsd.org/changeset/base/288977

Log:
  Integrate the rest of the pieces from libarchive into the
  FreeBSD test suite (cpio, tar)

Added:
  user/ngie/more-tests2/usr.bin/cpio/tests/
     - copied from r288975, user/ngie/more-tests2/usr.bin/cpio/test/
  user/ngie/more-tests2/usr.bin/cpio/tests/functional_test.sh
     - copied, changed from r288976, user/ngie/more-tests2/lib/libarchive/tests/functional_test.sh
  user/ngie/more-tests2/usr.bin/tar/tests/
     - copied from r288975, user/ngie/more-tests2/usr.bin/tar/test/
  user/ngie/more-tests2/usr.bin/tar/tests/functional_test.sh
     - copied, changed from r288976, user/ngie/more-tests2/lib/libarchive/tests/functional_test.sh
Deleted:
  user/ngie/more-tests2/usr.bin/cpio/test/
  user/ngie/more-tests2/usr.bin/tar/test/
Modified:
  user/ngie/more-tests2/etc/mtree/BSD.tests.dist
  user/ngie/more-tests2/usr.bin/cpio/Makefile
  user/ngie/more-tests2/usr.bin/cpio/tests/Makefile
  user/ngie/more-tests2/usr.bin/tar/Makefile
  user/ngie/more-tests2/usr.bin/tar/tests/Makefile

Modified: user/ngie/more-tests2/etc/mtree/BSD.tests.dist
==============================================================================
--- user/ngie/more-tests2/etc/mtree/BSD.tests.dist	Wed Oct  7 05:20:44 2015	(r288976)
+++ user/ngie/more-tests2/etc/mtree/BSD.tests.dist	Wed Oct  7 06:08:55 2015	(r288977)
@@ -242,6 +242,8 @@
             test-programs
             ..
         ..
+        libarchive
+        ..
         libc
             c063
             ..
@@ -518,6 +520,8 @@
         ..
         cmp
         ..
+        cpio
+        ..
         col
         ..
         comm
@@ -556,6 +560,8 @@
         ..
         soelim
         ..
+        tar
+        ..
         timeout
         ..
         tr

Modified: user/ngie/more-tests2/usr.bin/cpio/Makefile
==============================================================================
--- user/ngie/more-tests2/usr.bin/cpio/Makefile	Wed Oct  7 05:20:44 2015	(r288976)
+++ user/ngie/more-tests2/usr.bin/cpio/Makefile	Wed Oct  7 06:08:55 2015	(r288977)
@@ -32,12 +32,8 @@ CFLAGS+=	-DHAVE_ICONV=1 -DHAVE_ICONV_H=1
 SYMLINKS=bsdcpio ${BINDIR}/cpio
 MLINKS= bsdcpio.1 cpio.1
 
-.PHONY: check test clean-test
-
-check test: $(PROG) bsdcpio.1.gz
-	cd ${.CURDIR}/test && make obj && make test
-
-clean-test:
-	cd ${.CURDIR}/test && make clean
+.if ${MK_TESTS} != "no"
+SUBDIR+=	tests
+.endif
 
 .include <bsd.prog.mk>

Modified: user/ngie/more-tests2/usr.bin/cpio/tests/Makefile
==============================================================================
--- user/ngie/more-tests2/usr.bin/cpio/test/Makefile	Wed Oct  7 03:33:25 2015	(r288975)
+++ user/ngie/more-tests2/usr.bin/cpio/tests/Makefile	Wed Oct  7 06:08:55 2015	(r288977)
@@ -1,6 +1,12 @@
 # $FreeBSD$
 
-LIBARCHIVEDIR=	${.CURDIR}/../../../contrib/libarchive
+LIBARCHIVEDIR=	${SRCTOP}/contrib/libarchive
+
+ATF_TESTS_SH+=	functional_test
+
+PROGS+=		bsdcpio_test
+
+BINDIR=		${TESTSDIR}
 
 .PATH:	${LIBARCHIVEDIR}/cpio
 CPIO_SRCS= cmdline.c
@@ -9,7 +15,7 @@ CPIO_SRCS= cmdline.c
 CPIO_SRCS+= err.c
 
 .PATH:	${LIBARCHIVEDIR}/cpio/test
-TESTS=	\
+TESTS_SRCS=	\
 	test_0.c				\
 	test_basic.c				\
 	test_cmdline.c				\
@@ -54,44 +60,55 @@ TESTS=	\
 	test_passthrough_reverse.c
 
 # Build the test program
-SRCS= list.h					\
+SRCS.bsdcpio_test= list.h			\
 	${CPIO_SRCS}				\
-	${TESTS}				\
+	${TESTS_SRCS}				\
 	main.c
 
 .PATH:	${LIBARCHIVEDIR}/test_utils
-SRCS+=	test_utils.c
-
-CLEANFILES+= list.h bsdcpio_test
+SRCS.bsdcpio_test+=	test_utils.c
 
-MAN=
+CLEANFILES+= list.h
 
-PROG=bsdcpio_test
-CFLAGS+=	-DPLATFORM_CONFIG_H=\"${.CURDIR}/../../../lib/libarchive/config_freebsd.h\"
-CFLAGS+=	-I${.CURDIR}/../../../lib/libarchive -I${.OBJDIR}
-LIBADD=	archive
-#CFLAGS+= -static -g -O2 -Wall
-CFLAGS+= -g -O2 -Wall
-CFLAGS+= -I${.OBJDIR}
-CFLAGS+= -I${LIBARCHIVEDIR}/cpio -I${LIBARCHIVEDIR}/libarchive_fe
-CFLAGS+= -I${LIBARCHIVEDIR}/test_utils
+CFLAGS+=	-DPLATFORM_CONFIG_H=\"${SRCTOP}/lib/libarchive/config_freebsd.h\"
+CFLAGS+=	-I${SRCTOP}/lib/libarchive -I${.OBJDIR}
+LIBADD=		archive
+
+DEBUG_FLAGS+=	-g
+CFLAGS+=	-I${.OBJDIR}
+CFLAGS+=	-I${LIBARCHIVEDIR}/cpio -I${LIBARCHIVEDIR}/libarchive_fe
+CFLAGS+=	-I${LIBARCHIVEDIR}/test_utils
 
 # Uncomment to link against dmalloc
 #LDADD+= -L/usr/local/lib -ldmalloc
 #CFLAGS+= -I/usr/local/include -DUSE_DMALLOC
 
-check test:	bsdcpio_test
-	${.OBJDIR}/bsdcpio_test -p ${.OBJDIR}/../bsdcpio \
-	-r ${LIBARCHIVEDIR}/cpio/test
-
-${.OBJDIR}/list.h list.h: ${TESTS} Makefile
-	(cd ${LIBARCHIVEDIR}/cpio/test; cat ${TESTS}) | \
-	grep DEFINE_TEST > ${.OBJDIR}/list.h
-
-clean:
-	rm -f ${CLEANFILES}
-	rm -f *~
-	-chmod -R +w /tmp/bsdcpio_test.*
-	rm -rf /tmp/bsdcpio_test.*
+list.h: ${TESTS_SRCS} Makefile
+	@(cd ${LIBARCHIVEDIR}/tar/test && \
+	grep -h DEFINE_TEST ${.ALLSRC:N*Makefile}) > ${.TARGET}.tmp
+	@mv ${.TARGET}.tmp ${.TARGET}
+
+FILES+= test_extract.cpio.Z.uu
+FILES+= test_extract.cpio.bz2.uu
+FILES+= test_extract.cpio.grz.uu
+FILES+= test_extract.cpio.gz.uu
+FILES+= test_extract.cpio.lrz.uu
+FILES+= test_extract.cpio.lz.uu
+FILES+= test_extract.cpio.lzma.uu
+FILES+= test_extract.cpio.lzo.uu
+FILES+= test_extract.cpio.xz.uu
+FILES+= test_gcpio_compat_ref.bin.uu
+FILES+= test_gcpio_compat_ref.crc.uu
+FILES+= test_gcpio_compat_ref.newc.uu
+FILES+= test_gcpio_compat_ref.ustar.uu
+FILES+= test_gcpio_compat_ref_nosym.bin.uu
+FILES+= test_gcpio_compat_ref_nosym.crc.uu
+FILES+= test_gcpio_compat_ref_nosym.newc.uu
+FILES+= test_gcpio_compat_ref_nosym.ustar.uu
+FILES+= test_option_f.cpio.uu
+FILES+= test_option_m.cpio.uu
+FILES+= test_option_t.cpio.uu
+FILES+= test_option_t.stdout.uu
+FILES+= test_option_tv.stdout.uu
 
-.include <bsd.prog.mk>
+.include <bsd.test.mk>

Copied and modified: user/ngie/more-tests2/usr.bin/cpio/tests/functional_test.sh (from r288976, user/ngie/more-tests2/lib/libarchive/tests/functional_test.sh)
==============================================================================
--- user/ngie/more-tests2/lib/libarchive/tests/functional_test.sh	Wed Oct  7 05:20:44 2015	(r288976, copy source)
+++ user/ngie/more-tests2/usr.bin/cpio/tests/functional_test.sh	Wed Oct  7 06:08:55 2015	(r288977)
@@ -27,13 +27,19 @@
 # $FreeBSD$
 
 SRCDIR=$(atf_get_srcdir)
-TESTER="${SRCDIR}/libarchive_test"
+TESTER="${SRCDIR}/bsdcpio_test"
+export BSDCPIO=$(which cpio)
 
 check()
 {
 	local testcase=${1}; shift
 
-	atf_check -o ignore -s exit:0 ${TESTER} -d -r "${SRCDIR}" -v "${testcase}"
+	# For some odd reason /bin/sh spuriously writes
+	# "write error on stdout" with some of the testcases
+	#
+	# Probably an issue with how they're written as it calls system(3) to
+	# clean up directories..
+	atf_check -e ignore -o ignore -s exit:0 ${TESTER} -d -r "${SRCDIR}" -v "${testcase}"
 }
 
 atf_init_test_cases()

Modified: user/ngie/more-tests2/usr.bin/tar/Makefile
==============================================================================
--- user/ngie/more-tests2/usr.bin/tar/Makefile	Wed Oct  7 05:20:44 2015	(r288976)
+++ user/ngie/more-tests2/usr.bin/tar/Makefile	Wed Oct  7 06:08:55 2015	(r288977)
@@ -32,11 +32,8 @@ CFLAGS+=	-I${LIBARCHIVEDIR}/libarchive_f
 SYMLINKS=	bsdtar ${BINDIR}/tar
 MLINKS=	bsdtar.1 tar.1
 
-.PHONY: check test clean-test
-check test: $(PROG) bsdtar.1.gz
-	cd ${.CURDIR}/test && make obj && make test
-
-clean-test:
-	cd ${.CURDIR}/test && make clean
+.if ${MK_TESTS} != "no"
+SUBDIR+=	tests
+.endif
 
 .include <bsd.prog.mk>

Modified: user/ngie/more-tests2/usr.bin/tar/tests/Makefile
==============================================================================
--- user/ngie/more-tests2/usr.bin/tar/test/Makefile	Wed Oct  7 03:33:25 2015	(r288975)
+++ user/ngie/more-tests2/usr.bin/tar/tests/Makefile	Wed Oct  7 06:08:55 2015	(r288977)
@@ -1,9 +1,15 @@
 # $FreeBSD$
 
-LIBARCHIVEDIR=	${.CURDIR}/../../../contrib/libarchive
+LIBARCHIVEDIR=	${SRCTOP}/contrib/libarchive
+
+ATF_TESTS_SH+=	functional_test
+
+BINDIR=		${TESTSDIR}
+
+PROGS+=		bsdtar_test
 
 .PATH: ${LIBARCHIVEDIR}/tar/test
-TESTS=	\
+TESTS_SRCS=	\
 	test_0.c				\
 	test_basic.c				\
 	test_copy.c				\
@@ -56,46 +62,54 @@ TESTS=	\
 	test_version.c
 
 # Build the test program
-SRCS=	${TAR_SRCS}				\
-	${TESTS}				\
-	list.h					\
+SRCS.bsdtar_test=	\
+	${TESTS_SRCS}	\
+	list.h		\
 	main.c
 
+BROKEN_TESTS=
+
+DPSRCS.bsdtar_test+=	list.h
+
 .PATH: ${LIBARCHIVEDIR}/test_utils
-SRCS+=	test_utils.c
+SRCS.bsdtar_test+=	test_utils.c
+
+CLEANFILES+=	list.h
 
-CLEANFILES+= list.h
+LIBADD+=	archive
 
-MAN=
+DEBUG_FLAGS+=	-g
+CFLAGS+=	-DPLATFORM_CONFIG_H=\"${SRCTOP}/lib/libarchive/config_freebsd.h\"
+CFLAGS+=	-static -Wall
 
-PROG=bsdtar_test
-DPADD=${LIBARCHIVE} ${LIBBZ2} ${LIBZ} ${LIBLZMA}
-CFLAGS+=	-DPLATFORM_CONFIG_H=\"${.CURDIR}/../../../lib/libarchive/config_freebsd.h\"
-LDADD= -larchive -lz -lbz2 -llzma
-CFLAGS+= -static -g -O2 -Wall
-CFLAGS+= -I${.CURDIR}/../../../lib/libarchive -I${.OBJDIR}
-CFLAGS+= -I${LIBARCHIVEDIR}/tar -I${LIBARCHIVEDIR}/test_utils
+CFLAGS+=	-I${SRCTOP}/lib/libarchive -I${.OBJDIR}
+CFLAGS+=	-I${LIBARCHIVEDIR}/tar -I${LIBARCHIVEDIR}/test_utils
 
 # Uncomment to link against dmalloc
 #LDADD+= -L/usr/local/lib -ldmalloc
 #CFLAGS+= -I/usr/local/include -DUSE_DMALLOC
 
-check test:	bsdtar_test
-	./bsdtar_test -p ${.OBJDIR}/../bsdtar -r ${LIBARCHIVEDIR}/tar/test
-
-list.h: ${TESTS} Makefile
-	(cd ${LIBARCHIVEDIR}/tar/test; cat ${TESTS}) | \
-	grep DEFINE_TEST > ${.OBJDIR}/list.h
-
-clean:
-	rm -f ${CLEANFILES}
-	rm -f *.out
-	rm -f *.o
-	rm -f *.core
-	rm -f *~
-	rm -f list.h
-	rm -f archive.h ../archive.h
-	-chmod -R +w /tmp/bsdtar_test.*
-	rm -rf /tmp/bsdtar_test.*
+list.h: ${TESTS_SRCS} Makefile
+	@(cd ${LIBARCHIVEDIR}/tar/test && \
+	grep -h DEFINE_TEST ${.ALLSRC:N*Makefile}) > ${.TARGET}.tmp
+	@mv ${.TARGET}.tmp ${.TARGET}
+
+CLEANFILES+=	list.h list.h.tmp
+
+FILES+=	test_extract.tar.Z.uu
+FILES+=	test_extract.tar.bz2.uu
+FILES+=	test_extract.tar.grz.uu
+FILES+=	test_extract.tar.gz.uu
+FILES+=	test_extract.tar.lrz.uu
+FILES+=	test_extract.tar.lz.uu
+FILES+=	test_extract.tar.lzma.uu
+FILES+=	test_extract.tar.lzo.uu
+FILES+=	test_extract.tar.xz.uu
+FILES+=	test_option_keep_newer_files.tar.Z.uu
+FILES+=	test_option_s.tar.Z.uu
+FILES+=	test_patterns_2.tar.uu
+FILES+=	test_patterns_3.tar.uu
+FILES+=	test_patterns_4.tar.uu
+FILES+=	test_print_longpath.tar.Z.uu
 
-.include <bsd.prog.mk>
+.include <bsd.test.mk>

Copied and modified: user/ngie/more-tests2/usr.bin/tar/tests/functional_test.sh (from r288976, user/ngie/more-tests2/lib/libarchive/tests/functional_test.sh)
==============================================================================
--- user/ngie/more-tests2/lib/libarchive/tests/functional_test.sh	Wed Oct  7 05:20:44 2015	(r288976, copy source)
+++ user/ngie/more-tests2/usr.bin/tar/tests/functional_test.sh	Wed Oct  7 06:08:55 2015	(r288977)
@@ -26,8 +26,9 @@
 #
 # $FreeBSD$
 
+export BSDTAR=$(which tar)
 SRCDIR=$(atf_get_srcdir)
-TESTER="${SRCDIR}/libarchive_test"
+TESTER="${SRCDIR}/bsdtar_test"
 
 check()
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201510070608.t9768tRl098332>