diff options
Diffstat (limited to 'test-cli/test/tests')
-rw-r--r-- | test-cli/test/tests/qbutton.py | 64 | ||||
-rw-r--r-- | test-cli/test/tests/qusb.py | 2 | ||||
-rw-r--r-- | test-cli/test/tests/qwifi.py | 19 |
3 files changed, 11 insertions, 74 deletions
diff --git a/test-cli/test/tests/qbutton.py b/test-cli/test/tests/qbutton.py deleted file mode 100644 index 46ddde0..0000000 --- a/test-cli/test/tests/qbutton.py +++ /dev/null @@ -1,64 +0,0 @@ -from test.helpers.syscmd import SysCommand -import unittest -import time - - -class Qbutton(unittest.TestCase): - params = None - - def __init__(self, testname, testfunc, varlist): - self.params = varlist - super(Qbutton, self).__init__(testfunc) - if "gpio" in varlist: - self.__gpio = varlist["gpio"] - else: - raise Exception('gpio param inside Qbutton must be defined') - if self.__gpio == "SOPA": - super(Qbutton, self).__init__("buttonSopa") - else: - super(Qbutton, self).__init__("buttonGpio") - self._testMethodDoc = testname - - def buttonGpio(self): - print("normal-button-test-using-gpio") - self.fail("failed: GPIO BUTTON FAIL") - - def buttonSopa(self): - str_cmd = "i2cset -f -y 1 0x2d 0x40 0x31" - disable_pmic = SysCommand("disable_pmic", str_cmd) - disable_pmic.execute() - # BUG: REPEAT THIS EXECUTION TWICE BECAUSE FIRST TIME IT RETURNS AN ERROR - led_on="echo 1 > /sys/class/leds/red\:usbhost/brightness" - ledon = SysCommand("led_on", led_on) - ledon.execute() - time.sleep(0.1) - disable_pmic.execute() - if disable_pmic.execute() == 0: - str_cmd = "i2cset -f -y 1 0x2d 0x50 0xff" - reset_button = SysCommand("reset_button", str_cmd) - if reset_button.execute() == 0: - str_cmd = "i2cget -f -y 1 0x2d 0x50" - get_button_val = SysCommand("get_button_val", str_cmd) - print("\n\t --> PRESS button for 1 sec (TIMEOUT: 10s) \n") - timeout = 0 - while timeout < 7200: - if get_button_val.execute() == 0: - get_button_val.execute() - button_value = get_button_val.getOutput() - button_value=button_value.decode('ascii').split("x") - if int(button_value[1]) == 4: - timeout = 7200 - led_off="echo 0 > /sys/class/leds/red\:usbhost/brightness" - ledoff = SysCommand("led_off", led_off) - ledoff.execute() - time.sleep(0.5) - timeout = timeout + 1 - if timeout==7200 and int(button_value[1]) == 0: - self.fail("failed: timeout exceeded") - else: - timeout = 7200 - self.fail("failed: not button input") - else: - self.fail("failed: could not complete i2c reset button state") - else: - self.fail("failed: could not complete i2c disable PMIC") diff --git a/test-cli/test/tests/qusb.py b/test-cli/test/tests/qusb.py index 7ecf31e..6a004f0 100644 --- a/test-cli/test/tests/qusb.py +++ b/test-cli/test/tests/qusb.py @@ -14,7 +14,7 @@ class Qusb(unittest.TestCase): def execute(self): # Execute script usb.sh - p = sh.bash('test/helpers/usb.sh') + p = sh.bash('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 diff --git a/test-cli/test/tests/qwifi.py b/test-cli/test/tests/qwifi.py index 2a5fa0c..8daf069 100644 --- a/test-cli/test/tests/qwifi.py +++ b/test-cli/test/tests/qwifi.py @@ -4,14 +4,14 @@ import re class Qwifi(unittest.TestCase): - __sip = None + __serverip = None __numbytestx = None __bind = None - __OKBW = None + __bwexpected = None __port = None params = None - #varlist: serverip, bind, OKBW, port + # varlist content: serverip, bwexpected, port, (optional)bind def __init__(self, testname, testfunc, varlist): self.params = varlist super(Qwifi, self).__init__(testfunc) @@ -19,8 +19,8 @@ class Qwifi(unittest.TestCase): self.__serverip = varlist["serverip"] else: raise Exception('serverip param inside Qwifi have been be defined') - if "OKBW" in varlist: - self.__OKBW = varlist["OKBW"] + if "bwexpected" in varlist: + self.__bwexpected = varlist["bwexpected"] else: raise Exception('OKBW param inside Qwifi must be defined') if "port" in varlist: @@ -41,11 +41,12 @@ class Qwifi(unittest.TestCase): # get the first line of the output stream out1 = p.stdout.decode('ascii').splitlines()[0] if out1 != "Not connected.": - #check if the board has ip in the wlan0 interface + # check if the board has ip in the wlan0 interface p = sh.ifconfig("wlan0") if p.exit_code == 0: - result = re.search("inet addr:(?!127\.0{1,3}\.0{1,3}\.0{0,2}1$)((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)", - p.stdout) + result = re.search( + 'inet addr:(?!127\.0{1,3}\.0{1,3}\.0{0,2}1$)((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)', + p.stdout.decode('ascii')) if result: # execute iperf command against the server if self.__bind is None: @@ -69,7 +70,7 @@ class Qwifi(unittest.TestCase): bwreal = b[0] # check if BW is in the expected range - self.failUnless(float(bwreal) > float(self.__OKBW) * 0.9, + self.failUnless(float(bwreal) > float(self.__bwexpected) * 0.9, "failed: speed is lower than spected. Speed(MB/s)" + str(bwreal)) else: self.fail("failed: could not complete iperf command") |