#7 Adding tests
Merged a year ago by fhrdina. Opened a year ago by fhrdina.
tests/ fhrdina/net-tools adding-tests  into  main

@@ -0,0 +1,27 @@ 

+ summary: Command "netstat -A inet" should not abnormally terminate if sctp module

+     has not been added to kernel.

+ description: |

+     Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1063906

+ contact: fhrdina@redhat.com

+ component:

+   - net-tools

+ test: ./runtest.sh

+ framework: beakerlib

+ recommend:

+   - net-tools

+   - kmod

+ duration: 5m

+ enabled: true

+ tag:

+   - Tier2

+ tier: '2'

+ link:

+   - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1063906

+ adjust:

+   - enabled: false

+     when: distro < rhel-6

+     continue: false

+ extra-nitrate: TC#0340654

+ extra-summary: /CoreOS/net-tools/Regression/bz1063906-netstat-abort-with-A-inet

+ extra-task: /CoreOS/net-tools/Regression/bz1063906-netstat-abort-with-A-inet

+ id: b1938694-a230-457d-b6e1-2359aeca08ed

@@ -0,0 +1,65 @@ 

+ #!/bin/bash

+ # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   runtest.sh of /CoreOS/net-tools/Regression/bz1063906-netstat-abort-with-A-inet

+ #   Description: Command "netstat -A inet" should not abnormally terminate if sctp module has not been added to kernel.

+ #   Author: Leos Pol <lpol@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Copyright (c) 2014 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"

+ INIT_REBOOTS="/var/tmp/local_reboots_count"

+ if [ ! -f $INIT_REBOOTS ]; then

+     touch $INIT_REBOOTS

+     echo "${REBOOTCOUNT:=0}" > $INIT_REBOOTS

+ fi

+ 

+ rlJournalStart

+     if [ $REBOOTCOUNT -eq $(cat $INIT_REBOOTS) ]; then

+         rlPhaseStartSetup

+             rlAssertRpm $PACKAGE

+             (rlIsRHEL '>=7' || rlIsCentOS '>=7' || rlIsFedora) && rlAssertRpm kmod

+         rlPhaseEnd

+ 

+         rlPhaseStartTest

+             rlLog "First reboot - necessary for making sure SCTP module isn't loaded (rhel7, rhel8, ...)"

+             rlLog "rebooting ..."

+         rlPhaseEnd

+ 

+         rhts-reboot

+     elif [ $REBOOTCOUNT -gt $(cat $INIT_REBOOTS) ]; then

+         rlPhaseStartTest

+             # this should be loaded for the fisrt time, sctp shouldn't be there by default (rhel7, rhel8, ...)

+             rlRun "lsmod|grep ^sctp" 1

+             rlRun "netstat -an -A inet"  0 "netstat works without sctp loaded"

+             rlRun "netstat -an -A inet6" 0 "netstat (inet6) works without sctp loaded"

+         rlPhaseEnd

+ 

+         rlPhaseStartCleanup "after reboot, clean up only"

+             rlRun "rm -f $ISREBOOTED"

+         rlPhaseEnd

+     fi

+ 

+ rlJournalPrintText

+ rlJournalEnd

@@ -0,0 +1,30 @@ 

+ summary: Test for BZ#1063913 (netstat doesn't list sctp servers in -A mode)

+ description: |

+     Bug summary: netstat doesn't list sctp servers in -A mode

+     Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1063913

+ contact: fhrdina@redhat.com

+ component:

+   - net-tools

+ test: ./runtest.sh

+ framework: beakerlib

+ recommend:

+   - net-tools

+   - lksctp-tools

+   - kernel-modules-extra

+ duration: 5m

+ enabled: true

+ tag:

+   - Tier2

+ tier: '2'

+ link:

+   - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1063913

+ adjust:

+   - enabled: false

+     when: distro < rhel-6

+     continue: false

+ extra-nitrate: TC#0547814

+ extra-summary: 

+     /CoreOS/net-tools/Regression/bz1063913-netstat-doesn-t-list-sctp-servers-in-A-mode

+ extra-task: 

+     /CoreOS/net-tools/Regression/bz1063913-netstat-doesn-t-list-sctp-servers-in-A-mode

+ id: 3fef603d-c90b-414a-a8ac-3f9c376647e0

@@ -0,0 +1,67 @@ 

+ #!/bin/bash

+ # vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   runtest.sh of /CoreOS/net-tools/Regression/bz1063913-netstat-doesn-t-list-sctp-servers-in-A-mode

+ #   Description: Test for BZ#1063913 (netstat doesn't list sctp servers in -A mode)

+ #   Author: Petr Sklenar <psklenar@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Copyright (c) 2017 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"

+ ISREBOOTED=/var/tmp/xasddsdfsddddasssa

+ 

+ rlJournalStart

+     rlPhaseStartSetup

+         rlAssertRpm $PACKAGE

+         echo "Reboot count: $REBOOTCOUNT"

+     rlPhaseEnd

+ 

+     if [ $REBOOTCOUNT -eq 0 ]  || ! [ -e $ISREBOOTED ];

+     then

+         rlPhaseStartTest

+             # this should be loaded for the fisrt time, sctp shouldn't be there by default

+             rlRun "modprobe sctp --first-time"

+             sctp_darn -H 0 -P 2500 -l & APP_PID=$!

+             rlAssert0 "sctp_darn ..." $?

+             sleep 1

+             rlRun "netstat -nl | grep 2500"

+             rlRun "netstat -nl -A inet,inet6 | grep 2500"

+             rlRun "touch $ISREBOOTED"

+         rlPhaseEnd

+         rhts-reboot

+     else

+ 

+         rlPhaseStartTest

+             rlLog "after reboot, clean up only"

+         rlPhaseEnd

+ 

+         rlPhaseStartCleanup

