Adding basic sanity-test
This commit is contained in:
parent
83a371026c
commit
18ee025598
2 changed files with 261 additions and 0 deletions
39
Sanity/sanity-test/main.fmf
Normal file
39
Sanity/sanity-test/main.fmf
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
summary: Basic sanity test
|
||||
description: |+
|
||||
The test runs basic tests whether net-tools package is sane. It needs dummy
|
||||
interface for most of the tests, also correctly set up /etc/services. Note
|
||||
that on some architectures not all tests have to succeed, at the time the
|
||||
only know problem is ARP on s390/s390x archs, where no ARP protocol is used.
|
||||
|
||||
contact: fhrdina@redhat.com
|
||||
component:
|
||||
- net-tools
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- net-tools
|
||||
duration: 10m
|
||||
enabled: true
|
||||
tag:
|
||||
- FedoraReady
|
||||
- TIP_fedora_pass
|
||||
- TIPfail_infra
|
||||
- TIPpass
|
||||
- Tier1
|
||||
tier: '1'
|
||||
link:
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=673533
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=522888
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=537322
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=705110
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=732984
|
||||
adjust:
|
||||
- enabled: false
|
||||
when: arch == ppc64, s390, s390x
|
||||
continue: false
|
||||
- enabled: false
|
||||
when: distro < rhel-6
|
||||
continue: false
|
||||
extra-nitrate: TC#0046199
|
||||
extra-summary: /CoreOS/net-tools/Sanity/sanity-test
|
||||
extra-task: /CoreOS/net-tools/Sanity/sanity-test
|
||||
222
Sanity/sanity-test/runtest.sh
Executable file
222
Sanity/sanity-test/runtest.sh
Executable file
|
|
@ -0,0 +1,222 @@
|
|||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /CoreOS/net-tools/sanity
|
||||
# Author: Jan Scotka <jscotka@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2011 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# 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, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Include rhts environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
PACKAGE="net-tools"
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartTest
|
||||
rlLog "package version: $PACKAGE"
|
||||
rlRun "modprobe dummy"
|
||||
|
||||
if ! rlIsRHEL '<=7'; then
|
||||
rlRun "ip link add dummy0 type dummy" 0 "Add dummy inteface via ip command"
|
||||
fi
|
||||
#ifconfig part
|
||||
rlRun "ifconfig dummy0 up" 0
|
||||
rlRun "ifconfig | grep dummy0" 0
|
||||
rlRun "ifconfig dummy0 down" 0
|
||||
|
||||
rlRun "ifconfig | grep dummy0" 1
|
||||
|
||||
rlRun "ifconfig dummy0 up 10.10.10.10 netmask 255.255.255.248" 0
|
||||
rlRun "ifconfig dummy0 | grep 10.10.10.10" 0
|
||||
rlRun "ifconfig dummy0 | grep 255.255.255.248" 0
|
||||
rlRun "ifconfig dummy0 10.10.10.11" 0
|
||||
rlRun "ifconfig dummy0 | grep 10.10.10.11" 0
|
||||
rlRun "ifconfig dummy0 | grep 255.0.0.0" 0
|
||||
rlRun "ifconfig dummy0 netmask 255.255.255.248" 0
|
||||
rlRun "ifconfig dummy0 | grep 10.10.10.11" 0
|
||||
rlRun "ifconfig dummy0 | grep 255.255.255.248" 0
|
||||
rlRun "ifconfig dummy0 down" 0
|
||||
rlRun "ifconfig | grep dummy0" 1
|
||||
|
||||
rlRun "ifconfig dummy0 up" 0
|
||||
rlRun "ifconfig | grep -v dummy0" 0
|
||||
rlRun "ifconfig dummy0 | grep 10.10.10.11" 0
|
||||
rlRun "ifconfig dummy0 | grep 255.255.255.248" 0
|
||||
rlRun "ifconfig dummy0 broadcast 10.10.10.255" 0
|
||||
|
||||
rlRun "ifconfig dummy0 | grep 10.10.10.255" 0
|
||||
rlRun "ifconfig dummy0 172.16.0.0" 0
|
||||
|
||||
rlRun "ifconfig dummy0 | grep 255.255.0.0" 0
|
||||
rlRun "ifconfig dummy0 192.168.0.0" 0
|
||||
rlRun "ifconfig dummy0 | grep 255.255.255.0" 0
|
||||
rlRun "ifconfig dummy0 192.168.0.256" 1
|
||||
|
||||
|
||||
rlRun "ifconfig dummy0 0x0A.0x0A.0x0A.0x0A netmask 0xFF.0xFF.0xFF.0x00" 0
|
||||
rlRun "ifconfig dummy0 up 10.10.10.10 netmask 255.255.252.255" 1
|
||||
rlRun "ifconfig dummy0 up 10.10.10.10 netmask 255.255.255.253" 1
|
||||
rlRun "ifconfig dummy0 down" 0
|
||||
rlRun "ifconfig dummy0 hw ether 3E:7A:59:CD:B8:BB" 0
|
||||
rlRun "ifconfig dummy0 | grep -i 3E:7A:59:CD:B8:BB" 0
|
||||
rlRun "ifconfig dummy0 hw ether 3E:7A:59:CD:B8:0B" 0
|
||||
rlRun "ifconfig dummy0 | grep -i 3E:7A:59:CD:B8:0B" 0
|
||||
rlRun "ifconfig dummy0 up" 0
|
||||
|
||||
|
||||
#ipv6 ifconfig stuff
|
||||
if rlIsRHEL 4 5 6; then
|
||||
STRING="ifconfig deletes all ipv6 addresses:"
|
||||
J=0
|
||||
for i in `ifconfig dummy0 | sed -n '/inet6/s/^.*addr: \([^ ]*\).*/\1/p'`
|
||||
do ARRAY[$J]=$i
|
||||
J=$((J+1))
|
||||
done
|
||||
J=${#array[*]}
|
||||
RETVAL=0
|
||||
for i in `seq 0 $J`; do
|
||||
ifconfig dummy0 del ${ARRAY[$J]}
|
||||
rlAssert0 "" $?
|
||||
ifconfig dummy0 | grep ${ARRAY[$J]}
|
||||
# rlAssert0 "" $?
|
||||
done
|
||||
|
||||
STRING="ifconfig deletes adds ipv6 addresses back:"
|
||||
RETVAL=0
|
||||
for i in `seq 0 $J`; do
|
||||
ifconfig dummy0 add ${ARRAY[$J]}
|
||||
rlAssert0 "" $?
|
||||
ifconfig dummy0 | grep ${ARRAY[$J]}
|
||||
rlAssert0 "" $?
|
||||
done
|
||||
fi
|
||||
rlRun "ifconfig dummy0 down" 0
|
||||
rlRun "ifconfig dummy0 add fe80::0::fecd:b80b/64" 1
|
||||
|
||||
|
||||
# ROUTE STUFF
|
||||
|
||||
rlRun "ifconfig dummy0 up 1.1.1.1 netmask 255.255.255.0" 0
|
||||
rlRun "route add -net 1.1.1.0/24 dev dummy0" 0
|
||||
rlRun "route -v | grep 1.1.1.0" 0
|
||||
rlRun "ping -c 1 1.1.1.1"
|
||||
rlRun "route del -net 1.1.1.0/24" 0
|
||||
# there should not be deleted net in RHEL7?
|
||||
rlRun "route -v"
|
||||
|
||||
# NAMEIF STUFF
|
||||
STRING="nameif basic functionality:"
|
||||
if rlIsRHEL 4 5 6; then
|
||||
HWADDR=`ifconfig dummy0 | sed -n '/HWaddr/s/^.*HWaddr \([^ ]*\).*/\1/p'`
|
||||
else
|
||||
HWADDR=`ifconfig dummy0 | sed -n '/ether/s/^.*ether \([^ ]*\).*/\1/p'`
|
||||
fi
|
||||
rlRun "ifconfig dummy0 down" 0
|
||||
rlRun "nameif dumb $HWADDR" 0
|
||||
rlRun "ifconfig dumb up 10.10.10.15 netmask 255.255.255.0" 0
|
||||
rlRun "ifconfig dumb | grep 10.10.10.15" 0
|
||||
rlRun "ifconfig dumb down" 0
|
||||
rlRun "nameif dummy0 $HWADDR" 0
|
||||
rlRun "ifconfig -a | grep -v dumb"
|
||||
|
||||
# NETSTAT STUFF
|
||||
STRING="netstat route functionality:"
|
||||
J=0
|
||||
for i in `route -v`; do
|
||||
ROUTE[$J]="$i"
|
||||
J=$((J+1))
|
||||
done
|
||||
K=0
|
||||
for i in `netstat -r`; do
|
||||
NETSTAT[$K]="$i"
|
||||
K=$((K+1))
|
||||
done
|
||||
|
||||
rlRun "test $J -ne $K" 1
|
||||
for i in `seq $J`; do
|
||||
rlRun "test $ROUTE[$i] != $ROUTE[$i] " 1
|
||||
done
|
||||
|
||||
|
||||
STRING="netstat shows ports with names and with port number:"
|
||||
rlRun 'netstat --numeric-ports -ta | grep ":22 "'
|
||||
rlRun 'netstat -ta | grep ":ssh "'
|
||||
rlRun 'netstat -tpa | grep ":ssh " | grep "/ssh"'
|
||||
|
||||
|
||||
STRING="netstat shows correctly interface table -i option:"
|
||||
rlRun "ifconfig dummy0 down"
|
||||
rlRun "netstat -i | grep dummy0" 1
|
||||
rlRun "ifconfig dummy0 up"
|
||||
rlRun "netstat -i | grep dummy0"
|
||||
rlRun "netstat -i | grep lo"
|
||||
|
||||
STRING="netstat shows correctly interface table --interfaces option:"
|
||||
rlRun "ifconfig dummy0 down"
|
||||
rlRun "netstat -i | grep dummy0" 1
|
||||
rlRun "ifconfig dummy0 up"
|
||||
rlRun "netstat --interfaces | grep dummy0"
|
||||
rlRun "netstat --interfaces | grep lo"
|
||||
|
||||
|
||||
STRING="netstat shows correctly interface table -I option:"
|
||||
rlRun "ifconfig dummy0 down"
|
||||
rlRun "netstat -i | grep dummy0" 1
|
||||
rlRun "ifconfig dummy0 up"
|
||||
rlRun "netstat -I | grep dummy0"
|
||||
rlRun "netstat -I | grep lo"
|
||||
|
||||
STRING="netstat shows correctly interface table -I=<ifname> option:"
|
||||
rlRun "ifconfig dummy0 down"
|
||||
rlRun "netstat -i | grep dummy0" 1
|
||||
rlRun "ifconfig dummy0 up"
|
||||
rlRun "netstat -I=dummy0 | grep dummy0"
|
||||
rlRun "netstat -I=dummy0 | grep lo" 1
|
||||
|
||||
STRING="netstat shows correctly interface table -I<ifname> option:"
|
||||
rlRun "ifconfig dummy0 down"
|
||||
rlRun "netstat -i | grep dummy0" 1
|
||||
rlRun "ifconfig dummy0 up"
|
||||
rlRun "netstat -Idummy0 | grep dummy0"
|
||||
rlRun "netstat -Idummy0 | grep -v lo"
|
||||
|
||||
|
||||
# ARP STUFF - non s390/s390x archs only
|
||||
uname -p | grep -v s390 >/dev/null
|
||||
if [ $? -gt 0 ]; then
|
||||
STRING="arp - test if amout of the entries changes after broadcast ping - may fail:"
|
||||
BEFORE=`arp | wc -l`
|
||||
BCASTADDR=`ifconfig eth0 | sed -n '/Bcast/s/^.*Bcast:\([^ ]*\).*/\1/p'`
|
||||
rlRun "ping -c 3 -b $BCASTADDR" 0
|
||||
AFTER=`arp | wc -l`
|
||||
rlRun "test $BEFORE -ne $AFTER" 0
|
||||
fi
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "ip l set down dev dummy0" 0 "downing dummy0"
|
||||
rlRun "rmmod dummy" 0 "removing dummy kernel module"
|
||||
ip a s dev dummy0 2>/dev/null && rlRun "ip link del dummy0 type dummy"
|
||||
ip a s dev dumb 2>/dev/null && rlRun "ip link del dumb type dummy"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
||||
Loading…
Add table
Add a link
Reference in a new issue