RHEL 9.0.0 Alpha bootstrap

The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/iperf3#19024d7a8fbad3a39a1c966a60029fcb2100fde0
This commit is contained in:
Petr Šabata 2020-10-15 13:42:33 +02:00
parent 3f03a17c10
commit c3bfd85aed
7 changed files with 662 additions and 0 deletions

22
.gitignore vendored
View File

@ -0,0 +1,22 @@
/iperf-3.0b4.tar.gz
/iperf-3.0b5.tar.gz
/iperf-3.0.tar.gz
/iperf-3.0.1.tar.gz
/iperf-3.0.2.tar.gz
/iperf-3.0.3.tar.gz
/iperf-3.0.5.tar.gz
/iperf-3.0.6.tar.gz
/iperf-3.0.10.tar.gz
/iperf-3.0.11.tar.gz
/iperf-3.1b3.tar.gz
/iperf-3.1.3.tar.gz
/iperf-3.1.4.tar.gz
/iperf-3.1.5.tar.gz
/iperf-3.1.6.tar.gz
/iperf-3.1.7.tar.gz
/iperf-3.2.tar.gz
/iperf-3.3.tar.gz
/iperf-3.4.tar.gz
/iperf-3.5.tar.gz
/iperf-3.6.tar.gz
/iperf-3.7.tar.gz

View File

@ -0,0 +1,11 @@
--- iperf-3.0.3/src/iperf_api.c 2014-03-26 23:36:38.000000000 +0530
+++ iperf-3.0.3.patch/src/iperf_api.c 2014-06-09 23:31:46.183346802 +0530
@@ -2215,7 +2215,7 @@ iperf_new_stream(struct iperf_test *test
sp->rcv = test->protocol->recv;
if (test->diskfile_name != (char*) 0) {
- sp->diskfile_fd = open(test->diskfile_name, test->sender ? O_RDONLY : (O_WRONLY|O_CREAT|O_TRUNC));
+ sp->diskfile_fd = open(test->diskfile_name, test->sender ? O_RDONLY : (O_WRONLY|O_CREAT|O_TRUNC), S_IRUSR|S_IWUSR);
if (sp->diskfile_fd == -1) {
i_errno = IEFILE;
munmap(sp->buffer, sp->test->settings->blksize);

196
iperf3.spec Normal file
View File

@ -0,0 +1,196 @@
Name: iperf3
Version: 3.7
Release: 5%{?dist}
Summary: Measurement tool for TCP/UDP bandwidth performance
License: BSD
URL: http://github.com/esnet/iperf
Source0: http://downloads.es.net/pub/iperf/iperf-%{version}.tar.gz
BuildRequires: libuuid-devel
BuildRequires: gcc
BuildRequires: lksctp-tools-devel
BuildRequires: openssl-devel
%description
Iperf is a tool to measure maximum TCP bandwidth, allowing the tuning of
various parameters and UDP characteristics. Iperf reports bandwidth, delay
jitter, data-gram loss.
%package devel
Summary: Development files for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%prep
%setup -q -n iperf-%{version}
%build
%configure --disable-static
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
make %{?_smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
%makeinstall -C src INSTALL_DIR="%{buildroot}%{_bindir}"
mkdir -p %{buildroot}%{_mandir}/man1
rm -f %{buildroot}%{_libdir}/libiperf.la
%files
%doc README.md LICENSE RELNOTES.md
%{_mandir}/man1/iperf3.1.gz
%{_mandir}/man3/libiperf.3.gz
%{_bindir}/iperf3
%{_libdir}/*.so.*
%files devel
%{_includedir}/iperf_api.h
%{_libdir}/*.so
%changelog
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.7-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed Feb 19 2020 Michal Ruprich <mruprich@redhat.com> - 3.7-4
- Add openssl-devel to BuildRequires to enable authentization of client
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.7-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sat Jun 22 2019 Kevin Fenzi <kevin@scrye.com> - 3.7-1
- Update to 3.7. Fixes bug #1723020
* Tue Feb 26 2019 Tomas Korbar <tkorbar@redhat.com> - 3.6-5
- Add lksctp-tools-devel to BuildRequires
- Fix bug #1647385
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Jul 20 2018 Kevin Fenzi <kevin@scrye.com> - 3.6-3
- Fix FTBFS bug #1604377 by adding BuildRequires: gcc
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu Jun 28 2018 Kevin Fenzi <kevin@scrye.com> - 3.6-1
- Update to 3.6. Fixes bug #1594995
* Sat Mar 03 2018 Kevin Fenzi <kevin@scrye.com> - 3.5-1
- Update to 3.5. Fixes bug #1551166
* Fri Feb 16 2018 Kevin Fenzi <kevin@scrye.com> - 3.4-1
- Upgrade to 3.4. Fixes bug #1545468
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Sat Nov 04 2017 Kevin Fenzi <kevin@scrye.com> - 3.3-1
- Update to 3.3. Fixes bug #1508669
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Wed Jun 28 2017 Kevin Fenzi <kevin@scrye.com> - 3.2-1
- Update to 3.2. Fixes bug #1465195
* Wed Mar 08 2017 Kevin Fenzi <kevin@scrye.com> - 3.1.7-1
- Update to 3.1.7. Fixes bug #1429901
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Fri Feb 03 2017 Kevin Fenzi <kevin@scrye.com> - 3.1.6-1
- Update to 3.1.6. Fixes bug #1418879
* Fri Jan 13 2017 Kevin Fenzi <kevin@scrye.com> - 3.1.5-1
- Update to 3.1.5. Fixes bug #1412848
* Sat Nov 05 2016 Kevin Fenzi <kevin@scrye.com> - 3.1.4-1
- Update to 3.1.4. Fixes bug #1390396
* Wed Jun 08 2016 Kevin Fenzi <kevin@scrye.com> - 3.1.3-1
- Update to 3.1.3
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.1b3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Thu Oct 08 2015 Susant Sahani <ssahani@gmail.com> 3.1b3
- Update to 3.1b3
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.11-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Mon May 04 2015 Susant Sahani <ssahani@gmail.com> 3.0.11-1
- Update to 3.0.11
* Sat Dec 20 2014 Susant Sahani <ssahani@redhat.com> 3.0.10-1
- Update to 3.0.10
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Wed Jul 30 2014 Susant Sahani <ssahani@redhat.com> 3.0.6-1
- Update to 3.0.6
* Thu Jun 19 2014 Susant Sahani <ssahani@redhat.com> 3.0.5-1
- Update to 3.0.5
* Tue Jun 10 2014 Susant Sahani <ssahani@redhat.com> - 3.0.3-5
- fix compilation BZ #1106803
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Wed Apr 2 2014 François Cami <fcami@fedoraproject.org> - 3.0.3-3
- Drop static library support (#1081486).
- iperf3-devel subpackage must require iperf3.
- iperf3-devel should only contain the unversioned shared library.
- Call ldconfig since we are installing a shared library now.
- Removed INSTALL file.
* Wed Apr 2 2014 Susant Sahani <ssahani@redhat.com> 3.0.3-2
- Moved static library to devel section only .
* Sun Mar 30 2014 Susant Sahani <ssahani@redhat.com> 3.0.3-1
- Update to 3.0.3 and added devel rpm support
* Tue Mar 11 2014 Susant Sahani <ssahani@redhat.com> 3.0.2-1
- Update to 3.0.2
* Tue Jan 14 2014 Susant Sahani <ssahani@redhat.com> 3.0.1-1
- Update to 3.0.1
* Fri Oct 25 2013 Steven Roberts <strobert@strobe.net> 3.0-1
- Update to 3.0
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0-0.5.b5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Sat May 04 2013 Kevin Fenzi <kevin@scrye.com> 3.0-0.4.b5
- Update to 3.0b5
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0-0.3.b4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0-0.2.b4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0-0.1.b4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Wed Apr 06 2011 G.Balaji <balajig81@gmail.com> 3.0b4-2
- Changed the Spec name, removed static libs generation and devel
- package.
* Sat Mar 26 2011 G.Balaji <balajig81@gmail.com> 3.0b4-1
- Initial Version

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (iperf-3.7.tar.gz) = 9b8d1ac6bdebb00e38e196db9a71ae6ff3b8b763cd4b1336d078c31f6d0a5ab53bbe70ba949c601af5efe674dbd032ed5d58a761d5159dae4e50122b68a8f086

View File

@ -0,0 +1,348 @@
#!/usr/bin/env python3
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# iperf3 integration test
# Description: Test for ipertf3
# Author: Susant Sahani <susant@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2018 Red Hat, Inc.
#
# 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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
import errno
import os
import sys
import time
import unittest
import subprocess
import signal
import shutil
import re
import psutil
IPERF3_SERVER_LOGS='/var/run/iperf3-test-log'
IPERF3_PID_FILE='/var/run/iperf3-test-pid'
TEST_COMPLETE='Test Complete. Summary Results:'
SERVER_TEST_PROTOCOL_TCP_MSG='Starting Test: protocol: TCP'
SERVER_TEST_PROTOCOL_UDP_MSG='Starting Test: protocol: UDP'
SERVER_LISTENING_PORT_5202_MSG='Server listening on 5202'
SERVER_LISTENING_PORT_5201_MSG='Server listening on 5201'
SERVER_CONNECTED_LOCAL_PORT_5202_WITH_REMOTE_PORT_MSG='local 127.0.0.1 port 5202 connected to 127.0.0.1 port \d+'
SERVER_CONNECTED_LOCAL_PORT_5202_WITH_REMOTE_PORT_IPV6_MSG='local ::1 port 5202 connected to ::1 port \d+'
SERVER_CONNECTED_LOCAL_PORT_5201_WITH_REMOTE_PORT_MSG='local 127.0.0.1 port 5201 connected to 127.0.0.1 port \d+'
SERVER_INCOMING_CONNECTION_MSG='Accepted connection from 127.0.0.1, port \d+'
SERVER_INCOMING_CONNECTION_IPV6_MSG='Accepted connection from ::1, port \d+'
CLIENT_CONNECTED_TO_SERVER_PORT_5202_MSG='local 127.0.0.1 port \d+ connected to 127.0.0.1 port 5202'
CLIENT_CONNECTED_TO_SERVER_PORT_5201_MSG='local 127.0.0.1 port \d+ connected to 127.0.0.1 port 5201'
CLIENT_CONNECTED_TO_SERVER_PORT_5202_IPV6_MSG='local ::1 port \d+ connected to ::1 port 5202'
CLIENT_TEST_COMPLETE_MSG='iperf Done'
def setUpModule():
"""Initialize the environment, and perform sanity checks on it."""
if shutil.which('iperf3') is None:
raise OSError(errno.ENOENT, 'iperf3 not found')
for pid in psutil.pids():
p = psutil.Process(pid)
if p.name() == "iperf3":
raise unittest.SkipTest('iperf3 is already active')
class Iperf3ServerLogUtilities():
"""Provide a set of utility functions to facilitate iperf3 tests.
This class must be inherited along with unittest.TestCase to define
some required methods.
"""
def findTextInServerLog(self, **kwargs):
"""Look various success lines from iperf3 server logs."""
if kwargs is not None:
with open (IPERF3_SERVER_LOGS, 'rt') as in_file:
contents = in_file.read()
for key in kwargs:
self.assertRegex(contents, kwargs[key])
def KillIperf3Server(self):
time.sleep(3)
try:
with open(IPERF3_PID_FILE, 'r') as f:
pid = f.read().rstrip(' \t\r\n\0')
os.kill(int(pid), signal.SIGTERM)
os.remove(IPERF3_SERVER_LOGS)
os.remove(IPERF3_PID_FILE)
except IOError:
pass
def VerifyPortIsOpenAuto(self, port):
""" Tests whether iperf3 is listening on given port """
netstat_output = subprocess.check_output(['netstat', '-antpl']).rstrip().decode('utf-8')
self.assertIsNotNone(netstat_output)
match='tcp.*' + str(port) +'.*LISTEN.*/iperf3'
self.assertRegex(netstat_output, match)
class Iperf3TestsBindToInterface(unittest.TestCase, Iperf3ServerLogUtilities):
def setUp(self):
"""Setup veth interface"""
subprocess.check_output(['ip', 'link', 'add', 'iperf-veth', 'type', 'veth', 'peer', 'name', 'iperf-veth-peer'])
subprocess.check_output(['ip', 'addr', 'add', '192.168.50.5', 'dev', 'iperf-veth'])
subprocess.check_output(['ip', 'addr', 'add', '192.168.50.6', 'dev', 'iperf-veth-peer'])
subprocess.check_output(['ip', 'link', 'set', 'iperf-veth', 'up'])
subprocess.check_output(['ip', 'link', 'set', 'iperf-veth-peer', 'up'])
"""Start iperf3."""
subprocess.check_output(['iperf3', '-s', '--daemon', '--verbose' , '--logfile', '/var/run/iperf3-test-log', '--pidfile', '/var/run/iperf3-test-pid', '--bind', '192.168.50.5'])
time.sleep(3)
self.VerifyPortIsOpenAuto(5201)
def tearDown(self):
self.KillIperf3Server()
subprocess.check_output(['ip', 'link', 'del', 'iperf-veth'])
def test_tcp_client_bind_to_interface_default_port(self):
client_output = subprocess.check_output(['iperf3', '-c', '192.168.50.5', '--bind', '192.168.50.6']).rstrip().decode('utf-8')
self.assertRegex(client_output, 'Connecting to host 192.168.50.5, port 5201')
self.assertRegex(client_output, 'local 192.168.50.6 port \d+ connected to 192.168.50.5 port 5201')
self.assertRegex(client_output, CLIENT_TEST_COMPLETE_MSG)
self.findTextInServerLog(test1='Accepted connection from 192.168.50.6, port \d+',
test2='local 192.168.50.5 port 5201 connected to 192.168.50.6 port \d+',
test3=SERVER_TEST_PROTOCOL_TCP_MSG,
test4=TEST_COMPLETE)
class Iperf3Tests(unittest.TestCase, Iperf3ServerLogUtilities):
def setUp(self):
"""Start iperf3."""
subprocess.check_output(['iperf3', '-s', '-p', '5202', '--daemon', '--verbose' , '--logfile', '/var/run/iperf3-test-log', '--pidfile', '/var/run/iperf3-test-pid'])
time.sleep(3)
self.VerifyPortIsOpenAuto(5202)
def tearDown(self):
self.KillIperf3Server()
def test_tcp_client_custom_port_5202(self):
client_output = subprocess.check_output(['iperf3', '-c', '127.0.0.1', '-p', '5202']).rstrip().decode('utf-8')
self.assertRegex(client_output, CLIENT_CONNECTED_TO_SERVER_PORT_5202_MSG)
self.assertRegex(client_output, CLIENT_TEST_COMPLETE_MSG)
self.findTextInServerLog(test1=SERVER_CONNECTED_LOCAL_PORT_5202_WITH_REMOTE_PORT_MSG,
test2=SERVER_INCOMING_CONNECTION_MSG,
test3=SERVER_CONNECTED_LOCAL_PORT_5202_WITH_REMOTE_PORT_MSG,
test4=SERVER_TEST_PROTOCOL_TCP_MSG,
test5=TEST_COMPLETE)
def test_udp_client_custom_port_5202(self):
client_output = subprocess.check_output(['iperf3', '-c', '127.0.0.1', '-u', '-p', '5202']).rstrip().decode('utf-8')
self.assertRegex(client_output, CLIENT_CONNECTED_TO_SERVER_PORT_5202_MSG)
self.assertRegex(client_output, "Total Datagrams")
self.assertRegex(client_output, CLIENT_TEST_COMPLETE_MSG)
self.findTextInServerLog(test1=SERVER_CONNECTED_LOCAL_PORT_5202_WITH_REMOTE_PORT_MSG,
test2=SERVER_INCOMING_CONNECTION_MSG,
test3=SERVER_CONNECTED_LOCAL_PORT_5202_WITH_REMOTE_PORT_MSG,
test4=SERVER_TEST_PROTOCOL_UDP_MSG,
test5=TEST_COMPLETE)
def test_tcp_client_custom_port_5202_time_15sec(self):
client_output = subprocess.check_output(['iperf3', '-c', '127.0.0.1', '-p', '5202', '-t','15']).rstrip().decode('utf-8')
self.assertRegex(client_output, CLIENT_CONNECTED_TO_SERVER_PORT_5202_MSG)
self.assertRegex(client_output, CLIENT_TEST_COMPLETE_MSG)
self.findTextInServerLog(test1=SERVER_CONNECTED_LOCAL_PORT_5202_WITH_REMOTE_PORT_MSG,
test2=SERVER_INCOMING_CONNECTION_MSG,
test3=SERVER_CONNECTED_LOCAL_PORT_5202_WITH_REMOTE_PORT_MSG,
test4=SERVER_TEST_PROTOCOL_TCP_MSG,
test5='15 second test',
test6=TEST_COMPLETE)
def test_tcp_client_port_5202_ipv6(self):
client_output = subprocess.check_output(['iperf3', '-c', '::1', '-p', '5202']).rstrip().decode('utf-8')
self.assertRegex(client_output, CLIENT_CONNECTED_TO_SERVER_PORT_5202_IPV6_MSG)
self.assertRegex(client_output, CLIENT_TEST_COMPLETE_MSG)
self.findTextInServerLog(test1=SERVER_CONNECTED_LOCAL_PORT_5202_WITH_REMOTE_PORT_IPV6_MSG,
test2=SERVER_INCOMING_CONNECTION_IPV6_MSG,
test3=SERVER_TEST_PROTOCOL_TCP_MSG,
test4=TEST_COMPLETE)
def test_udp_client_port_5202_ipv6(self):
client_output = subprocess.check_output(['iperf3', '-c', '::1', '-u', '-p', '5202']).rstrip().decode('utf-8')
self.assertRegex(client_output, CLIENT_CONNECTED_TO_SERVER_PORT_5202_IPV6_MSG)
self.assertRegex(client_output, CLIENT_TEST_COMPLETE_MSG)
self.findTextInServerLog(test1=SERVER_CONNECTED_LOCAL_PORT_5202_WITH_REMOTE_PORT_IPV6_MSG,
test2=SERVER_INCOMING_CONNECTION_IPV6_MSG,
test3=SERVER_TEST_PROTOCOL_UDP_MSG,
test4=TEST_COMPLETE)
def test_tcp_client_custom_port_5202_parallel(self):
client_output = subprocess.check_output(['iperf3', '-c', '127.0.0.1', '-p', '5202', '--parallel', '10']).rstrip().decode('utf-8')
self.assertRegex(client_output, CLIENT_CONNECTED_TO_SERVER_PORT_5202_MSG)
self.assertRegex(client_output, CLIENT_TEST_COMPLETE_MSG)
self.findTextInServerLog(test1=SERVER_CONNECTED_LOCAL_PORT_5202_WITH_REMOTE_PORT_MSG,
test2=SERVER_INCOMING_CONNECTION_MSG,
test3=SERVER_CONNECTED_LOCAL_PORT_5202_WITH_REMOTE_PORT_MSG,
test4='Starting Test: protocol: TCP, 10 streams',
test5=TEST_COMPLETE)
def test_tcp_client_custom_port_5202_reverse(self):
client_output = subprocess.check_output(['iperf3', '-c', '127.0.0.1', '-p', '5202', '-R']).rstrip().decode('utf-8')
self.assertRegex(client_output, CLIENT_CONNECTED_TO_SERVER_PORT_5202_MSG)
self.assertRegex(client_output, 'Reverse mode, remote host 127.0.0.1 is sending')
self.assertRegex(client_output, CLIENT_TEST_COMPLETE_MSG)
self.findTextInServerLog(test1=SERVER_CONNECTED_LOCAL_PORT_5202_WITH_REMOTE_PORT_MSG,
test2=SERVER_INCOMING_CONNECTION_MSG,
test3=SERVER_CONNECTED_LOCAL_PORT_5202_WITH_REMOTE_PORT_MSG,
test4=TEST_COMPLETE)
def test_tcp_client_custom_port_5202_dscp(self):
client_output = subprocess.check_output(['iperf3', '-c', '127.0.0.1', '-p', '5202', '--dscp', '22']).rstrip().decode('utf-8')
self.assertRegex(client_output, CLIENT_CONNECTED_TO_SERVER_PORT_5202_MSG)
self.assertRegex(client_output, CLIENT_TEST_COMPLETE_MSG)
self.findTextInServerLog(test1=SERVER_CONNECTED_LOCAL_PORT_5202_WITH_REMOTE_PORT_MSG,
test2=SERVER_INCOMING_CONNECTION_MSG,
test3=SERVER_CONNECTED_LOCAL_PORT_5202_WITH_REMOTE_PORT_MSG,
test4='tos 22',
test5=TEST_COMPLETE)
def test_tcp_client_custom_port_5202_mss(self):
client_output = subprocess.check_output(['iperf3', '-c', '127.0.0.1', '-p', '5202', '--set-mss', '400']).rstrip().decode('utf-8')
self.assertRegex(client_output, CLIENT_CONNECTED_TO_SERVER_PORT_5202_MSG)
self.assertRegex(client_output, CLIENT_TEST_COMPLETE_MSG)
self.findTextInServerLog(test1=SERVER_CONNECTED_LOCAL_PORT_5202_WITH_REMOTE_PORT_MSG,
test2=SERVER_INCOMING_CONNECTION_MSG,
test3=SERVER_CONNECTED_LOCAL_PORT_5202_WITH_REMOTE_PORT_MSG,
test4='TCP MSS: 400',
test5=TEST_COMPLETE)
def test_tcp_client_custom_port_5202_title(self):
client_output = subprocess.check_output(['iperf3', '-c', '127.0.0.1', '-p', '5202', '--title', 'Susant']).rstrip().decode('utf-8')
self.assertRegex(client_output, CLIENT_CONNECTED_TO_SERVER_PORT_5202_MSG)
self.assertRegex(client_output, "Susant")
self.assertRegex(client_output, CLIENT_TEST_COMPLETE_MSG)
self.findTextInServerLog(test1=SERVER_CONNECTED_LOCAL_PORT_5202_WITH_REMOTE_PORT_MSG,
test2=SERVER_INCOMING_CONNECTION_MSG,
test3=SERVER_CONNECTED_LOCAL_PORT_5202_WITH_REMOTE_PORT_MSG,
test4=TEST_COMPLETE)
def test_tcp_client_custom_port_5202_get_server_output(self):
client_output = subprocess.check_output(['iperf3', '-c', '127.0.0.1', '-p', '5202', '--get-server-output']).rstrip().decode('utf-8')
self.assertRegex(client_output, "Server output:")
self.assertRegex(client_output, CLIENT_TEST_COMPLETE_MSG)
self.findTextInServerLog(test1=SERVER_CONNECTED_LOCAL_PORT_5202_WITH_REMOTE_PORT_MSG,
test2=SERVER_INCOMING_CONNECTION_MSG,
test5=TEST_COMPLETE)
def test_tcp_client_custom_port_5202_custom_client_port(self):
client_output = subprocess.check_output(['iperf3', '-c', '127.0.0.1', '-p', '5202', '--bind', '127.0.0.1', '--cport', '5203']).rstrip().decode('utf-8')
self.assertRegex(client_output, CLIENT_CONNECTED_TO_SERVER_PORT_5202_MSG)
self.assertRegex(client_output, CLIENT_TEST_COMPLETE_MSG)
self.findTextInServerLog(test1=SERVER_CONNECTED_LOCAL_PORT_5202_WITH_REMOTE_PORT_MSG,
test2='port 5203',
test3=TEST_COMPLETE)
class Iperf3SanityTests(unittest.TestCase, Iperf3ServerLogUtilities):
def setUp(self):
"""Start iperf3 default TCP mode."""
subprocess.check_output(['iperf3', '--daemon', '--server', '--verbose' , '--logfile', '/var/run/iperf3-test-log', '--pidfile', '/var/run/iperf3-test-pid'])
time.sleep(3)
self.VerifyPortIsOpenAuto(5201)
def tearDown(self):
self.KillIperf3Server()
def test_basic_tcp_client_default_port_5201(self):
client_output = subprocess.check_output(['iperf3', '-c', '127.0.0.1',]).rstrip().decode('utf-8')
self.assertRegex(client_output, CLIENT_CONNECTED_TO_SERVER_PORT_5201_MSG)
self.assertRegex(client_output, CLIENT_TEST_COMPLETE_MSG)
self.findTextInServerLog(test1=SERVER_LISTENING_PORT_5201_MSG,
test2=SERVER_INCOMING_CONNECTION_MSG,
test3=SERVER_CONNECTED_LOCAL_PORT_5201_WITH_REMOTE_PORT_MSG,
test4=SERVER_TEST_PROTOCOL_TCP_MSG,
test5=TEST_COMPLETE)
def test_server_log_file_exists(self):
self.assertTrue(os.path.exists(IPERF3_SERVER_LOGS))
def test_server_pid_file_exists(self):
self.assertTrue(os.path.exists(IPERF3_PID_FILE))
def test_server_daemon_pid_equal_to_pid_file(self):
with open(IPERF3_PID_FILE, 'r') as f:
pid = f.read().rstrip(' \t\r\n\0')
proc_path = os.path.join('/proc/', pid)
self.assertTrue(os.path.exists(proc_path))
process = psutil.Process(int(pid))
self.assertEqual(process.name(), 'iperf3')
f.close()
def test_basic_udp_client_default_port_5201(self):
client_output = subprocess.check_output(['iperf3', '-c', '127.0.0.1', '-u']).rstrip().decode('utf-8')
self.assertRegex(client_output, CLIENT_CONNECTED_TO_SERVER_PORT_5201_MSG)
self.assertRegex(client_output, 'Total Datagrams')
self.assertRegex(client_output, CLIENT_TEST_COMPLETE_MSG)
self.findTextInServerLog(test1=SERVER_LISTENING_PORT_5201_MSG,
test2=SERVER_INCOMING_CONNECTION_MSG,
test3=SERVER_CONNECTED_LOCAL_PORT_5201_WITH_REMOTE_PORT_MSG,
test4=SERVER_TEST_PROTOCOL_UDP_MSG,
test5=TEST_COMPLETE)
if __name__ == '__main__':
unittest.main(testRunner=unittest.TextTestRunner(stream=sys.stdout,
verbosity=2))

View File

@ -0,0 +1,73 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of iperf3
# Description: iPerf3 is a tool for active measurements of the maximum
# achievable bandwidth on IP networks.
# Author: Susant Sahani <susant@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2018 Red Hat, Inc.
#
# 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="iperf3"
Iperf3PidFile="/var/run/iperf3-test-pid"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
if pgrep -x "iperf3" > /dev/null
then
rlLog "Iperf3 is already Running"
fi
rlRun "cp iperf3-test.py /usr/bin/"
rlPhaseEnd
rlPhaseStartTest
rlLog "iperf3 tests"
rlRun "/usr/bin/python3 /usr/bin/iperf3-test.py"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "rm /usr/bin/iperf3-test.py"
if [ -f "$Iperf3PidFile" ]
then
rlRun "read Iperf3Pid < $Iperf3PidFile"
rlRun "echo $Iperf3Pid"
if [ -z $Iperf3Pid ]
then
rlRun "kill -9 $Iperf3Pid"
rlRun "rm Iperf3PidFile"
fi
fi
rlLog "iperf3 tests done"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd
rlGetTestState

11
tests/tests.yml Normal file
View File

@ -0,0 +1,11 @@
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- classic
tests:
- miscellaneous-tests
required_packages:
- iperf3
- python3
- net-tools