diff --git a/devel/debug/Makefile b/devel/debug/Makefile index 9cb0a3c89f..ecd817af99 100644 --- a/devel/debug/Makefile +++ b/devel/debug/Makefile @@ -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 diff --git a/devel/debug/src/sbin/opnsense-atf b/devel/debug/src/sbin/opnsense-atf deleted file mode 100755 index c647f3ee5e..0000000000 --- a/devel/debug/src/sbin/opnsense-atf +++ /dev/null @@ -1,148 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2014-2024 Franco Fichtner -# -# 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