new tests for libarchive

This commit is contained in:
christos 2020-01-17 16:25:37 +00:00
parent 77da719c4b
commit ad61858a16
5 changed files with 333 additions and 3 deletions

View File

@ -1,15 +1,15 @@
# $NetBSD: Makefile,v 1.29 2019/10/14 03:47:19 jhigh Exp $ # $NetBSD: Makefile,v 1.30 2020/01/17 16:25:37 christos Exp $
# #
.include <bsd.own.mk> .include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/usr.bin TESTSDIR= ${TESTSBASE}/usr.bin
TESTS_SUBDIRS= awk basename bzip2 cc cmp config cut \ TESTS_SUBDIRS= awk basename bzip2 cc cmp config cpio cut \
diff dirname find gdb grep gzip id indent \ diff dirname find gdb grep gzip id indent \
infocmp jot ld m4 make mixerctl mkdep nbperf netpgpverify \ infocmp jot ld m4 make mixerctl mkdep nbperf netpgpverify \
pkill pr printf pwhash rump_server shmif_dumpbus sdiff \ pkill pr printf pwhash rump_server shmif_dumpbus sdiff \
sed sort tmux tr unifdef uniq vmstat xlint sed sort tar tmux tr unifdef uniq vmstat xlint
.if ${MKCXX} != "no" .if ${MKCXX} != "no"
TESTS_SUBDIRS+= c++ TESTS_SUBDIRS+= c++

115
tests/usr.bin/cpio/Makefile Normal file
View File

@ -0,0 +1,115 @@
# $NetBSD: Makefile,v 1.1 2020/01/17 16:25:37 christos Exp $
NOMAN=
.include <bsd.own.mk>
LIBARCHIVE=${NETBSDSRCDIR}/external/bsd/libarchive/dist
TESTSDIR= ${TESTSBASE}/usr.bin/cpio
BINDIR= ${TESTSDIR}
PROGS+= h_cpio
TESTS_SH+= t_cpio
CPPFLAGS+=-I${LIBARCHIVE}/test_utils -I${LIBARCHIVE}/cpio -I.
CPPFLAGS+=-I${LIBARCHIVE}/cpio/test -I${LIBARCHIVE}/../include
CPPFLAGS+=-I${LIBARCHIVE}/libarchive -I${LIBARCHIVE}/libarchive_fe
CPPFLAGS+=-DPLATFORM_CONFIG_H='"config_netbsd.h"'
.PATH: ${LIBARCHIVE}/cpio/test ${LIBARCHIVE}/test_utils ${LIBARCHIVE}/cpio \
${LIBARCHIVE}/libarchive_fe
LDADD+=-larchive
DPADD+=${LIBARCHIVE}
SRCS.h_cpio= \
test_main.c \
test_utils.c \
cmdline.c \
err.c \
test_0.c \
test_basic.c \
test_cmdline.c \
test_extract_cpio_Z.c \
test_extract_cpio_bz2.c \
test_extract_cpio_grz.c \
test_extract_cpio_gz.c \
test_extract_cpio_lrz.c \
test_extract_cpio_lz.c \
test_extract_cpio_lz4.c \
test_extract_cpio_lzma.c \
test_extract_cpio_lzo.c \
test_extract_cpio_xz.c \
test_extract_cpio_zstd.c \
test_format_newc.c \
test_gcpio_compat.c \
test_missing_file.c \
test_option_0.c \
test_option_B_upper.c \
test_option_C_upper.c \
test_option_J_upper.c \
test_option_L_upper.c \
test_option_Z_upper.c \
test_option_a.c \
test_option_b64encode.c \
test_option_c.c \
test_option_d.c \
test_option_f.c \
test_option_grzip.c \
test_option_help.c \
test_option_l.c \
test_option_lrzip.c \
test_option_lz4.c \
test_option_lzma.c \
test_option_lzop.c \
test_option_m.c \
test_option_passphrase.c \
test_option_t.c \
test_option_u.c \
test_option_version.c \
test_option_xz.c \
test_option_y.c \
test_option_z.c \
test_option_zstd.c \
test_owner_parse.c \
test_passthrough_dotdot.c \
test_passthrough_reverse.c
FILESDIR= ${TESTSDIR}
FILES=\
test_extract.cpio.Z.uu \
test_extract.cpio.bz2.uu \
test_extract.cpio.grz.uu \
test_extract.cpio.gz.uu \
test_extract.cpio.lrz.uu \
test_extract.cpio.lz.uu \
test_extract.cpio.lz4.uu \
test_extract.cpio.lzma.uu \
test_extract.cpio.lzo.uu \
test_extract.cpio.xz.uu \
test_extract.cpio.zst.uu \
test_gcpio_compat_ref.bin.uu \
test_gcpio_compat_ref.crc.uu \
test_gcpio_compat_ref.newc.uu \
test_gcpio_compat_ref.ustar.uu \
test_gcpio_compat_ref_nosym.bin.uu \
test_gcpio_compat_ref_nosym.crc.uu \
test_gcpio_compat_ref_nosym.newc.uu \
test_gcpio_compat_ref_nosym.ustar.uu \
test_option_f.cpio.uu \
test_option_m.cpio.uu \
test_option_passphrase.zip.uu \
test_option_t.cpio.uu \
test_option_t.stdout.uu \
test_option_tv.stdout.uu
.include <bsd.test.mk>
test_main.o: list.h
CLEANFILES+=list.h
list.h: ${SRCS.h_cpio} Makefile
${TOOL_GREP} -h '^DEFINE_TEST(' ${.ALLSRC} > ${.TARGET}

