xref: /netbsd-src/tests/lib/libarchive/t_libarchive.sh (revision 2916a307c12ed8c683e931fd30f24f840d8f0c80)
1*2916a307Smartin#       $NetBSD: t_libarchive.sh,v 1.8 2021/02/19 18:36:50 martin Exp $
277da719cSchristos#
377da719cSchristos# Copyright (c) 2020 The NetBSD Foundation, Inc.
477da719cSchristos# All rights reserved.
577da719cSchristos#
677da719cSchristos# Redistribution and use in source and binary forms, with or without
777da719cSchristos# modification, are permitted provided that the following conditions
877da719cSchristos# are met:
977da719cSchristos# 1. Redistributions of source code must retain the above copyright
1077da719cSchristos#    notice, this list of conditions and the following disclaimer.
1177da719cSchristos# 2. Redistributions in binary form must reproduce the above copyright
1277da719cSchristos#    notice, this list of conditions and the following disclaimer in the
1377da719cSchristos#    documentation and/or other materials provided with the distribution.
1477da719cSchristos#
1577da719cSchristos# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1677da719cSchristos# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1777da719cSchristos# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1877da719cSchristos# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1977da719cSchristos# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2077da719cSchristos# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2177da719cSchristos# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2277da719cSchristos# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2377da719cSchristos# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2477da719cSchristos# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2577da719cSchristos# POSSIBILITY OF SUCH DAMAGE.
2677da719cSchristos#
2777da719cSchristos
2877da719cSchristosatf_test_case libarchive
2977da719cSchristos
307865465bSchristosexport TMPDIR=$PWD
317865465bSchristos
3277da719cSchristoslibarchive_head()
3377da719cSchristos{
3477da719cSchristos        atf_set "descr" "test libarchive"
35a46096efSmartin	atf_set	"timeout" "6000"
3677da719cSchristos}
3777da719cSchristos
3877da719cSchristoslibarchive_body()
3977da719cSchristos{
40305e2e0fSmartin	local m=$(( $( sysctl -n hw.usermem64 ) / 1024 / 1024 ))
41305e2e0fSmartin	if [ $m -lt 400 ]; then
425996c744Ssevan		atf_skip "Not enough RAM"
43305e2e0fSmartin	fi
4477da719cSchristos	local d=$(atf_get_srcdir)
4577da719cSchristos	atf_check -s exit:0 -o 'not-match:^Details for failing tests:.*' \
4677da719cSchristos	    "$d/h_libarchive" -r "$d"
4777da719cSchristos}
4877da719cSchristos
4977da719cSchristosatf_init_test_cases()
5077da719cSchristos{
5177da719cSchristos	atf_add_test_case libarchive
5277da719cSchristos}
53