+             rlRun "/bin/rm -f $ISREBOOTED"

+             #rhel7 kernel defaults are without this module, remove following check if its trouble:

+             rlRun "lsmod|grep ^sctp" 1

+         rlPhaseEnd

+     fi

+ 

+ rlJournalPrintText

+ rlJournalEnd

@@ -0,0 +1,28 @@ 

+ summary: Test for BZ#1257549 (Netstat tool does not throw correct exit code on)

+ description: |

+     Bug summary: Netstat tool does not throw correct exit code on wrong parameter

+     Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1257549

+ contact: fhrdina@redhat.com

+ component:

+   - net-tools

+ test: ./runtest.sh

+ framework: beakerlib

+ recommend:

+   - net-tools

+ duration: 5m

+ enabled: true

+ tag:

+   - Tier1

+ tier: '1'

+ link:

+   - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1257549

+ adjust:

+   - enabled: false

+     when: distro < rhel-6

+     continue: false

+ extra-nitrate: TC#0547812

+ extra-summary: 

+     /CoreOS/net-tools/Regression/bz1257549-Netstat-tool-does-not-throw-correct-exit-code-on

+ extra-task: 

+     /CoreOS/net-tools/Regression/bz1257549-Netstat-tool-does-not-throw-correct-exit-code-on

+ id: 3bf9f1dd-7e1d-499e-ada0-43307a42698b

@@ -0,0 +1,43 @@ 

+ #!/bin/bash

+ # vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   runtest.sh of /CoreOS/net-tools/Regression/bz1257549-Netstat-tool-does-not-throw-correct-exit-code-on

+ #   Description: Test for BZ#1257549 (Netstat tool does not throw correct exit code on)

+ #   Author: Petr Sklenar <psklenar@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Copyright (c) 2017 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

+     rlPhaseEnd

+ 

+     rlPhaseStartTest "Error code shouldn't be ZERO"

+         rlRun "netstat --asd" '1-255'

+     rlPhaseEnd

+ 

+ rlJournalPrintText

+ rlJournalEnd

@@ -0,0 +1,26 @@ 

+ summary: Test for BZ#1427889 (exit code on wrong parameter is zero for many)

+ description: |

+     Bug summary: exit code on wrong parameter is zero for many net-tools binaries

+     Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1427889

+ contact: fhrdina@redhat.com

+ component:

+   - net-tools

+ test: ./runtest.sh

+ framework: beakerlib

+ recommend:

+   - net-tools

+ duration: 5m

+ enabled: true

+ link:

+   - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1427889

+   - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1670355

+ adjust:

+   - enabled: false

+     when: distro < rhel-7

+     continue: false

+ extra-nitrate: TC#0549774

+ extra-summary: 

+     /CoreOS/net-tools/Regression/bz1427889-exit-code-on-wrong-parameter-is-zero-for-many

+ extra-task: 

+     /CoreOS/net-tools/Regression/bz1427889-exit-code-on-wrong-parameter-is-zero-for-many

+ id: 7c4802eb-4c92-48c3-b149-b93fd361a5d5

@@ -0,0 +1,51 @@ 

+ #!/bin/bash

+ # vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   runtest.sh of /CoreOS/net-tools/Regression/bz1427889-exit-code-on-wrong-parameter-is-zero-for-many

+ #   Description: Test for BZ#1427889 (exit code on wrong parameter is zero for many)

+ #   Author: Petr Sklenar <psklenar@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Copyright (c) 2017 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

+     rlPhaseEnd

+ 

+     rlPhaseStartTest

+ 	log=$(mktemp)

+ 	for bin in $(rpm -ql net-tools | grep bin);do

+ 		for option in wrongoption --wrongoption;do

+ 			rlRun "timeout 10 $bin $option &> $log" '1-255'

+ 		done

+ 	done

+     rlPhaseEnd

+ 

+     rlPhaseStartCleanup

+         rlRun "rm -r $log"

+     rlPhaseEnd

+ rlJournalPrintText

+ rlJournalEnd

@@ -0,0 +1,31 @@ 

+ summary: Test for BZ#1538315 (netstat -agn only shows 10 character interface)

+ description: |

+     Bug summary: netstat -agn only shows 10 character interface name for IPv4 addressing

+     Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1538315

+     Test creates a new virtual interface with a 15 characters long name. 

+     Assigns an ipv4 address, runs netstat and checks for correct name. 

+ contact: fhrdina@redhat.com

+ component:

+   - net-tools

+ test: ./runtest.sh

+ framework: beakerlib

+ recommend:

+   - net-tools

+ duration: 5m

+ enabled: true

+ tag:

+   - Tier1

+ tier: '1'

+ link:

+   - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1538315

+   - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1584233

+ adjust:

+   - enabled: false

+     when: distro < rhel-7

+     continue: false

+ extra-nitrate: TC#0570169

+ extra-summary: 

+     /CoreOS/net-tools/Regression/bz1538315-netstat-agn-only-shows-10-character-interface

+ extra-task: 

+     /CoreOS/net-tools/Regression/bz1538315-netstat-agn-only-shows-10-character-interface

+ id: 1145cf51-5957-4dc5-b5bd-c857d86618d9

@@ -0,0 +1,57 @@ 

+ #!/bin/bash

+ # vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   runtest.sh of /CoreOS/net-tools/Regression/bz1538315-netstat-agn-only-shows-10-character-interface

+ #   Description: Test for BZ#1538315 (netstat -agn only shows 10 character interface)

+ #   Author: Ondrej Mejzlik <omejzlik@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Copyright (c) 2018 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"

+ IFACE="osmznaku9112345"

+ 

+ rlJournalStart

+     rlPhaseStartSetup

+         rlAssertRpm $PACKAGE

+         rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"

+         rlRun "pushd $TmpDir"

