diff options
author | Bill Peck <bpeck@redhat.com> | 2013-01-28 15:44:28 -0500 |
---|---|---|
committer | Bill Peck <bpeck@redhat.com> | 2013-01-28 15:44:28 -0500 |
commit | 62ac6acc5e2f44f0fa56547bd7167d3d38a10be5 (patch) | |
tree | 37dada403720609951149f034a834bdbdfb858c3 | |
parent | 6ef978fcfe34ff90bca11a7486e7f517f785388d (diff) | |
download | tests-62ac6acc5e2f44f0fa56547bd7167d3d38a10be5.tar.gz tests-62ac6acc5e2f44f0fa56547bd7167d3d38a10be5.tar.xz tests-62ac6acc5e2f44f0fa56547bd7167d3d38a10be5.zip |
Update libvirt ping and netperf commands to use ../common/autologin.exp
-rw-r--r-- | kernel/networking/libvirt/common/Makefile | 50 | ||||
-rwxr-xr-x | kernel/networking/libvirt/common/autologin.exp | 43 | ||||
-rw-r--r-- | kernel/networking/libvirt/netperf-client/Makefile (renamed from kernel/networking/netperf/Makefile) | 0 | ||||
-rw-r--r-- | kernel/networking/libvirt/netperf-client/PURPOSE (renamed from kernel/networking/netperf/PURPOSE) | 0 | ||||
-rwxr-xr-x | kernel/networking/libvirt/netperf-client/runtest.sh (renamed from kernel/networking/netperf/runtest.sh) | 35 | ||||
-rw-r--r-- | kernel/networking/libvirt/netperf-server/Makefile | 51 | ||||
-rw-r--r-- | kernel/networking/libvirt/netperf-server/PURPOSE | 3 | ||||
-rwxr-xr-x | kernel/networking/libvirt/netperf-server/runtest.sh (renamed from kernel/networking/ping/runtest.sh) | 15 | ||||
-rw-r--r-- | kernel/networking/libvirt/ping/Makefile (renamed from kernel/networking/ping/Makefile) | 0 | ||||
-rw-r--r-- | kernel/networking/libvirt/ping/PURPOSE (renamed from kernel/networking/ping/PURPOSE) | 0 | ||||
-rwxr-xr-x | kernel/networking/libvirt/ping/runtest.sh | 57 |
11 files changed, 226 insertions, 28 deletions
diff --git a/kernel/networking/libvirt/common/Makefile b/kernel/networking/libvirt/common/Makefile new file mode 100644 index 0000000..329564f --- /dev/null +++ b/kernel/networking/libvirt/common/Makefile @@ -0,0 +1,50 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /kernel/networking/libvirt/common +# Description: common code for libvirt functions +# Author: Bill Peck <bpeck@redhat.com> +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2012 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. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE + +.PHONY: all install run download clean + +build: $(BUILT_FILES) + test -x autologin.exp || chmod a+x autologin.exp + +run: build + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Bill Peck <bpeck@redhat.com>" > $(METADATA) + @echo "TestTime: 10m" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Requires: expect" >> $(METADATA) diff --git a/kernel/networking/libvirt/common/autologin.exp b/kernel/networking/libvirt/common/autologin.exp new file mode 100755 index 0000000..609afc6 --- /dev/null +++ b/kernel/networking/libvirt/common/autologin.exp @@ -0,0 +1,43 @@ +#!/usr/bin/expect -f + +set login "root" +set password "redhat" + +set timeout -1 +set guest [lindex $argv 0] +set prompt "$login@.*\](%|#|\\\$) $" + +spawn virsh console $guest + +#login if needed +expect "Escape character is" +send "\r" +expect { + {login:} { send "$login\r" + expect { + {Password:} { send "$password\r" } + } + } + -re $prompt { send "\r"} + } + +expect -re $prompt + +#run command +for {set i 1} {$i < $argc} {incr i 1} { + set cmd [lindex $argv $i] + send "$cmd\r" + expect -re $prompt + sleep 1 +} + +#capture return code from last command +send "echo \$?\r" +expect -re "(\\d+)" { + set result $expect_out(1,string) +} + +#logout +send "exit\r" +expect "logout" +exit $result diff --git a/kernel/networking/netperf/Makefile b/kernel/networking/libvirt/netperf-client/Makefile index 932cac0..932cac0 100644 --- a/kernel/networking/netperf/Makefile +++ b/kernel/networking/libvirt/netperf-client/Makefile diff --git a/kernel/networking/netperf/PURPOSE b/kernel/networking/libvirt/netperf-client/PURPOSE index 6b42020..6b42020 100644 --- a/kernel/networking/netperf/PURPOSE +++ b/kernel/networking/libvirt/netperf-client/PURPOSE diff --git a/kernel/networking/netperf/runtest.sh b/kernel/networking/libvirt/netperf-client/runtest.sh index 768e820..fe712f9 100755 --- a/kernel/networking/netperf/runtest.sh +++ b/kernel/networking/libvirt/netperf-client/runtest.sh @@ -2,7 +2,7 @@ # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -# runtest.sh of /kernel/networking/ping +# runtest.sh of /kernel/networking/libvirt/ping # Description: pings both $VALID_ADDRS and $INVALID_ADDRS, verifies connectivity # Author: Bill Peck <bpeck@redhat.com> # @@ -31,23 +31,26 @@ PERF_TIME=${PERF_TIME:="10"} -start_server() +pass() { - service iptables stop - netserver -4 & + report_result $WHITEBOARD/$1/$addr PASS 0 } -start_server - -# wait a bit for everyone to start.. -sleep 500 +fail() +{ + report_result $WHITEBOARD/$1/$addr FAIL 1 +} -for addr in $INVALID_ADDRS; do - netperf -4 -H $addr -l $PERF_TIME && report_result $TEST/$addr FAIL 1 || report_result $TEST/$addr PASS 0 +for guest in $GUESTS; do + for blob in $(eval echo \$$guest); do + eval $(echo $blob| sed 's/;/\\;/g') + done + IFS=";" + for addr in $valid_addrs; do + ../common/autologin.exp $guest "netperf -4 -H $addr -l $PERF_TIME" && pass VALID|| fail VALID + done + for addr in $invalid_addrs; do + ../common/autologin.exp $guest "netperf -4 -H $addr -l $PERF_TIME" && pass INVALID|| fail INVALID + done + unset IFS done -for addr in $VALID_ADDRS; do - netperf -4 -H $addr -l $PERF_TIME && report_result $TEST/$addr PASS 0 || report_result $TEST/$addr FAIL 1 -done - -# wait a bit for everyone to finish.. -sleep 500 diff --git a/kernel/networking/libvirt/netperf-server/Makefile b/kernel/networking/libvirt/netperf-server/Makefile new file mode 100644 index 0000000..932cac0 --- /dev/null +++ b/kernel/networking/libvirt/netperf-server/Makefile @@ -0,0 +1,51 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /kernel/networking/netperf +# Description: run netperf both $VALID_ADDRS and $INVALID_ADDRS, verifies connectivity +# Author: Bill Peck <bpeck@redhat.com> +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2012 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. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Bill Peck <bpeck@redhat.com>" > $(METADATA) + @echo "TestTime: 10m" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Requires: netperf" >> $(METADATA) diff --git a/kernel/networking/libvirt/netperf-server/PURPOSE b/kernel/networking/libvirt/netperf-server/PURPOSE new file mode 100644 index 0000000..6b42020 --- /dev/null +++ b/kernel/networking/libvirt/netperf-server/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /kernel/networking/ping +Description: run netperf both $VALID_ADDRS and $INVALID_ADDRS, verifies connectivity +Author: Bill Peck <bpeck@redhat.com> diff --git a/kernel/networking/ping/runtest.sh b/kernel/networking/libvirt/netperf-server/runtest.sh index a514dc1..6f60d50 100755 --- a/kernel/networking/ping/runtest.sh +++ b/kernel/networking/libvirt/netperf-server/runtest.sh @@ -29,15 +29,6 @@ # Include Beaker environment . /usr/bin/rhts-environment.sh || exit 1 -PING_COUNT=${PING_COUNT:="10"} -PING_SIZE=${PING_SIZE:="64"} - -PACKAGE="openvswitch" -rpm -q $PACKAGE || fail "$PACKAGE not installed" - -for addr in $INVALID_ADDRS; do - ping -c $PING_COUNT -i 0.2 -s $PING_SIZE $addr && report_result $TEST/INVALID/$addr FAIL 1 || report_result $TEST/INVALID/$addr PASS 0 -done -for addr in $VALID_ADDRS; do - ping -c $PING_COUNT -i 0.2 -s $PING_SIZE $addr && report_result $TEST/VALID/$addr PASS 0 || report_result $TEST/VALID/$addr FAIL 1 -done +service iptables stop +nohup netserver -4 & +sleep 10 diff --git a/kernel/networking/ping/Makefile b/kernel/networking/libvirt/ping/Makefile index 3c90a4d..3c90a4d 100644 --- a/kernel/networking/ping/Makefile +++ b/kernel/networking/libvirt/ping/Makefile diff --git a/kernel/networking/ping/PURPOSE b/kernel/networking/libvirt/ping/PURPOSE index 2dbbd56..2dbbd56 100644 --- a/kernel/networking/ping/PURPOSE +++ b/kernel/networking/libvirt/ping/PURPOSE diff --git a/kernel/networking/libvirt/ping/runtest.sh b/kernel/networking/libvirt/ping/runtest.sh new file mode 100755 index 0000000..facbd9b --- /dev/null +++ b/kernel/networking/libvirt/ping/runtest.sh @@ -0,0 +1,57 @@ +#!/bin/bash -x +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /kernel/networking/libvirt/ping +# Description: pings both $VALID_ADDRS and $INVALID_ADDRS, verifies connectivity +# Author: Bill Peck <bpeck@redhat.com> +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2012 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/bin/rhts-environment.sh || exit 1 + +PING_COUNT=${PING_COUNT:="10"} +PING_SIZE=${PING_SIZE:="64"} + +pass() +{ + report_result $WHITEBOARD/$1/$addr PASS 0 +} + +fail() +{ + report_result $WHITEBOARD/$1/$addr FAIL 1 +} + +for guest in $GUESTS; do + for blob in $(eval echo \$$guest); do + eval $(echo $blob| sed 's/;/\\;/g') + done + IFS=";" + for addr in $valid_addrs; do + ../common/autologin.exp $guest "ping -c $PING_COUNT -i 0.2 -s $PING_SIZE $addr" && pass VALID|| fail VALID + done + for addr in $invalid_addrs; do + ../common/autologin.exp $guest "ping -c $PING_COUNT -i 0.2 -s $PING_SIZE $addr" && pass INVALID|| fail INVALID + done + unset IFS +done |