View File

@ -0,0 +1,49 @@
# $NetBSD: t_cpio.sh,v 1.1 2020/01/17 16:25:37 christos Exp $
#
# Copyright (c) 2020 The NetBSD Foundation, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
atf_test_case cpio
cpio_head()
{
atf_set "descr" "test cpio"
}
cpio_body()
{
local d=$(atf_get_srcdir)
local dd=$(pwd)
# to get the program name right since it is embedded in error
# strings that need to match
ln -s /usr/bin/cpio "$dd/bsdcpio"
atf_check -s exit:0 -o 'not-match:^Details for failing tests:.*' \
-e ignore "$d/h_cpio" -p "$dd/bsdcpio" -r "$d"
}
atf_init_test_cases()
{
atf_add_test_case cpio
}

121
tests/usr.bin/tar/Makefile Normal file
View File

@ -0,0 +1,121 @@
# $NetBSD: Makefile,v 1.1 2020/01/17 16:25:37 christos Exp $
NOMAN=
.include <bsd.own.mk>
LIBARCHIVE=${NETBSDSRCDIR}/external/bsd/libarchive/dist
TESTSDIR= ${TESTSBASE}/usr.bin/tar
BINDIR= ${TESTSDIR}
PROGS+= h_tar
TESTS_SH+= t_tar
CPPFLAGS+=-I${LIBARCHIVE}/test_utils -I${LIBARCHIVE}/tar -I.
CPPFLAGS+=-I${LIBARCHIVE}/tar/test -I${LIBARCHIVE}/../include
CPPFLAGS+=-I${LIBARCHIVE}/libarchive
.PATH: ${LIBARCHIVE}/tar/test ${LIBARCHIVE}/test_utils
LDADD+=-larchive
DPADD+=${LIBARCHIVE}
SRCS.h_tar= \
test_main.c \
test_utils.c \
test_0.c \
test_basic.c \
test_copy.c \
test_empty_mtree.c \
test_extract_tar_Z.c \
test_extract_tar_bz2.c \
test_extract_tar_grz.c \
test_extract_tar_gz.c \
test_extract_tar_lrz.c \
test_extract_tar_lz.c \
test_extract_tar_lz4.c \
test_extract_tar_lzma.c \
test_extract_tar_lzo.c \
test_extract_tar_xz.c \
test_extract_tar_zstd.c \
test_format_newc.c \
test_help.c \
test_leading_slash.c \
test_missing_file.c \
test_option_C_mtree.c \
test_option_C_upper.c \
test_option_H_upper.c \
test_option_L_upper.c \
test_option_O_upper.c \
test_option_T_upper.c \
test_option_U_upper.c \
test_option_X_upper.c \
test_option_a.c \
test_option_acls.c \
test_option_b.c \
test_option_b64encode.c \
test_option_exclude.c \
test_option_exclude_vcs.c \
test_option_fflags.c \
test_option_gid_gname.c \
test_option_grzip.c \
test_option_j.c \
test_option_k.c \
test_option_keep_newer_files.c \
test_option_lrzip.c \
test_option_lz4.c \
test_option_lzma.c \
test_option_lzop.c \
test_option_n.c \
test_option_newer_than.c \
test_option_nodump.c \
test_option_older_than.c \
test_option_passphrase.c \
test_option_q.c \
test_option_r.c \
test_option_s.c \
test_option_uid_uname.c \
test_option_uuencode.c \
test_option_xattrs.c \
test_option_xz.c \
test_option_z.c \
test_option_zstd.c \
test_patterns.c \
test_print_longpath.c \
test_stdio.c \
test_strip_components.c \
test_symlink_dir.c \
test_version.c \
test_windows.c
FILESDIR= ${TESTSDIR}
FILES=\
test_extract.tar.Z.uu \
test_extract.tar.bz2.uu \
test_extract.tar.grz.uu \
test_extract.tar.gz.uu \
test_extract.tar.lrz.uu \
test_extract.tar.lz.uu \
test_extract.tar.lz4.uu \
test_extract.tar.lzma.uu \
test_extract.tar.lzo.uu \
test_extract.tar.xz.uu \
test_extract.tar.zst.uu \
test_leading_slash.tar.uu \
test_option_keep_newer_files.tar.Z.uu \
test_option_passphrase.zip.uu \
test_option_s.tar.Z.uu \
test_patterns_2.tar.uu \
test_patterns_3.tar.uu \
test_patterns_4.tar.uu \
test_print_longpath.tar.Z.uu
.include <bsd.test.mk>
test_main.o: list.h
CLEANFILES+=list.h
list.h: ${SRCS.h_tar} Makefile
${TOOL_GREP} -h '^DEFINE_TEST(' ${.ALLSRC} > ${.TARGET}

View File

@ -0,0 +1,45 @@
# $NetBSD: t_tar.sh,v 1.1 2020/01/17 16:25:37 christos Exp $
#
# Copyright (c) 2020 The NetBSD Foundation, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
atf_test_case tar
tar_head()
{
atf_set "descr" "test tar"
}
tar_body()
{
local d=$(atf_get_srcdir)
atf_check -s exit:0 -o 'not-match:^Details for failing tests:.*' \
-e ignore "$d/h_tar" -p /usr/bin/tar -r "$d"
}
atf_init_test_cases()
{
atf_add_test_case tar
}