devel/debug: will not be needing this then

Still provide scapy and jq for test coverage reasons.  For reference:

  1. Single test via:

    # kyua debug -k /usr/tests/sys/netpfil/pf/Kyuafile killstate:match

  2. Running test suite via:

    # kyua test -k /usr/tests/sys/netpfil/pf/Kyuafile
This commit is contained in:
Franco Fichtner 2024-11-18 17:14:04 +01:00
parent 46ef70f242
commit 598cf8ccd3
2 changed files with 1 additions and 149 deletions

View file

@ -6,7 +6,7 @@ PLUGIN_DEPENDS= php${PLUGIN_PHP}-pear-PHP_CodeSniffer \
phpunit9-php${PLUGIN_PHP} \
py${PLUGIN_PYTHON}-pycodestyle \
py${PLUGIN_PYTHON}-scapy \
p5-File-Slurp atf git jq
p5-File-Slurp git jq
PLUGIN_MAINTAINER= franco@opnsense.org
PLUGIN_TIER= 2

View file

@ -1,148 +0,0 @@
#!/bin/sh
# Copyright (c) 2014-2024 Franco Fichtner <franco@opnsense.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 ``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 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.
ATFCMD=/usr/local/bin/atf-sh
TESTDIR=/usr/src/tests/sys/netpfil/pf
__RUNNING_INSIDE_ATF_RUN=internal-yes-value
export __RUNNING_INSIDE_ATF_RUN
if [ "$(id -u)" != "0" ]; then
echo "Must be root." >&2
exit 1
fi
DO_ALL=
DO_DEBUG=
DO_LIST=
while getopts adlV OPT; do
case ${OPT} in
a)
DO_ALL="-a"
;;
d)
DO_DEBUG="-d"
;;
l)
DO_LIST="-l"
;;
V)
DO_VERBOSE="-V"
;;
*)
echo "Usage: man ${0##*/}" >&2
exit 1
;;
esac
done
shift $((OPTIND - 1))
if [ -n "${DO_VERBOSE}" ]; then
set -x
fi
list()
{
for TESTFILE in $(find -s ${TESTDIR} -name "*.sh"); do
TESTFILE=$(basename ${TESTFILE})
echo ${TESTFILE%.sh}
done
}
run()
{
TESTFILE=${1%%:*}
TESTCASE=${1#*:}
TEST=${TESTDIR}/${TESTFILE}.sh
if [ "${TESTCASE}" = "${1}" ]; then
TESTCASE=
fi
if [ ! -f "${TEST}" ]; then
echo "Unsupported test case: ${TESTFILE}" >&2
exit 1
fi
grep ^atf_test_case ${TEST} | tr -d '"' | awk '{ print $2 " " $3}' | while read CASE CLEANUP; do
if [ -n "${TESTCASE}" -a "${TESTCASE}" != "${CASE}" ]; then
continue
fi
echo -n ">>> $(basename ${TESTDIR})(${TESTFILE}:${CASE}): "
if [ -n "${CLEANUP}" ]; then
${ATFCMD} ${TEST} ${CASE}:cleanup > /dev/null 2>&1
fi
RESULT=$(${ATFCMD} ${TEST} ${CASE} 2>&1)
if [ -n "${CLEANUP}" ]; then
${ATFCMD} ${TEST} ${CASE}:cleanup > /dev/null 2>&1
fi
echo "${RESULT}" | grep -e ^passed -e ^skipped -e ^failed
if [ -n "${DO_DEBUG}" ]; then
echo "${RESULT}"
fi
done
}
if [ ! -d "${TESTDIR}" ]; then
echo "Test directory not found: ${TESTDIR}" >&2
exit 1
fi
if [ -n "${DO_LIST}" ]; then
list
exit 0
fi
TESTS=${@}
if [ -n "${DO_ALL}" ]; then
TESTS=$(list)
fi
# We could consider copying the whole test setup
# somewhere else but the whole thing needs to be
# redesigned anyway. Fudge this locally.
chmod 555 ${TESTDIR}/../common/*.sh ${TESTDIR}/../common/*.py ${TESTDIR}/*.py
for TEST in ${TESTS}; do
run ${TEST}
done
if [ -z "${TESTS}" ]; then
echo "Nothing to do."
fi
chmod 644 ${TESTDIR}/../common/*.sh ${TESTDIR}/../common/*.py ${TESTDIR}/*.py
# other leftovers
rm -f created_interfaces.lst created_jails.lst