Skip to content

Commit

Permalink
Create kyua atf tests to integrate with those in the base system
Browse files Browse the repository at this point in the history
  • Loading branch information
vangyzen committed Jun 13, 2019
1 parent f7a1844 commit c0066c2
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Makefile
@@ -0,0 +1,11 @@
# $FreeBSD$

TESTSDIR= ${LOCALBASE}/tests/tcptestsuite
ATF_TESTS_SH= tcptestsuite_atf_test

CLEANFILES+= tcptestsuite_atf_test.sh

tcptestsuite_atf_test.sh:
/bin/sh ${.CURDIR}/make_atf.sh >$@

.include <bsd.test.mk>
59 changes: 59 additions & 0 deletions make_atf.sh
@@ -0,0 +1,59 @@
#!/bin/sh
#
# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c) 2019 Dell Inc.
#
# Written by: Eric van Gyzen <vangyzen@FreeBSD.org>
#
# 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 AUTHOR 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 AUTHOR 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.

tcptestsuite_path=/usr/local/share/tcptestsuite
packetdrill_path=/usr/local/bin/packetdrill

find . -type f -and -name '*.pkt' | sort | \
sed -e 's,^\./\(.*\)\.pkt$,\1,' > all_tests

while read Torig; do
Tunder=$(basename $Torig | tr - _)
cat <<-EOF
atf_test_case $Tunder
${Tunder}_head() {
atf_set timeout 10
}
${Tunder}_body() {
atf_require_prog ${packetdrill_path}
atf_check -o ignore ${packetdrill_path} \
${tcptestsuite_path}/${Torig}.pkt
}
EOF
done < all_tests

echo 'atf_init_test_cases() {'
while read Torig; do
Tunder=$(basename $Torig | tr - _)
echo " atf_add_test_case ${Tunder}"
done < all_tests
echo '}'

rm all_tests

0 comments on commit c0066c2

Please sign in to comment.