1299529Smm# 2299529Smm# Copyright 2015 EMC Corp. 3299529Smm# All rights reserved. 4299529Smm# 5299529Smm# Redistribution and use in source and binary forms, with or without 6299529Smm# modification, are permitted provided that the following conditions are 7299529Smm# met: 8299529Smm# 9299529Smm# * Redistributions of source code must retain the above copyright 10299529Smm# notice, this list of conditions and the following disclaimer. 11299529Smm# * Redistributions in binary form must reproduce the above copyright 12299529Smm# notice, this list of conditions and the following disclaimer in the 13299529Smm# documentation and/or other materials provided with the distribution. 14299529Smm# 15299529Smm# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16299529Smm# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17299529Smm# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18299529Smm# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19299529Smm# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20299529Smm# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21299529Smm# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22299529Smm# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23299529Smm# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24299529Smm# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25299529Smm# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26299529Smm# 27299529Smm# $FreeBSD$ 28299529Smm 29299529SmmSRCDIR=$(atf_get_srcdir) 30299529SmmTESTER="${SRCDIR}/bsdcat_test" 31299529Smmexport BSDCAT=$(which bsdcat) 32299529Smm 33299529Smmcheck() 34299529Smm{ 35299529Smm local testcase=${1}; shift 36299529Smm 37299529Smm # For some odd reason /bin/sh spuriously writes 38299529Smm # "write error on stdout" with some of the testcases 39299529Smm # 40299529Smm # Probably an issue with how they're written as it calls system(3) to 41299529Smm # clean up directories.. 42299529Smm atf_check -e ignore -o ignore -s exit:0 ${TESTER} -d -r "${SRCDIR}" -v "${testcase}" 43299529Smm} 44299529Smm 45299529Smmatf_init_test_cases() 46299529Smm{ 47299529Smm # Redirect stderr to stdout for the usage message because if you don't 48299529Smm # kyua list/kyua test will break: 49299529Smm # https://github.com/jmmv/kyua/issues/149 50299529Smm testcases=$(${TESTER} -h 2>&1 | awk 'p != 0 && $1 ~ /^[0-9]+:/ { print $NF } /Available tests:/ { p=1 }') 51299529Smm for testcase in ${testcases}; do 52299529Smm atf_test_case ${testcase} 53299529Smm eval "${testcase}_body() { check ${testcase}; }" 54299529Smm atf_add_test_case ${testcase} 55299529Smm done 56299529Smm} 57