+     rlPhaseEnd

+ 

+     rlPhaseStartTest

+         # Create new network interface with a long name and assign ipv4 address

+         rlRun "ip tuntap add mode tap $IFACE" 0 "Creating network interface $IFACE"

+         rlRun "ifconfig $IFACE 192.168.15.15" 0 "Assigning 192.168.15.15 to $IFACE"

+         # Check that the correct name is displayed followed by an ipv4 address

+         rlRun "netstat -agn | grep -wE '$IFACE[[:space:]].*\b([0-9]{1,3}\.){3}[0-9]{1,3}\b'" 0 "Looking for correct name"

+         rlRun "netstat -agn | grep -w 'osmznaku91'" 1 "Incorrect name should not be found" 

+     rlPhaseEnd

+ 

+     rlPhaseStartCleanup

+         # Remove testing interface

+         rlRun "ip link delete $IFACE" 0 "Removing $IFACE"

+         rlRun "popd"

+         rlRun "rm -r $TmpDir" 0 "Removing tmp directory"

+     rlPhaseEnd

+ rlJournalPrintText

+ rlJournalEnd

@@ -0,0 +1,28 @@ 

+ summary: Test for BZ#1568306 (netstat -i only shows 8 characters of Iface name)

+ description: |

+     Bug summary: netstat -i only shows 8 characters of Iface name

+     Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1568306

+ contact: fhrdina@redhat.com

+ component:

+   - net-tools

+ test: ./runtest.sh

+ framework: beakerlib

+ recommend:

+   - net-tools

+ duration: 5m

+ enabled: true

+ tag:

+   - Tier1

+ tier: '1'

+ link:

+   - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1568306

+ adjust:

+   - enabled: false

+     when: distro < rhel-7

+     continue: false

+ extra-nitrate: TC#0570231

+ extra-summary: 

+     /CoreOS/net-tools/Regression/bz1568306-netstat-i-only-shows-8-characters-of-Iface-name

+ extra-task: 

+     /CoreOS/net-tools/Regression/bz1568306-netstat-i-only-shows-8-characters-of-Iface-name

+ id: 8ddff5e4-6c50-4b14-8988-9a473d93af82

@@ -0,0 +1,57 @@ 

+ #!/bin/bash

+ # vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   runtest.sh of /CoreOS/net-tools/Regression/bz1568306-netstat-i-only-shows-8-characters-of-Iface-name

+ #   Description: Test for BZ#1568306 (netstat -i only shows 8 characters of Iface name)

+ #   Author: Ondrej Mejzlik <omejzlik@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Copyright (c) 2018 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"

+ IFACE="osmznaku9112345"

+ 

+ rlJournalStart

+     rlPhaseStartSetup

+         rlAssertRpm $PACKAGE || rlDie "Package installation failed"

+         rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"

+         rlRun "pushd $TmpDir"

+     rlPhaseEnd

+ 

+     rlPhaseStartTest

+         # Create new network interface with a long name and assign ipv4 address

+         rlRun "ip tuntap add mode tap $IFACE" 0 "Creating network interface $IFACE"

+         rlRun "ifconfig $IFACE 192.168.15.15" 0 "Assigning 192.168.15.15 to $IFACE"

+         # Check the correct output of netstat -i

+         rlRun "netstat -i | grep -w $IFACE" 0 "Looking for correct name in netstat -i"

+         rlRun "netstat -i | grep -w osmznaku" 1 "Wrong name no longer present"

+     rlPhaseEnd

+ 

+     rlPhaseStartCleanup

+         # Remove testing interface

+         rlRun "ip link delete $IFACE" 0 "Removing $IFACE"

+         rlRun "popd"

+         rlRun "rm -r $TmpDir" 0 "Removing tmp directory"

+     rlPhaseEnd

+ rlJournalPrintText

+ rlJournalEnd

@@ -0,0 +1,35 @@ 

+ summary: Test for BZ#1632905 ([NOKIA] The output of `route -A inet6` does not)

+ description: |

+     Bug summary: [NOKIA] The output of `route -A inet6` does not display properly when the 'Use' column output is over 6 digits

+     Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1632905

+ contact: fhrdina@redhat.com

+ component:

+   - net-tools

+ test: ./runtest.sh

+ framework: beakerlib

+ recommend:

+   - net-tools

+   - rpm-build

+   - dnf-plugins-core

+   - yum-utils

+   - gcc

+ duration: 60m

+ enabled: true

+ tag:

+   - Tier1

+   - rhel8-buildroot

+   - rhel9-buildroot

+ tier: '1'

+ link:

+   - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1632905

+   - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1961792

+ adjust:

+   - enabled: false

+     when: distro < rhel-7

+     continue: false

+ extra-nitrate: TC#0602111

+ extra-summary: 

+     /CoreOS/net-tools/Regression/bz1632905-NOKIA-The-output-of-route-A-inet6-does-not

+ extra-task: 

+     /CoreOS/net-tools/Regression/bz1632905-NOKIA-The-output-of-route-A-inet6-does-not

+ id: b30adc3b-bbea-44b7-a0ce-edd56fc10a36

@@ -0,0 +1,123 @@ 

+ #!/bin/bash

+ # vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   runtest.sh of /CoreOS/net-tools/Regression/bz1632905-NOKIA-The-output-of-route-A-inet6-does-not

+ #   Description: Test for BZ#1632905 ([NOKIA] The output of `route -A inet6` does not)

+ #   Author: Patrik Mosko <pmosko@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Copyright (c) 2019 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"

+ : ${STATIC_CHECK:="NO"}

+ 

+ MAX_PING_TIMEOUT=2000  #kill after 2000 seconds and just hope route shows 6-digit number

+ PACKETS_CNT=100100

+ PING_DOMAIN="www.redhat.com"

