iperf3/Regression/docs/runtest.sh
František Hrdina 6ef98bf621 Fixing docs tests
/Regression/docs
the char for minus is different on some distros
2023-08-30 15:32:02 +02:00

93 lines
3.8 KiB
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/iperf3/Regression/docs
# Description: TC testing all docs/man regressions
# Author: Patrik Mosko <pmosko@pmosko>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2020 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="iperf3"
PKG_VER="$(rpm -q --qf %{V} iperf3)"
PKG_REL="$(rpm -q --qf %{R} iperf3)"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
# Testing documentation, this is the same for both x86 and i686 versions
PACVER=$(rpm -q iperf3 | head -n 1)
rlRun "_HELP=\$(mktemp -t $PACVER.help-XXX)"
rlRun "_MAN=\$(mktemp -t $PACVER.manpage-XXX)"
rlRun "_VER=\$(mktemp -t $PACVER.version-XXX)"
rlRun "man -P cat iperf3 &>$_MAN"
rlRun "iperf3 --help &>$_HELP" 0,1
rlRun "iperf3 --version &>$_VER"
rlPhaseEnd
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ BZ#1656429
rlPhaseStartTest "BZ#1656429: option --udp-counters-64bit shown in --help output but not in man page"
# Minus char in man pages were changed from 'HYPHEN-MINUS' (U+002D) to 'HYPHEN' (U+2010)
if [[ "$PKG_VER" > "3.4" && "$PKG_REL" > "4.el8" ]] || rlIsFedora; then
rlAssertGrep "udpcounters64bit|--udp-counters-64bit" $_MAN -E
fi
rlAssertGrep "$udpcounters64bit|--udp-counters-64bit" $_HELP -E
rlPhaseEnd
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ BZ#1647413
if ! rlIsRHEL 7; then #rhel-7 is not compiled with sctp support
rlPhaseStartTest "BZ#1647413: --sctp option is directly bonded"
if ! grep -iq 'SCTP' "$_VER"; then
rlLogInfo "This release of iperf3 isn't compiled with sctp support!"
# Minus char in man pages were changed from 'HYPHEN-MINUS' (U+002D) to 'HYPHEN' (U+2010)
for __f in $_HELP $_MAN; do
rlAssertNotGrep "sctp" $__f
rlAssertNotGrep "xbind" $__f
rlAssertNotGrep "nstreams" $__f
rlAssertNotGrep "--sctp" $__f
rlAssertNotGrep "--xbind" $__f
rlAssertNotGrep "--nstreams" $__f
done
else
rlLogInfo "This release of iperf3 is compiled with sctp support!"
# Minus char in man pages were changed from 'HYPHEN-MINUS' (U+002D) to 'HYPHEN' (U+2010)
for __f in $_HELP $_MAN; do
rlAssertGrep "sctp|--sctp" $__f -E
rlAssertGrep "xbind|--xbind" $__f -E
rlAssertGrep "nstreams|--nstreams" $__f -E
done
fi
rlPhaseEnd
fi
## Add next documentation Bug in another test phase
#rlPhaseStartTest "BZ#XXXXXXX"
#rlPhaseEnd
rlPhaseStartCleanup
rlRun "rm -f $_HELP $_MAN $_VER"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd