1*a31f3228Schristos# $NetBSD: t_basic.sh,v 1.10 2020/04/02 00:00:16 christos Exp $ 2efd10a65Spooka# 3efd10a65Spooka# Copyright (c) 2011 The NetBSD Foundation, Inc. 4efd10a65Spooka# All rights reserved. 5efd10a65Spooka# 6efd10a65Spooka# Redistribution and use in source and binary forms, with or without 7efd10a65Spooka# modification, are permitted provided that the following conditions 8efd10a65Spooka# are met: 9efd10a65Spooka# 1. Redistributions of source code must retain the above copyright 10efd10a65Spooka# notice, this list of conditions and the following disclaimer. 11efd10a65Spooka# 2. Redistributions in binary form must reproduce the above copyright 12efd10a65Spooka# notice, this list of conditions and the following disclaimer in the 13efd10a65Spooka# documentation and/or other materials provided with the distribution. 14efd10a65Spooka# 15efd10a65Spooka# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 16efd10a65Spooka# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17efd10a65Spooka# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18efd10a65Spooka# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19efd10a65Spooka# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20efd10a65Spooka# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21efd10a65Spooka# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22efd10a65Spooka# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23efd10a65Spooka# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24efd10a65Spooka# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25efd10a65Spooka# POSSIBILITY OF SUCH DAMAGE. 26efd10a65Spooka# 27efd10a65Spooka 28*a31f3228Schristosexport PATH=/bin:/usr/bin:/sbin:/usr/sbin 29*a31f3228Schristos 306dd7be55Spookaunpack_file() 31efd10a65Spooka{ 32efd10a65Spooka 336dd7be55Spooka atf_check -s exit:0 uudecode $(atf_get_srcdir)/${1}.bz2.uue 346dd7be55Spooka atf_check -s exit:0 bunzip2 -f ${1}.bz2 35efd10a65Spooka} 36efd10a65Spooka 37efd10a65Spookatest_case() 38efd10a65Spooka{ 39efd10a65Spooka local name="${1}"; shift 40efd10a65Spooka 41efd10a65Spooka atf_test_case "${name}" 42efd10a65Spooka eval "${name}_head() { }" 43efd10a65Spooka eval "${name}_body() { \ 446dd7be55Spooka unpack_file shmbus ; \ 45efd10a65Spooka ${name} ; \ 46efd10a65Spooka }" 47efd10a65Spooka} 48efd10a65Spooka 49efd10a65Spookatest_case header 50efd10a65Spookatest_case contents 51efd10a65Spookatest_case pcap 52efd10a65Spooka 536dd7be55Spookaehdr='bus version 2, lock: 0, generation: 22, firstoff: 0x9e414, lastoff: 0x9dfd0' 54efd10a65Spooka 55efd10a65Spookaheader() 56efd10a65Spooka{ 57efd10a65Spooka 58efd10a65Spooka atf_check -s exit:0 -o inline:"${ehdr}\n" shmif_dumpbus -h shmbus 59efd10a65Spooka} 60efd10a65Spooka 61efd10a65Spookacontents() 62efd10a65Spooka{ 63efd10a65Spooka 646dd7be55Spooka unpack_file d_pkthdrs.out 651217ea6fSpooka atf_check -s exit:0 -o file:d_pkthdrs.out \ 66efd10a65Spooka shmif_dumpbus shmbus 67efd10a65Spooka} 68efd10a65Spooka 69efd10a65Spookapcap() 70efd10a65Spooka{ 71efd10a65Spooka 726dd7be55Spooka unpack_file d_pcap.out 73efd10a65Spooka atf_check -s exit:0 -o ignore shmif_dumpbus -p pcap shmbus 7472c24adeSmartin# 7572c24adeSmartin# should not fail anymore... 7672c24adeSmartin# 773ff17a1bSchristos# Used to fail for "PR bin/44721" 781217ea6fSpooka atf_check -s exit:0 -o file:d_pcap.out -e ignore \ 79b29a640aSmartin tcpdump -tt -n -r pcap 80efd10a65Spooka} 81efd10a65Spooka 82efd10a65Spookaatf_init_test_cases() 83efd10a65Spooka{ 84efd10a65Spooka 85efd10a65Spooka atf_add_test_case header 86efd10a65Spooka atf_add_test_case contents 87efd10a65Spooka atf_add_test_case pcap 88efd10a65Spooka} 89