+ 

+ # reconsider using `dig $HOSTNAME AAAA`; currently only A records exist for system hostnames

+ 

+ rlJournalStart

+     ########## SETUP PHASE ##########

+     rlPhaseStartSetup

+         rlAssertRpm $PACKAGE

+ 

+         # debug info: rhel-8 seems to have slihtly different output of `route`

+         rlIsRHEL && DEF_IFC=`ip -6 r s | grep default | cut -d " " -f 5 | head -1`

+         rlIsFedora && DEF_IFC=`ip -6 r s | grep nexthop | cut -d " " -f 5 | head -1`

+         ip -6 r s; echo "-----"

+         GLOBAL_IPv6=`ip -6 a l dev $DEF_IFC | grep scope\ global | sed 's/.* inet6 \s*\([^/]*\).*/\1/'`

+         ip -6 a l dev $DEF_IFC

+ 

+         if [ "$STATIC_CHECK" = "NO" ]; then

+             rlRun -l "ip a s" 0 "DEBUG: show all interfaces + IP addresses" 0-255

+             rlRun -l "sudo sysctl -a | grep disable_ipv6" 0 "DEBUG: check whether IPv6 is enabled on this system" 0-255

+             if [ ! -n "$GLOBAL_IPv6" ]; then

+                 GLOBAL_IPv6=`ip -6 a | grep 'inet6.*scope global' | grep -Ev 'inet6\s+f[cd]00' | sed 's/.* inet6 \s*\([^/]*\).*/\1/'`

+                 if [ ! -n "$GLOBAL_IPv6" ]; then

+                     rlLogInfo "No IPv6 found OR bad parsing of 'ip -6 a' present"

+                     rlLogInfo "Fallthrough to simple Static Check"

+                     STATIC_CHECK="YES"

+                 fi

+             fi

+         fi

+ 

+         # KERNEL version must be lower than 4.18, otherwise run static check on srpm

+         KERNEL_VER_X=`uname -r | cut -d'-' -f 1 | cut -d'.' -f 1`

+         KERNEL_VER_Y=`uname -r | cut -d'-' -f 1 | cut -d'.' -f 2`

+         rlLog "kernel: X - Y: ${KERNEL_VER_X} - ${KERNEL_VER_Y}"

+         if ([ ${KERNEL_VER_X} -eq 4 -a ${KERNEL_VER_Y} -ge 18 ]) || [ ${KERNEL_VER_X} -gt 4 ]; then

+             rlLogInfo "Your kernel version doesn't store info about \"Use counter\" in /proc/net/ipv6_route already"

+             rlLogInfo "This counter has hard-coded \"0\" value from kernel 4.18. Fallback to static check."

+             STATIC_CHECK="YES"

+         fi

+ 

+         rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"

+         rlRun "pushd $TmpDir"

+     rlPhaseEnd

+ 

+ 

+     if [ "$STATIC_CHECK" = "NO" ]; then

+         ##################### TEST PHASE ####################

+         rlPhaseStartTest "run 'route -n -A inet6' after ping harassing the routing table"

+             set -m

+             rlRun "route -n -A inet6"

+             rlRun "sudo timeout $MAX_PING_TIMEOUT ping6 -c $PACKETS_CNT -I $DEF_IFC -i 0.0001 $PING_DOMAIN 2>&1 >/dev/null" 0,1 \

+                   "send at least 100000 packets to get 6-digit \"Use\" count in route -6 output to reproduce the bug"

+             rlRun "route -n -A inet6"

+ 

+             # Check whether "Ref" column merged with "Use" (6 columns == presume they did)

+             ###rlRun "route -n -A inet6 | grep $GLOBAL_IPv6 | awk '{print NF}' > columns_cnt"

+             rlRun "route -n -A inet6 | awk 'NR > 2 {print NF}' > columns_cnt"

+             # lets assume every column will be filled (not great, not terrible)

+             for line in `cat columns_cnt`; do

+                 rlAssertGrep    7 <(echo $line)

+                 rlAssertNotGrep 6 <(echo $line)

+             done

+         rlPhaseEnd

+     else

+         ##################### TEST PHASE ####################

+         rlPhaseStartTest "Static check - look at specific printf function in lib/inet6_gr.c"

+             rlFetchSrcForInstalled $PACKAGE

+             if rlIsRHEL '<8'; then

+                 rlRun "yum-builddep -y *src.rpm"

+             else

+                 rlRun "dnf builddep -y *src.rpm"

+             fi

+             rlRun "rpm --define='_topdir $TmpDir' -Uvh *src.rpm"

+             rlRun "rpmbuild --define='_topdir $TmpDir' -bp SPECS/${PACKAGE}.spec"

+ 

+             TARGET_SOURCE=`find ./BUILD -name inet6_gr.c`

+             rlLog "Checking file '$TARGET_SOURCE'"

+             # this space should be here                     v

+             rlAssertGrep 'printf("%-30s %-26s %-4s %-3d %-1d %6d' $(echo $TARGET_SOURCE)

+         rlPhaseEnd

+     fi

+ 

+     ########## CLEANUP PHASE ##########

+     rlPhaseStartCleanup

+         rlRun "popd"

+         rlRun "rm -r $TmpDir" 0 "Removing tmp directory"

+     rlPhaseEnd

+ rlJournalPrintText

+ rlJournalEnd

@@ -0,0 +1,20 @@ 

+ summary: Test executes netstat with -i <iface> and checkes result.

+ description: ''

+ contact: fhrdina@redhat.com

+ component:

+   - net-tools

+ test: ./runtest.sh

+ framework: beakerlib

+ recommend:

+   - net-tools

+ duration: 5m

+ enabled: true

+ tag:

+   - Tier1

+ tier: '1'

+ link:

+   - relates: https://bugzilla.redhat.com/show_bug.cgi?id=177397

+ extra-nitrate: TC#0377377

+ extra-summary: /CoreOS/net-tools/Regression/bz177397-netstat-i-only-works-with-first-interface

+ extra-task: /CoreOS/net-tools/Regression/bz177397-netstat-i-only-works-with-first-interface

+ id: 1377ef7f-6f46-42ca-bb0f-c4ef331255e1

@@ -0,0 +1,48 @@ 

+ #!/bin/bash

+ # vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   runtest.sh of /CoreOS/net-tools/Regression/bz177397-netstat-i-only-works-with-first-interface

+ #   Description: Test executes netstat with -i <iface> and checkes result.

+ #   Author: Leos Pol <lpol@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Copyright (c) 2014 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

+         IFACES=`netstat -i | sed -n '/Iface/b;/Kernel/!s/^\([^ ]*\) .*/\1/p'`

+     rlPhaseEnd

+ 

+     rlPhaseStartTest

+         rlAssertGreater "Number of ifaces should be > 1" `echo $IFACES | wc -w` 1

+         for i in ${IFACES}; do

+             #s390x uses long interface names, thus it shorted to 8 characters by all 'ip tools'

+             rlRun "netstat -I$i | grep ^${i:0:8}"

+         done

+     rlPhaseEnd

+ 

+ rlJournalPrintText

+ rlJournalEnd

@@ -0,0 +1,29 @@ 

+ summary: This test checks netstat output while using interface parameter

+ description: ''

+ contact: fhrdina@redhat.com

+ component:

+   - net-tools

+ test: ./runtest.sh

+ framework: beakerlib

+ recommend:

+   - net-tools

+ duration: 5m

+ enabled: true

+ tag:

+   - TIPfail_infra

+   - TIPpass

+   - Tier1

+   - notier

+ tier: '1'

+ link:

+   - relates: https://bugzilla.redhat.com/show_bug.cgi?id=196655

+ adjust:

+   - enabled: false

+     when: arch != x86_64

+     continue: false

+ extra-nitrate: TC#0361592

+ extra-summary: 

+     /CoreOS/net-tools/Regression/bz196655-netstat-when-using-interface-the-counter-remains-unchanged

+ extra-task: 

+     /CoreOS/net-tools/Regression/bz196655-netstat-when-using-interface-the-counter-remains-unchanged

+ id: cf642cc8-ce44-4e17-a2bf-92e1cd124a15

@@ -0,0 +1,76 @@ 

+ #!/bin/bash

+ # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   runtest.sh of /CoreOS/net-tools/Regression/bz196655-netstat-when-using-interface-the-counter-remains-unchanged

+ #   Description: This test checks netstat output while using interface parameter

+ #   Author: Leos Pol <lpol@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Copyright (c) 2014 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"

+ SLEEPTIME=60

+ 

+ rlJournalStart

+     rlPhaseStartSetup

+         rlAssertRpm $PACKAGE

+         rlIsRHEL '<6'  && DEFAULT_IF=`route | grep default | awk '{print $8}' | head -1`

+         ( rlIsRHEL '>=6' || rlIsFedora || rlIsCentOS '>=6') && DEFAULT_IF=`ip r  | grep default | awk '{print $5}' | head -1`

+         rlLog "default interface: $DEFAULT_IF"

+     rlPhaseEnd

+ 

+     rlPhaseStartTest

+         rlLog "running: ping -c $SLEEPTIME www.redhat.com >/dev/null &"

+         ping -c $SLEEPTIME www.redhat.com >/dev/null &

+ 

+         #netstat uses only first 8 characters of interface name, s390x often uses longer, so cut it:

+         rlLog "running: netstat -I $DEFAULT_IF 1 | grep ${DEFAULT_IF:0:8} > netstat.log &"

+         netstat -I$DEFAULT_IF 1 | grep ${DEFAULT_IF:0:8} >netstat.log &

+         NETSTAT_PROC=$!

+ 

+         rlRun "sleep $SLEEPTIME"

+         rlWaitForCmd "kill -9 -- $NETSTAT_PROC" -p $NETSTAT_PROC -m 30 -r 1

+ 

+         # extract RX_OK and TX_OK columns from netstat's output

+         _RX_OK_COL='$3' _TX_OK_COL='$7'

+         rlIsRHEL 5 6 && { _RX_OK_COL='$4'; _TX_OK_COL='$8'; }

+         RXOK_FIRST=`head -1 netstat.log |           awk "{print $_RX_OK_COL}"`

+         RXOK_LAST=` tail -2 netstat.log | head -1 | awk "{print $_RX_OK_COL}"`

+         TXOK_FIRST=`head -1 netstat.log |           awk "{print $_TX_OK_COL}"`

+         TXOK_LAST=` tail -2 netstat.log | head -1 | awk "{print $_TX_OK_COL}"`

+ 

+ 

+         #debug

+         head -n100 netstat.log

+         echo ".......... WHY DO YOU READ IT?"

+         tail -n100 netstat.log

+ 

+         rlAssertGreater "RX counter check" $RXOK_LAST $RXOK_FIRST

+         rlAssertGreater "TX counter check" $TXOK_LAST $TXOK_FIRST

+     rlPhaseEnd

+ 

+     rlPhaseStartCleanup

+         rm -f netstat.log

+     rlPhaseEnd

+ rlJournalPrintText

+ rlJournalEnd

@@ -0,0 +1,20 @@ 

+ summary: Test add dummy interface and try to rename to long name

+ description: ''

+ contact: fhrdina@redhat.com

+ component:

+   - net-tools

+ test: ./runtest.sh

+ framework: beakerlib

+ recommend:

+   - net-tools

+ duration: 5m

+ enabled: true

+ tag:

+   - Tier1

+ tier: '1'

+ link:

+   - relates: https://bugzilla.redhat.com/show_bug.cgi?id=209120

+ extra-nitrate: TC#0362971

+ extra-summary: /CoreOS/net-tools/Regression/bz209120-nameif-crashes-due-to-buffer-owerflow

+ extra-task: /CoreOS/net-tools/Regression/bz209120-nameif-crashes-due-to-buffer-owerflow

+ id: cae66d45-82c4-4bc4-a1c2-129cbea9a753

@@ -0,0 +1,76 @@ 

+ #!/bin/bash

+ # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   runtest.sh of /CoreOS/net-tools/Regression/bz209120-nameif-crashes-due-to-buffer-owerflow

+ #   Description: Test add dummy interface and try to rename to long name

+ #   Author: Leos Pol <lpol@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Copyright (c) 2014 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

+         lsmod | grep "^dummy" >/dev/null 2>&1

+         if [ $? -gt 0 ]; then

+             if rlIsRHEL '<8'; then

+                 rlRun "modprobe dummy" 0 "Modprobing dummy"

+             else

+                 # should work also for older RHEL's, but branching anyway, JIC

+                 rlRun "ip link add dummy0 type dummy" 0 "Modprobing dummy"

+             fi

+         else

+             ifconfig | grep dummy0 >/dev/null 2>&1

+             if [ $? -eq 0 ]; then

+                 DUMMY_UP=1

+                 rlRun "ifconfig dummy0 down" 0 "ifdown existing dummy interface"

+             fi

+             DUMMY_LOADED=1

+         fi

+         if rlIsRHEL "<7"; then

+             HWADDR=`ifconfig dummy0 | sed -n '/HWaddr/s/^.*HWaddr \([^ ]*\).*/\1/p'`

+         else

+             HWADDR=`ifconfig dummy0 | sed -n '/ether/s/^.*ether \([^ ]*\).*/\1/p'`

+         fi

+     rlPhaseEnd

+ 

+     rlPhaseStartTest

+         rlRun "nameif dummy01234567890 $HWADDR" 1 "Rename to 16 char long iface"

+         rlRun "nameif dummy0123456789 $HWADDR" 0 "Rename to 15 char long iface"

+     rlPhaseEnd

+ 

+     rlPhaseStartCleanup

+         rlRun "nameif dummy0 $HWADDR" 0 "Rename back to dummy0"

+         if [ $DUMMY_LOADED ]; then

+             nameif dummy0 $HWADDR

+             if [ $DUMMY_UP ]; then

+                 rlRun "ifconfig dummy0 up" 0 "ifup dummy interface"

+             fi

+         else

+             rlRun "rmmod dummy" 0 "Removing mod dummy"

+         fi

+     rlPhaseEnd

+ rlJournalPrintText

+ rlJournalEnd

@@ -0,0 +1,21 @@ 

+ summary: Test for bz477876 ('ifconfig' shows unnecessary warning about ALLMULTI)

+ description: ''

+ contact: fhrdina@redhat.com

+ component:

+   - net-tools

+ test: ./runtest.sh

+ framework: beakerlib

+ recommend:

+   - net-tools

+   - gawk

+ duration: 10m

+ enabled: true

+ tag:

+   - Tier1

+ tier: '1'

+ link:

+   - relates: https://bugzilla.redhat.com/show_bug.cgi?id=477876

+ extra-nitrate: TC#0046198

+ extra-summary: /CoreOS/net-tools/Regression/bz477876-ifconfig-allmulti-warning

+ extra-task: /CoreOS/net-tools/Regression/bz477876-ifconfig-allmulti-warning

+ id: 409d4ea7-c940-498a-ac1e-1507411bc071

@@ -0,0 +1,80 @@ 

+ #!/bin/bash

+ # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   runtest.sh of /CoreOS/net-tools/Regression/bz477876-ifconfig-allmulti-warning

+ #   Description: Test for bz477876 ('ifconfig' shows unnecessary warning about ALLMULTI)

+ #   Author: Karel Volny <kvolny@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Copyright (c) 2009 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"

+ # once upon a time, each machine in RHTS had eth0

+ # later on, it was possible to undo the name change and use the kernel provided 'eth0' name

+ # since Lennart's fanboys got the power to decide about how the distro works, we have "predictable interface names" that are totally unpredictable

+ # so let's resort to some ugly hack - let's assume that every Beaker machine routes through wired ethernet by default

+ iface=`ip route show | grep default | awk '{print $5}' | head -1`

+ 

+ rlJournalStart

+     rlPhaseStartSetup

+         rlAssertRpm $PACKAGE

+         rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"

+         rlRun "pushd $TmpDir"

+         rlRun "ifconfig ${iface} > ${iface}.txt" 0 "Checking '${iface}' configuration"

+         # DEBUG

+             cat ${iface}.txt

+     rlPhaseEnd

+ 

+     rlPhaseStartTest

+ 	# note that the bug is in checking wrong flag, MULTICAST, instead of ALLMULTI

+ 	# so we must make sure MULTICAST is on (should be on by default, but ...)

+         rlRun "ifconfig ${iface} multicast" 0 "Turning on MULTICAST for ${iface}"

+         rlRun "ifconfig ${iface} | grep MULTICAST" 0 "Checking if MULTICAST is on on ${iface}"

+         rlRun "ifconfig ${iface} allmulti" 0 "Turning on ALLMULTI for ${iface}"

+         rlRun "ifconfig ${iface} | grep ALLMULTI" 0 "Checking if ALLMULTI is on on ${iface}"

+ 	# DEBUG

+             ifconfig ${iface}

+         rlRun "ifconfig ${iface} -allmulti &> output" 0 "Turning ALLMULTI off for ${iface}"

+ 	# DEBUG

+ 	    cat output

+         rlLog "The output should not contain 'Warning: Interface ${iface} still in ALLMULTI mode.'"

+ 	rlAssertNotGrep "Warning" output -i

+ 	rlAssertNotGrep "ALLMULTI" output

+     rlPhaseEnd

+ 

+     rlPhaseStartCleanup

+ 	# turn MULTICAST off, if it was off before the test

+         rlRun "if ! grep MULTICAST ${iface}.txt ; then ifconfig ${iface} -multicast ; fi" 0 "Restoring MULTICAST state"

+ 	# turn ALLMULTI on, if it was on before the test

+         rlRun "if grep ALLMULTI ${iface}.txt ; then ifconfig ${iface} allmulti ; fi" 0 "Restoring ALLMULTI state"

+         # DEBUG

+             echo "Original '${iface}' state:"

+             cat "${iface}.txt"

+             echo "Current '${iface}' state:"

+             ifconfig ${iface}

+         rlRun "popd"

+         rlRun "rm -r $TmpDir" 0 "Removing tmp directory"

+     rlPhaseEnd

+ rlJournalPrintText

+ rlJournalEnd

@@ -0,0 +1,23 @@ 

+ summary: Test for bz634539 (netstat -c has a memory leak)

+ description: ''

+ contact: Patrik Moško <pmosko@redhat.com>

+ component:

+   - net-tools

+ test: ./runtest.sh

+ framework: beakerlib

+ recommend:

+   - net-tools

+   - valgrind

+ duration: 5m

+ enabled: false

+ tag:

+   - Tier3

+ tier: '3'

+ link:

+   - relates: https://bugzilla.redhat.com/show_bug.cgi?id=634539

+   - relates: https://bugzilla.redhat.com/show_bug.cgi?id=750272

+   - relates: https://bugzilla.redhat.com/show_bug.cgi?id=81467

+ extra-nitrate: TC#0081467

+ extra-summary: /CoreOS/net-tools/Regression/bz634539-netstat-c-has-a-memory-leak

+ extra-task: /CoreOS/net-tools/Regression/bz634539-netstat-c-has-a-memory-leak

+ id: 0bd15876-09c6-4614-893b-7c80907571eb

@@ -0,0 +1,61 @@ 

+ #!/bin/bash

+ # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   runtest.sh of /CoreOS/net-tools/Regression/bz634539-netstat-c-has-a-memory-leak

+ #   Description: Test for bz634539 (netstat -c has a memory leak)

+ #   Author: Alex Sersen <asersen@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"

+ ARCH=`uname -p`

+ 

+ rlJournalStart

+     rlPhaseStartSetup

+         rlAssertRpm $PACKAGE

+         rlAssertRpm valgrind

+         rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"

+         rlRun "pushd $TmpDir"

+     rlPhaseEnd

+ 

+     rlPhaseStartTest

+ 	rlRun "valgrind -v --leak-check=full --show-reachable=yes &>log netstat -c &" 0 "Logging valgrind.."

+ 	rlRun "sleep 5 && kill -15 `pidof valgrind`" 0 "Killing valgrind.."

+ 	rlRun "sleep 1"

+ 	cat ./log

+ 	if [ $ARCH = "x86_64" -o $ARCH = "ppc64" -o $ARCH = "s390x" ]; then

+ 		rlAssertGrep "definitely lost: 1,224 bytes in 51 blocks" "./log"

+ 	else

+                 rlAssertGrep "definitely lost: 612 bytes in 51 blocks" "./log"

+                 rlAssertGrep "ERROR SUMMARY: 1 errors from 1 contexts" "./log"

+ 	fi

+     rlPhaseEnd

+ 

+     rlPhaseStartCleanup

+         rlRun "popd"

+         rlRun "rm -r $TmpDir" 0 "Removing tmp directory"

+     rlPhaseEnd

+ rlJournalPrintText

+ rlJournalEnd

@@ -0,0 +1,30 @@ 

+ summary: Test for bz732983 (netstat truncates IPV6 UDP sockets even with)

+ description: |

+     Bug summary: netstat truncates IPV6 UDP sockets even with --notrim specifed

+     Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=732983

+ contact: fhrdina@redhat.com

+ component:

+   - net-tools

+ test: ./runtest.sh

+ framework: beakerlib

+ recommend:

+   - net-tools

+   - iproute

+   - nc

+   - nmap-ncat

+   - psmisc

+ duration: 10m

+ enabled: true

+ tag:

+   - Tier1

+ tier: '1'

+ link:

+   - relates: https://bugzilla.redhat.com/show_bug.cgi?id=732983

+ adjust:

+   - enabled: false

+     when: arch == s390x

+     continue: false

+ extra-nitrate: TC#0128718

+ extra-summary: /CoreOS/net-tools/Regression/notrim-not-working-for-udp

+ extra-task: /CoreOS/net-tools/Regression/notrim-not-working-for-udp

+ id: cf983c6d-55dc-4406-b554-842c77fe4205

@@ -0,0 +1,73 @@ 

+ #!/bin/bash

+ # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   runtest.sh of /CoreOS/net-tools/Regression/notrim-not-working-for-udp

+ #   Description: Test for bz732983 (netstat truncates IPV6 UDP sockets even with)

+ #   Author: Ales Zelinka <azelinka@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 Beaker environment

+ . /usr/share/beakerlib/beakerlib.sh || exit 1

+ 

+ PACKAGE="net-tools"

+ 

+ rlJournalStart

+ rlPhaseStartSetup

+     rlAssertRpm $PACKAGE

+     rlAssertRpm iproute 

+     if rlIsRHEL '<7'; then

+         rlAssertRpm nc

+     else

+         rlAssertRpm nmap-ncat

+     fi

+     DEFAULT_IFACE=`ip r |grep default |cut -d " " -f 5`

