Adding test

/CoreOS/net-tools/Sanity/ifconfig-inaccurately-rounds-exabytes
This commit is contained in:
František Hrdina 2023-03-20 08:14:29 +01:00
commit ad70489f0b
4 changed files with 103 additions and 0 deletions

View file

@ -0,0 +1,6 @@
431640404764:401.9 GiB
1125899906842624:1024.0 TiB
1125899906842625:1.0 PiB
2154408931384050514:1.8 EiB
9223372036854775807:8.0 EiB
9999999999999999999999999999992154408931384050514:16.0 EiB

View file

@ -0,0 +1,3 @@
Inter-| Receive | Transmit
face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
lo: XXX 690 0 0 0 0 0 0 0 0 0 0 0 0 0 0

View file

@ -0,0 +1,28 @@
summary: Test for BZ#1177980 (ifconfig inaccurately rounds exabytes)
description: |
Bug summary: ifconfig inaccurately rounds exabytes
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1177980
enabled: true
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1177980
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1592732
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1414765
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1392910
tag:
- Tier1
tier: '1'
adjust:
- enabled: false
when: distro < rhel-6
continue: false
contact: fhrdina@redhat.com
component:
- net-tools
test: ./runtest.sh
framework: beakerlib
recommend:
- net-tools
duration: 20m
extra-nitrate: TC#0539000
extra-summary: /CoreOS/net-tools/Sanity/ifconfig-inaccurately-rounds-exabytes
extra-task: /CoreOS/net-tools/Sanity/ifconfig-inaccurately-rounds-exabytes

View file

@ -0,0 +1,66 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/net-tools/Sanity/ifconfig-inaccurately-rounds-exabytes
# Description: Test for BZ#1177980 (ifconfig inaccurately rounds exabytes)
# Author: Petr Sklenar <psklenar@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2016 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="net-tools"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
chrootd=`mktemp -d`
rlIsFedora && rlRun "dnf -y --installroot=$chrootd --releasever=`rlGetDistroRelease` install net-tools"
rlIsFedora && dnf -y --installroot=$chrootd --releasever=rawhide upgrade net-tools --nogpg
rlIsRHEL && rlRun "yum -y --installroot=$chrootd install net-tools --nogpgcheck"
rlRun "mkdir $chrootd/proc/net -p"
rlPhaseEnd
rlPhaseStartTest
old="$IFS"
#IFS = delimiter:
IFS='
'
for i in $(<data);do
echo ============
bytes=`echo $i | gawk -F: '{ print $1 }'`
iB=`echo $i | gawk -F: '{ print $2 }'`
sed s/XXX/$bytes/g dev > $chrootd/proc/net/dev
chroot $chrootd /bin/bash -c "ifconfig" | grep "$iB"
rlAssert0 "$iB" $?
chroot $chrootd /bin/bash -c "ifconfig"
echo ===========
done
IFS="$old"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "rm -r $chrootd"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd