summaryrefslogtreecommitdiff
path: root/test-cli/test
diff options
context:
space:
mode:
Diffstat (limited to 'test-cli/test')
-rw-r--r--test-cli/test/tests/qethernet.py9
-rw-r--r--test-cli/test/tests/qusb.py9
-rw-r--r--test-cli/test/tests/qwifi.py17
3 files changed, 19 insertions, 16 deletions
diff --git a/test-cli/test/tests/qethernet.py b/test-cli/test/tests/qethernet.py
index 027931c..2246029 100644
--- a/test-cli/test/tests/qethernet.py
+++ b/test-cli/test/tests/qethernet.py
@@ -6,12 +6,11 @@ import re
class Qethernet(unittest.TestCase):
__serverip = None
__numbytestx = None
- __bind = None
__bwexpected = None
__port = None
params = None
- #varlist content: serverip, bwexpected, port, (optional)bind
+ # varlist content: serverip, bwexpected, port
def __init__(self, testname, testfunc, varlist):
self.params = varlist
super(Qethernet, self).__init__(testfunc)
@@ -32,7 +31,11 @@ class Qethernet(unittest.TestCase):
def execute(self):
# execute iperf command against the server
- p = sh.iperf("-c", self.__serverip, "-x", "CMSV", "-n", self.__numbytestx, "-f", "m", "-p", self.__port)
+ try:
+ p = sh.iperf("-c", self.__serverip, "-x", "CMSV", "-n", self.__numbytestx, "-f", "m", "-p", self.__port,
+ _timeout=20)
+ except sh.TimeoutException:
+ self.fail("failed: iperf timeout reached")
# check if it was executed succesfully
if p.exit_code == 0:
diff --git a/test-cli/test/tests/qusb.py b/test-cli/test/tests/qusb.py
index 6c22c48..4c177d9 100644
--- a/test-cli/test/tests/qusb.py
+++ b/test-cli/test/tests/qusb.py
@@ -1,6 +1,7 @@
import sh
import unittest
import re
+import os
from test.helpers.changedir import changedir
@@ -14,7 +15,9 @@ class Qusb(unittest.TestCase):
def execute(self):
# Execute script usb.sh
- p = sh.bash('test/scripts/usb.sh')
+ test_abspath = os.path.dirname(os.path.abspath(__file__))
+ test_abspath = os.path.join(test_abspath, "..", "..")
+ p = sh.bash(os.path.join(test_abspath, 'test/scripts/usb.sh'))
# Search in the stdout a pattern "/dev/sd + {letter} + {number}
q = re.search("/dev/sd\w\d", p.stdout.decode('ascii'))
# get the first device which matches the pattern
@@ -33,7 +36,9 @@ class Qusb(unittest.TestCase):
p = sh.mount(device, "/mnt/pendrive")
if p.exit_code == 0:
# copy files
- p = sh.cp("test/files/usbtest/usbdatatest.bin", "test/files/usbtest/usbdatatest.md5", "/mnt/pendrive")
+ p = sh.cp(os.path.join(test_abspath, "test/files/usbtest/usbdatatest.bin"),
+ os.path.join(test_abspath, "test/files/usbtest/usbdatatest.md5"),
+ "/mnt/pendrive")
if p.exit_code == 0:
# check md5
with changedir("/mnt/pendrive/"):
diff --git a/test-cli/test/tests/qwifi.py b/test-cli/test/tests/qwifi.py
index b0b8d6b..684cb34 100644
--- a/test-cli/test/tests/qwifi.py
+++ b/test-cli/test/tests/qwifi.py
@@ -6,12 +6,11 @@ import re
class Qwifi(unittest.TestCase):
__serverip = None
__numbytestx = None
- __bind = None
__bwexpected = None
__port = None
params = None
- # varlist content: serverip, bwexpected, port, (optional)bind
+ # varlist content: serverip, bwexpected, port
def __init__(self, testname, testfunc, varlist):
self.params = varlist
super(Qwifi, self).__init__(testfunc)
@@ -27,10 +26,6 @@ class Qwifi(unittest.TestCase):
self.__port = varlist["port"]
else:
raise Exception('port param inside Qwifi must be defined')
- if "bind" in varlist:
- self.__bind = varlist["bind"]
- else:
- self.__bind = None
self.__numbytestx = "10M"
self._testMethodDoc = testname
@@ -50,12 +45,12 @@ class Qwifi(unittest.TestCase):
p.stdout.decode('ascii'))
if result:
# execute iperf command against the server
- if self.__bind is None:
- p = sh.iperf("-c", self.__serverip, "-x", "CMSV", "-n", self.__numbytestx, "-f", "m", "-p",
- self.__port)
- else:
+ try:
p = sh.iperf("-c", self.__serverip, "-x", "CMSV", "-n", self.__numbytestx, "-f", "m", "-p",
- self.__port, "-B", self.__bind)
+ self.__port, _timeout=20)
+ except sh.TimeoutException:
+ self.fail("failed: iperf timeout reached")
+
# check if it was executed succesfully
if p.exit_code == 0:
if p.stdout == "":