+     rlLog "default route interface: $DEFAULT_IFACE"

+     rlRun "ip a a 1234:1234:1234:1234:1234:124:1234:1234/128 dev $DEFAULT_IFACE" 0 "add new ipv6 addr to $DEFAULT_IFACE"

+     sleep 5

+ 

+     rlLog "starting listening on both tcp and udp on the new address"

+     nc -l6 1234:1234:1234:1234:1234:124:1234:1234 1111 &

+     nc -l6u 1234:1234:1234:1234:1234:124:1234:1234 1111 &

+ 

+     #debug

+     rlRun "ip a s"

+     rlRun "ss -tulen"

+ rlPhaseEnd

+ 

+ rlPhaseStartTest

+     if rlIsRHEL '<7'; then

+        NOTRIM="T";

+     else

+        NOTRIM="W";

+     fi

+     netstat -A inet6 -an${NOTRIM}

+     rlRun "netstat -A inet6 -an${NOTRIM}|grep '^tcp.*1234:1234:1234:1234:1234:124:1234:1234:1111'" 0 "tcp line untrimmed"

+     rlRun "netstat -A inet6 -an${NOTRIM}|grep '^udp.*1234:1234:1234:1234:1234:124:1234:1234:1111'" 0 "udp line untrimmed"

+ rlPhaseEnd

+ 

+ rlPhaseStartCleanup

+     rlRun "killall nc" 0 " killing all our listening nc's (and maybe few other as well)"

+     rlRun "ip a d 1234:1234:1234:1234:1234:124:1234:1234/128 dev $DEFAULT_IFACE" 0 "removing ipv6 addr from $DEFAULT_IFACE"

+ rlPhaseEnd

+ rlJournalPrintText

+ rlJournalEnd

@@ -0,0 +1,25 @@ 

+ summary: Test for bz668047 (/proc/net/ipv6_route broken, causes netstat to)

+ description: |

+     Bug summary: /proc/net/ipv6_route broken, causes netstat to segfault

+     Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=668047

+ 

+     this didn't reproduce the bug. But it works as a nice sanity test for ip 

+     so I packaged it as test anyway 

+ contact: mshi@redhat.com

+ component:

+   - iproute

+   - net-tools

+ test: ./runtest.sh

+ framework: beakerlib

+ recommend:

+   - net-tools

+   - iproute

+ duration: 10m

+ enabled: true

+ tag:

+   - Tier2

+ tier: '2'

+ extra-nitrate: TC#0128717

+ extra-summary: /CoreOS/net-tools/Regression/segfault-on-broken-proc_net_ipv6_route

+ extra-task: /CoreOS/net-tools/Regression/segfault-on-broken-proc_net_ipv6_route

+ id: 5d97d2bb-82d7-41a6-8851-5237a090a548

@@ -0,0 +1,59 @@ 

+ #!/bin/bash

+ # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   runtest.sh of /CoreOS/net-tools/Regression/segfault-on-broken-proc_net_ipv6_route

+ #   Description: Test for bz668047 (/proc/net/ipv6_route broken, causes netstat to)

+ #   Author: Ales Zelinka <azelinka@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 Beaker environment

+ . /usr/share/beakerlib/beakerlib.sh || exit 1

+ 

+ PACKAGE="net-tools"

+ 

+ rlJournalStart

+ rlPhaseStartSetup

+     rlAssertRpm $PACKAGE 

+     rlAssertRpm iproute

+     DEFAULT_IFACE=`ip r |grep default |cut -d " " -f 5 | head -1`

+     rlLog "default route interface: $DEFAULT_IFACE"

+     for n in $(seq 1 15); do

+         x=$(printf "%x" $n)

+         rlRun "ip tunnel add test-tunnel-$n mode sit local 172.16.0.$n remote 172.16.1.$n dev $DEFAULT_IFACE"

+         rlRun "ip link set test-tunnel-$n up"

+         rlRun "ip route add 200$x::/64 dev test-tunnel-$n"

+     done

+ rlPhaseEnd

+ 

+ rlPhaseStartTest

+     rlRun "netstat -nr -A inet6"  0 "netstat -nr -A inet6 didn't segfault"

+ rlPhaseEnd

+ 

+ rlPhaseStartCleanup

+     for n in $(seq 1 15); do

+         x=$(printf "%x" $n)

+         rlRun "ip tunnel del test-tunnel-$n"

+     done

+ rlPhaseEnd

+ rlJournalPrintText

+ rlJournalEnd

@@ -0,0 +1,21 @@ 

+ summary: This test creates dummy interface and changes his name to something larger

+     then 9 characters and checks if ifconfig displays this interface correctly.

+ description: ''

+ contact: fhrdina@redhat.com

+ component:

+   - net-tools

+ test: ./runtest.sh

+ framework: beakerlib

+ recommend:

+   - net-tools

+ duration: 5m

+ enabled: true

+ tag:

+   - Tier3

+ tier: '3'

+ link:

+   - relates: https://bugzilla.redhat.com/show_bug.cgi?id=206917

+ extra-nitrate: TC#0359421

+ extra-summary: /CoreOS/net-tools/Sanity/bz206917-ifconfig-does-not-show-the-full-interface-name

+ extra-task: /CoreOS/net-tools/Sanity/bz206917-ifconfig-does-not-show-the-full-interface-name

+ id: 59990234-5f98-41ca-9fd7-bd3de51e148c

@@ -0,0 +1,75 @@ 

+ #!/bin/bash

+ # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   runtest.sh of /CoreOS/net-tools/Sanity/bz206917-ifconfig-does-not-show-the-full-interface-name

+ #   Description: This test creates dummy interface and changes his name to something larger then 9 characters and checks if ifconfig displays this interface correctly.

+ #   Author: Leos Pol <lpol@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Copyright (c) 2014 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