summaryrefslogtreecommitdiff
path: root/scripts/PYTHON_SOFTWARE/test/tests
diff options
context:
space:
mode:
authorManel Caro <mcaro@iseebcn.com>2019-03-09 21:25:56 +0100
committerManel Caro <mcaro@iseebcn.com>2019-03-09 21:25:56 +0100
commit9332c933fc05f42882640c9a4e35fab09854af84 (patch)
tree2b9b00b5a411b27f9705603c0d93b8925afd4677 /scripts/PYTHON_SOFTWARE/test/tests
downloadboard-9332c933fc05f42882640c9a4e35fab09854af84.zip
board-9332c933fc05f42882640c9a4e35fab09854af84.tar.gz
board-9332c933fc05f42882640c9a4e35fab09854af84.tar.bz2
Board: Client Test Suite Initial Commit
Diffstat (limited to 'scripts/PYTHON_SOFTWARE/test/tests')
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/__init__.py0
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/__pycache__/__init__.cpython-35.pycbin0 -> 144 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/__pycache__/dmesg.cpython-35.pycbin0 -> 3359 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qaudio.cpython-35.pycbin0 -> 1750 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qbutton.cpython-35.pycbin0 -> 1962 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qduplex_ser.cpython-35.pycbin0 -> 1799 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qeeprom.cpython-35.pycbin0 -> 1623 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qethernet.cpython-35.pycbin0 -> 2122 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qi2c.cpython-35.pycbin0 -> 1548 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qiperf.cpython-35.pycbin0 -> 1746 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qram.cpython-35.pycbin0 -> 1372 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qrtc.cpython-35.pycbin0 -> 1317 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qscreen.cpython-35.pycbin0 -> 1165 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qserial.cpython-35.pycbin0 -> 1473 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qusb.cpython-35.pycbin0 -> 2068 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qwifi.cpython-35.pycbin0 -> 1299 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/qamp.py86
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/qaudio.py44
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/qbutton.py51
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/qduplex_ser.py46
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/qeeprom.py38
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/qethernet.py57
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/qflash.py74
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/qi2c.py29
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/qiperf.py53
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/qram.py22
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/qrtc.py28
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/qscreen.py36
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/qserial.py30
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/qtemplate.py51
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/qusb.py60
-rw-r--r--scripts/PYTHON_SOFTWARE/test/tests/qwifi.py44
32 files changed, 749 insertions, 0 deletions
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/__init__.py b/scripts/PYTHON_SOFTWARE/test/tests/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/__init__.py
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/__init__.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/__init__.cpython-35.pyc
new file mode 100644
index 0000000..8ec8ff0
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/__init__.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/dmesg.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/dmesg.cpython-35.pyc
new file mode 100644
index 0000000..9375d62
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/dmesg.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qaudio.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qaudio.cpython-35.pyc
new file mode 100644
index 0000000..930961a
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qaudio.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qbutton.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qbutton.cpython-35.pyc
new file mode 100644
index 0000000..fb10f23
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qbutton.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qduplex_ser.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qduplex_ser.cpython-35.pyc
new file mode 100644
index 0000000..0cbd3af
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qduplex_ser.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qeeprom.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qeeprom.cpython-35.pyc
new file mode 100644
index 0000000..7a3a5c5
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qeeprom.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qethernet.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qethernet.cpython-35.pyc
new file mode 100644
index 0000000..0c7570c
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qethernet.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qi2c.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qi2c.cpython-35.pyc
new file mode 100644
index 0000000..2fdf24d
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qi2c.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qiperf.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qiperf.cpython-35.pyc
new file mode 100644
index 0000000..b5ac915
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qiperf.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qram.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qram.cpython-35.pyc
new file mode 100644
index 0000000..6e68601
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qram.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qrtc.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qrtc.cpython-35.pyc
new file mode 100644
index 0000000..81badbb
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qrtc.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qscreen.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qscreen.cpython-35.pyc
new file mode 100644
index 0000000..cc3a852
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qscreen.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qserial.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qserial.cpython-35.pyc
new file mode 100644
index 0000000..d4494a8
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qserial.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qusb.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qusb.cpython-35.pyc
new file mode 100644
index 0000000..8f1ec80
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qusb.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qwifi.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qwifi.cpython-35.pyc
new file mode 100644
index 0000000..f894b13
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/__pycache__/qwifi.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/qamp.py b/scripts/PYTHON_SOFTWARE/test/tests/qamp.py
new file mode 100644
index 0000000..58f4daf
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/qamp.py
@@ -0,0 +1,86 @@
+from test.helpers.syscmd import SysCommand
+import unittest
+import serial
+import time
+
+class Qamp(unittest.TestCase):
+
+ def __init__(self, testname, testfunc, undercurrent=0.1, overcurrent=2):
+ self._current = 0.0
+ self._undercurrent=undercurrent
+ self._overcurrent = overcurrent
+ self._vshuntfactor=16384.0
+ self._ser = serial.Serial()
+ self._ser.port = '/dev/ttyUSB0'
+ self._ser.baudrate = 115200
+ self._ser.parity = serial.PARITY_NONE
+ self._ser.timeout = 0
+ self._ser.writeTimout = 0
+ self._ser.xonxoff = False
+ self._ser.rtscts = False
+ self._ser.dsrdtr = False
+ super(Qamp, self).__init__(testfunc)
+ self._testMethodDoc = testname
+
+ def __del__(self):
+ self._ser.close()
+
+ def execute(self):
+ # Open Serial port ttyUSB0
+ error=0
+ try:
+ self._ser.open()
+ except:
+ self.fail("failed: IMPOSSIBLE OPEN USB-SERIAL PORT ( {} )".format(self._ser.port))
+ error=1
+ return -1
+ if error==0:
+ # Clean input and output buffer of serial port
+ self._ser.flushInput()
+ self._ser.flushOutput()
+ # Send command to read Voltage at Shunt resistor
+ # Prepare cmd
+ cmd = ('at\n\r')
+ i=0
+ while (i < len(cmd)):
+ i = i + self._ser.write(cmd[i].encode('ascii'))
+ time.sleep(0.05)
+ self._ser.read(1)
+ res0 = []
+ while (self._ser.inWaiting() > 0): # if incoming bytes are waiting to be read from the serial input buffer
+ res0.append(self._ser.read(1).decode('ascii')) # read the bytes and convert from binary array to ASCII
+ print(res0)
+ #CHECK COM FIRST
+ cmd = ('at+in?\n\r')
+ i = 0
+
+ # Write, 1 by 1 byte at a time to avoid hanging of serial receiver code of listener, emphasis being made at sleep of 50 ms.
+ while (i < len(cmd)):
+ i = i + self._ser.write(cmd[i].encode('ascii'))
+ time.sleep(0.05)
+ self._ser.read(1)
+
+ # Read, 1 by 1 byte
+ res = []
+ while (self._ser.inWaiting() > 0): # if incoming bytes are waiting to be read from the serial input buffer
+ res.append(self._ser.read(1).decode('ascii')) # read the bytes and convert from binary array to ASCII
+
+ string = ''.join(res)
+ string = string.replace('\n', '')
+ try:
+ self._current = float(int(string, 0)) / self._vshuntfactor
+ except:
+ self.fail("failed: CAN'T READ CONSUMPTION (CURRENT=0?)")
+ error=1
+ return -1
+ if error==0:
+ print(self._current)
+ # In order to give a valid result it is importarnt to define an under current value
+ if (self._current > float(self._overcurrent)):
+ self.fail("failed: OVERCURRENT DETECTED ( {} )".format(self._current))
+ return -1
+
+ if (self._current < float(self._undercurrent)):
+ self.fail("failed: UNDERCURRENT DETECTED ( {} )".format(self._current))
+ return -1
+
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/qaudio.py b/scripts/PYTHON_SOFTWARE/test/tests/qaudio.py
new file mode 100644
index 0000000..b262c2d
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/qaudio.py
@@ -0,0 +1,44 @@
+from test.helpers.syscmd import SysCommand
+import unittest
+#class name
+class Qaudio(unittest.TestCase):
+ # Initialize the variables
+
+ def __init__(self, testname, testfunc, dtmfFile):
+ # Doing this we will initialize the class and later on perform a particular method inside this class
+ super(Qaudio, self).__init__(testfunc)
+ self._testMethodDoc = testname
+ self._dtmfFile=dtmfFile
+ self.__sum=0
+ self.__refSum = 25 # 1+3+5+7+9
+
+ def execute(self):
+ str_cmd = "amixer -c 0 sset 'PCM' 100 2> /dev/null" # .format(self.__dtmfFile)
+ #Some cases de volume level is not enough to the tes. It needs to be increased
+ volume_up = SysCommand("volume_up", str_cmd)
+ if volume_up.execute() == 0:
+ str_cmd = "aplay test/files/dtmf-13579.wav 2> /dev/null & arecord -r 8000 -d 1 recorded.wav 2> /dev/null" #.format(self.__dtmfFile)
+ audio_loop = SysCommand("audio_loop", str_cmd)
+ if audio_loop.execute() == 0:
+ lines = audio_loop.getOutput().splitlines()
+ str_cmd = "multimon -t wav -a DTMF recorded.wav -q 2> /dev/null"
+ dtmf_decoder = SysCommand("dtmf_decoder", str_cmd)
+ if dtmf_decoder.execute() == 0:
+ self.__raw_out = dtmf_decoder.getOutput()
+ if self.__raw_out == "":
+ return -1
+ lines = dtmf_decoder.getOutput().splitlines()
+ for i in range(0, 5):
+ aux=[int(s) for s in lines[i].split() if s.isdigit()]
+ self.__sum=self.__sum+aux[0]
+ self.failUnless(self.__sum == self.__refSum), "failed: incorrect dtmf code" + str(self.__sum)
+ else:
+ self.fail("failed: fail reading recorded file")
+ return -1
+ else:
+ self.fail("failed: fail playing/recording file")
+ return -1
+ else:
+ self.fail("failed: could not increase loud level")
+ return -1
+ return 0
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/qbutton.py b/scripts/PYTHON_SOFTWARE/test/tests/qbutton.py
new file mode 100644
index 0000000..1fb204a
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/qbutton.py
@@ -0,0 +1,51 @@
+from test.helpers.syscmd import SysCommand
+import unittest
+import uuid
+import time
+
+class Qbutton(unittest.TestCase):
+
+ def __init__(self, testname, testfunc, gpio):
+ if 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
+ 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 < 20:
+ 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 = 20
+ time.sleep(0.5)
+ timeout = timeout + 1
+ if timeout==20 and int(button_value[1]) == 0:
+ self.fail("failed: timeout exceeded")
+ else:
+ timeout = 20
+ 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/scripts/PYTHON_SOFTWARE/test/tests/qduplex_ser.py b/scripts/PYTHON_SOFTWARE/test/tests/qduplex_ser.py
new file mode 100644
index 0000000..98bda81
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/qduplex_ser.py
@@ -0,0 +1,46 @@
+from test.helpers.syscmd import SysCommand
+import unittest
+import uuid
+import serial
+import time
+
+class Qduplex(unittest.TestCase):
+
+ def __init__(self, testname, testfunc, port1, port2, baudrate):
+ super(Qduplex, self).__init__(testfunc)
+ self.__port1 = port1
+ self.__serial1 = serial.Serial(self.__port1, timeout=1)
+ self.__serial1.baudrate = baudrate
+
+ self.__port2 = port2
+ self.__serial2 = serial.Serial(self.__port2, timeout=1)
+ self.__serial2.baudrate = baudrate
+ self._testMethodDoc = testname
+
+ def __del__(self):
+ self.__serial1.close()
+ self.__serial2.close()
+
+ def execute(self):
+ self.__serial1.flushInput()
+ self.__serial1.flushOutput()
+ self.__serial2.flushInput()
+ self.__serial2.flushOutput()
+ test_uuid = str(uuid.uuid4()).encode()
+ self.__serial1.write(test_uuid)
+ time.sleep(0.05) # there might be a small delay
+ if self.__serial2.inWaiting() == 0:
+ self.fail("failed: PORT {} wait timeout exceded, wrong communication?".format(self.__port2))
+ else:
+ if (self.__serial2.readline() != test_uuid):
+ self.fail("failed: PORT {} write/read mismatch".format(self.__port2))
+
+ test_uuid = str(uuid.uuid4()).encode()
+ self.__serial2.write(test_uuid)
+ time.sleep(0.05) # there might be a small delay
+ if self.__serial1.inWaiting() == 0:
+ self.fail("failed: PORT {} wait timeout exceded, wrong communication?".format(self.__port1))
+ else:
+ if (self.__serial1.readline() != test_uuid):
+ self.fail("failed: PORT {} write/read mismatch".format(self.__port1))
+
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/qeeprom.py b/scripts/PYTHON_SOFTWARE/test/tests/qeeprom.py
new file mode 100644
index 0000000..f72f78f
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/qeeprom.py
@@ -0,0 +1,38 @@
+from test.helpers.syscmd import SysCommand
+import unittest
+import uuid
+
+class Qeeprom(unittest.TestCase):
+
+ def __init__(self, testname, testfunc):
+ super(Qeeprom, self).__init__(testfunc)
+ self._testMethodDoc = testname
+
+ def execute(self):
+ str_cmd = "find /sys/ -iname 'eeprom'"
+ eeprom_location = SysCommand("eeprom_location", str_cmd)
+ if eeprom_location.execute() == 0:
+ self.__raw_out = eeprom_location.getOutput()
+ if self.__raw_out == "":
+ self.fail("Unable to get EEPROM location. IS EEPROM CONNECTED?")
+ return -1
+ eeprom=self.__raw_out.decode('ascii')
+ test_uuid = uuid.uuid4()
+ str_cmd="echo '{}' > {}".format(str(test_uuid), eeprom)
+ eeprom_write = SysCommand("eeprom_write", str_cmd)
+ if eeprom_write.execute() == 0:
+ self.__raw_out = eeprom_write.getOutput()
+ if self.__raw_out == "":
+ self.fail("Unable to write on the EEPROM?")
+ return -1
+ str_cmd = "head -2 {}".format(eeprom)
+ eeprom_read = SysCommand("eeprom_read", str_cmd)
+ if eeprom_read.execute() == 0:
+ self.__raw_out = eeprom_read.getOutput()
+ if self.__raw_out == "":
+ self.fail("Unable to read from the EEPROM?")
+ return -1
+ if(str(self.__raw_out).find(str(test_uuid)) == -1):
+ self.fail("failed: READ/WRITE mismatch")
+ else:
+ self.fail("failed: could not complete find eeprom command")
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/qethernet.py b/scripts/PYTHON_SOFTWARE/test/tests/qethernet.py
new file mode 100644
index 0000000..2ac447c
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/qethernet.py
@@ -0,0 +1,57 @@
+from test.helpers.syscmd import SysCommand
+import unittest
+
+
+class Qethernet(unittest.TestCase):
+ __sip = None
+ __raw_out = None
+ __MB_req = None
+ __MB_real = None
+ __BW_real = None
+ __dat_list = None
+ __bind = None
+ __OKBW = None
+
+ def __init__(self, testname, testfunc, sip = None, OKBW=100, bind=None):
+ super(Qethernet, self).__init__(testfunc)
+ if sip is not None:
+ self.__sip = sip
+ if sip is not None:
+ self.__bind = bind
+ self.__MB_req = '10'
+ self.__OKBW=OKBW
+ self._testMethodDoc = testname
+
+ def execute(self):
+ print
+ if self.__bind is None:
+ str_cmd = "iperf -c {} -x CMSV -n {}M".format(self.__sip, self.__MB_req)
+ else:
+ str_cmd = "iperf -c {} -x CMSV -n {}M -B {}".format(self.__sip, self.__MB_req, self.__bind)
+ iperf_command = SysCommand("iperf", str_cmd)
+ if iperf_command.execute() == 0:
+ self.__raw_out = iperf_command.getOutput()
+ if self.__raw_out == "":
+ return -1
+ lines = iperf_command.getOutput().splitlines()
+ dat = lines[1]
+ dat = dat.decode('ascii')
+ dat_list = dat.split( )
+ for d in dat_list:
+ a = dat_list.pop(0)
+ if a == "sec":
+ break
+ self.__MB_real = dat_list[0]
+ self.__BW_real = dat_list[2]
+ self.__dat_list = dat_list
+ #print(self.__MB_real)
+ #print(self.__BW_real)
+ self.failUnless(float(self.__BW_real)>float(self.__OKBW)*0.9,"failed: speed is lower than spected. Speed(MB/s)" + str(self.__BW_real))
+ else:
+ self.fail("failed: could not complete iperf command")
+
+ def get_Total_MB(self):
+ return self.__MB_real;
+
+ def get_Total_BW(self):
+ return self.__MB_real;
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/qflash.py b/scripts/PYTHON_SOFTWARE/test/tests/qflash.py
new file mode 100644
index 0000000..660e1c0
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/qflash.py
@@ -0,0 +1,74 @@
+from test.helpers.syscmd import SysCommand
+import unittest
+from test.helpers.globalVariables import globalVar
+
+class Qflasher(unittest.TestCase):
+
+ def __init__(self, testname, testfunc):
+ super(Qflasher, self).__init__(testfunc)
+ self._testMethodDoc = testname
+ model=globalVar.g_mid
+ if model.find("IGEP0046") == 0:
+ self._flash_method = "mx6"
+ self._binlocation="/boot/"
+ elif model.find("IGEP0034") == 0:
+ self._flash_method = "nandti"
+ self._binlocation = "/boot/"
+ elif model.find("SOPA") == 0:
+ self._flash_method = "sopaflash"
+ elif model.find("OMAP3") == 0:
+ self._flash_method = "nandti"
+ self._binlocation = "/boot/"
+ elif model.find("OMAP5") == 0:
+ self._flash_method = "nandti"
+ self._binlocation = "/boot/"
+
+
+ def execute(self):
+ # CASE eMMC boards.
+ if(self._flash_method == "mx6"):
+ str_cmd= "dd if={}u-boot.imx of=/dev/mmcblk2 bs=512 seek=2 2>&1 >/dev/null".format(self._binlocation)
+ flash_command = SysCommand("flash_command", str_cmd)
+ if flash_command.execute() == 0:
+ str_cmd = "sync"
+ sync_command = SysCommand("sync_command", str_cmd)
+ if sync_command.execute() != 0:
+ self.fail("failed: could not sync")
+ else:
+ self.fail("failed: could not complete flash eMMC commands")
+ # CASE of nandflash boards
+ elif(self._flash_method == "nandti"):
+ str_cmd = "nandwrite -p -s 0x0 /dev/mtd0 {}u-boot.img 2>&1 >/dev/null; " \
+ "nandwrite -p -s 0x20000 /dev/mtd0 {}u-boot.img 2>&1 >/dev/null; " \
+ "nandwrite -p -s 0x40000 /dev/mtd0 {}u-boot.img 2>&1 >/dev/null; " \
+ "nandwrite -p -s 0x60000 /dev/mtd0 {}u-boot.img 2>&1 >/dev/null; " \
+ "".format(self._binlocation, self._binlocation, self._binlocation, self._binlocation,)
+ flash_MLO_command = SysCommand("flash_MLO_command", str_cmd)
+ if flash_MLO_command.execute() == 0:
+ str_cmd= "nandwrite -p /dev/mtd1 {}u-boot.img 2>&1 >/dev/null".format(self._binlocation)
+ flash_uBoot_command = SysCommand("flash_command", str_cmd)
+ if flash_uBoot_command.execute() == 0:
+ str_cmd = "sync"
+ sync_command = SysCommand("sync_command", str_cmd)
+ if sync_command.execute() != 0:
+ self.fail("failed: could not sync")
+ else:
+ self.fail("failed: could not complete flash u-boot commnds")
+ else:
+ self.fail("failed: could not complete flash MLO commnd")
+
+
+ # CASE of SOPA0000 BOARD. FULL FLASH (u-boot+kernel+rootfs)
+ elif (self._flash_method == "sopaflash"):
+ str_cmd = "nandtest /dev/mtd0 >/dev/null"
+ flash_command = SysCommand("flash_command", str_cmd)
+ if flash_command.execute() == 0:
+ str_cmd = "/usr/bin/igep-flash --skip-nandtest --image /opt/firmware/demo-ti-image-*-*.tar* >/dev/null 2>&1"
+ sync_command = SysCommand("sync_command", str_cmd)
+ if sync_command.execute() != 0:
+ self.fail("failed: could not complete flashing procces")
+ else:
+ self.fail("failed: could not complete nandtest mtd0")
+
+ else:
+ self.fail("failed: could not find flash method") \ No newline at end of file
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/qi2c.py b/scripts/PYTHON_SOFTWARE/test/tests/qi2c.py
new file mode 100644
index 0000000..409005c
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/qi2c.py
@@ -0,0 +1,29 @@
+from test.helpers.syscmd import SysCommand
+import unittest
+
+class Qi2c(unittest.TestCase):
+
+ def __init__(self, testname, testfunc, busnum, register):
+ super(Qi2c, self).__init__(testfunc)
+ self.__busnum = busnum
+ self.__register = register.split("/")
+ self.__devices=[]
+ self._testMethodDoc = testname
+
+ def execute(self):
+ str_cmd= "i2cdetect -a -y -r {}".format(self.__busnum)
+ i2c_command = SysCommand("i2cdetect", str_cmd)
+ if i2c_command.execute() == 0:
+ self.__raw_out = i2c_command.getOutput()
+ if self.__raw_out == "":
+ return -1
+ lines=self.__raw_out.decode('ascii').splitlines()
+ for i in range(len(lines)):
+ if (lines[i].count('UU')):
+ if (lines[i].find("UU")):
+ self.__devices.append("0x{}{}".format((i - 1), hex(int((lines[i].find("UU") - 4) / 3)).split('x')[-1]))
+ for i in range(len(self.__register)):
+ if not(self.__register[i] in self.__devices):
+ self.fail("failed: device {} not found in bus i2c-{}".format(self.__register[i], self.__busnum))
+ else:
+ self.fail("failed: could not complete i2cdedtect command")
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/qiperf.py b/scripts/PYTHON_SOFTWARE/test/tests/qiperf.py
new file mode 100644
index 0000000..126b6ee
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/qiperf.py
@@ -0,0 +1,53 @@
+from test.helpers.syscmd import SysCommand
+
+
+class QIperf(object):
+ __sip = None
+ __raw_out = None
+ __MB_req = None
+ __MB_real = None
+ __BW_real = None
+ __dat_list = None
+ __bind = None
+
+ def __init__(self, sip = None):
+ if sip is not None:
+ self.__sip = sip
+ self.__MB_req = '10'
+
+ def execute(self, sip = None, bind = None):
+ if sip is not None:
+ self.__sip = sip
+
+ if bind is None:
+ str_cmd = "iperf -c {} -x CMSV -n {}M".format(self.__sip, self.__MB_req)
+ else:
+ self.__bind = bind
+ str_cmd = "iperf -c {} -x CMSV -n {}M -B {}".format(self.__sip, self.__MB_req, self.__bind)
+ t = SysCommand("iperf", str_cmd)
+ if t.execute() == 0:
+ self.__raw_out = t.getOutput()
+ if self.__raw_out == "":
+ return -1
+ lines = t.getOutput().splitlines()
+ dat = lines[1]
+ dat = dat.decode('ascii')
+ dat_list = dat.split( )
+ for d in dat_list:
+ a = dat_list.pop(0)
+ if a == "sec":
+ break
+ self.__MB_real = dat_list[0]
+ self.__BW_real = dat_list[2]
+ self.__dat_list = dat_list
+ print(self.__MB_real)
+ print(self.__BW_real)
+ else:
+ return -1
+ return 0
+
+ def get_Total_MB(self):
+ return self.__MB_real;
+
+ def get_Total_BW(self):
+ return self.__MB_real;
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/qram.py b/scripts/PYTHON_SOFTWARE/test/tests/qram.py
new file mode 100644
index 0000000..8ec0210
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/qram.py
@@ -0,0 +1,22 @@
+from test.helpers.syscmd import SysCommand
+import unittest
+
+class Qram(unittest.TestCase):
+
+ def __init__(self, testname, testfunc, memSize):
+ super(Qram, self).__init__(testfunc)
+ self.__memSize = memSize
+ self._testMethodDoc = testname
+
+ def execute(self):
+ str_cmd= "free -m"
+ free_command = SysCommand("free_ram", str_cmd)
+ if free_command.execute() == 0:
+ self.__raw_out = free_command.getOutput()
+ if self.__raw_out == "":
+ return -1
+ lines = free_command.getOutput().splitlines()
+ aux = [int(s) for s in lines[1].split() if s.isdigit()]
+ self.failUnless(int(aux[0])>int(self.__memSize),"failed: total ram memory size lower than expected")
+ else:
+ self.fail("failed: could not complete iperf command")
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/qrtc.py b/scripts/PYTHON_SOFTWARE/test/tests/qrtc.py
new file mode 100644
index 0000000..1d02f78
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/qrtc.py
@@ -0,0 +1,28 @@
+from test.helpers.syscmd import SysCommand
+import unittest
+import time
+
+class Qrtc(unittest.TestCase):
+
+ def __init__(self, testname, testfunc, rtc):
+ super(Qrtc, self).__init__(testfunc)
+ self.__rtc = rtc
+ self._testMethodDoc = testname
+
+ def execute(self):
+ str_cmd = "hwclock -f {}".format(self.__rtc)
+ rtc_set = SysCommand("rtc_set", str_cmd)
+ if rtc_set.execute() == 0:
+ curr_hour = rtc_set.getOutput().decode('ascii').split(" ")
+ time1 = int((curr_hour[4].split(":"))[2])
+ time.sleep(1)
+ if rtc_set.execute() == 0:
+ curr_hour = rtc_set.getOutput().decode('ascii').split(" ")
+ time2 = int((curr_hour[4].split(":"))[2])
+ if time1==time2:
+ self.fail("failed: RTC is not running")
+ else:
+ self.fail("failed: couldn't execute hwclock command 2nd time")
+ else:
+ self.fail("failed: couldn't execute hwclock command")
+
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/qscreen.py b/scripts/PYTHON_SOFTWARE/test/tests/qscreen.py
new file mode 100644
index 0000000..3beff83
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/qscreen.py
@@ -0,0 +1,36 @@
+from test.helpers.syscmd import SysCommand
+import unittest
+import time
+from test.helpers.cv_display_test import pattern_detect
+
+class Qscreen(unittest.TestCase):
+
+ def __init__(self, testname, testfunc, display):
+ super(Qscreen, self).__init__(testfunc)
+ self.__display = display
+ self._testMethodDoc = testname
+
+ def execute(self):
+ str_cmd = "fbi -T 1 --noverbose -d /dev/{} test/files/test_pattern.png 2> /dev/null".format(self.__display)
+ display_image = SysCommand("display_image", str_cmd)
+ if display_image.execute() == 0:
+ str_cmd = "ls /dev/v4l/by-id/usb-Creative_Technology*"
+ camera_check = SysCommand("camera_check", str_cmd)
+ if camera_check.execute() == 0:
+ test_screen = pattern_detect(1)
+ if not test_screen=="0":
+ self.fail("failed: {}".format(test_screen))
+ str_cmd= "fbi -T 1 /home/root/result_hdmi_img.jpg -d /dev/fb0 --noverbose -a"
+ show_img = SysCommand("show-image", str_cmd)
+ show_img.execute()
+ else:
+ self.fail("failed: camera not found. USB PROBLEM??")
+ else:
+ self.fail("failed: could not display the image")
+ try:
+ str_cmd= "fbi -T 1 /home/root/result_hdmi_img.jpg -d /dev/fb0 --noverbose -a"
+ show_img = SysCommand("show-image", str_cmd)
+ show_img.execute()
+ except ValueError:
+ print("COULD NOT DISPLAY IMAGE")
+
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/qserial.py b/scripts/PYTHON_SOFTWARE/test/tests/qserial.py
new file mode 100644
index 0000000..43ba3c8
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/qserial.py
@@ -0,0 +1,30 @@
+from test.helpers.syscmd import SysCommand
+import unittest
+import uuid
+import serial
+import time
+
+class Qserial(unittest.TestCase):
+
+ def __init__(self, testname, testfunc, port, baudrate):
+ super(Qserial, self).__init__(testfunc)
+ self.__port = port
+ self.__serial = serial.Serial(self.__port, timeout=1)
+ self.__serial.baudrate = baudrate
+ self._testMethodDoc = testname
+
+ def __del__(self):
+ self.__serial.close()
+
+ def execute(self):
+ self.__serial.flushInput()
+ self.__serial.flushOutput()
+ test_uuid = str(uuid.uuid4()).encode()
+ self.__serial.write(test_uuid)
+ time.sleep(0.05) # there might be a small delay
+ if self.__serial.inWaiting() == 0:
+ self.fail("failed: PORT {} wait timeout exceded, wrong communication?".format(self.__port))
+ else:
+ if (self.__serial.readline() != test_uuid):
+ self.fail("failed: PORT {} write/read mismatch".format(self.__port))
+
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/qtemplate.py b/scripts/PYTHON_SOFTWARE/test/tests/qtemplate.py
new file mode 100644
index 0000000..940cded
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/qtemplate.py
@@ -0,0 +1,51 @@
+#IF COMMAND IS NEEDED
+from test.helpers.syscmd import SysCommand
+import unittest
+#class name
+class Qtemplate(unittest.TestCase):
+ # Initialize the variables
+ __variable1 = "Value-a"
+ __variable2 = "Value-b"
+ #....
+ __variablen = "Value-n"
+
+ def __init__(self, testname, testfunc, input1=None, inputn=None):
+ # Doing this we will initialize the class and later on perform a particular method inside this class
+ super(Qtemplate, self).__init__(testfunc)
+ self.__testname = testname
+ self.__input1 = input1
+ self.__inputn = inputn
+ self._testMethodDoc = testname
+
+
+
+ def execute(self):
+ str_cmd = "command"
+ t = SysCommand("command-name", str_cmd)
+ if t.execute() == 0:
+ self.__raw_out = t.getOutput()
+ if self.__raw_out == "":
+ return -1
+ lines = t.getOutput().splitlines()
+ dat = lines[1]
+ dat = dat.decode('ascii')
+ dat_list = dat.split( )
+ for d in dat_list:
+ a = dat_list.pop(0)
+ if a == "sec":
+ break
+ self.__MB_real = dat_list[0]
+ self.__BW_real = dat_list[2]
+ self.__dat_list = dat_list
+ print(self.__MB_real)
+ print(self.__BW_real)
+ self.failUnless(int(self.__BW_real)>int(self.__OKBW)*0.9,"FAIL:BECAUSE...")
+ else:
+ return -1
+ return 0
+
+ def get_Total_MB(self):
+ return self.__MB_real;
+
+ def get_Total_BW(self):
+ return self.__MB_real;
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/qusb.py b/scripts/PYTHON_SOFTWARE/test/tests/qusb.py
new file mode 100644
index 0000000..44490bc
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/qusb.py
@@ -0,0 +1,60 @@
+from test.helpers.syscmd import SysCommand
+import unittest
+
+class Qusb(unittest.TestCase):
+
+ def __init__(self, testname, testfunc, devLabel, numPorts):
+ super(Qusb, self).__init__(testfunc)
+ self.__numPorts = numPorts
+ self._testMethodDoc = testname
+ self.__devLabel = devLabel
+ if testname=="USBOTG":
+ self.__usbFileName = "/this_is_an_usb_otg"
+ self.__usbtext = "USBOTG"
+ elif testname=="SATA":
+ self.__usbFileName = "/this_is_a_sata"
+ self.__usbtext = "SATA"
+ else:
+ self.__usbFileName = "/this_is_an_usb_host"
+ self.__usbtext = "USBHOST"
+ self.__numUsbFail=[]
+
+ def execute(self):
+ str_cmd= "lsblk -o LABEL"
+ lsblk_command = SysCommand("lsblk", str_cmd)
+ if lsblk_command.execute() == 0:
+ self.__raw_out = lsblk_command.getOutput()
+ if self.__raw_out == "":
+ return -1
+ lines = lsblk_command.getOutput().splitlines()
+ host_list=[]
+ for i in range(len(lines)):
+ if str(lines[i].decode('ascii'))==self.__devLabel:
+ host_list.append(i)
+ if len(host_list)==int(self.__numPorts):
+ str_cmd = "lsblk -o MOUNTPOINT"
+ lsblk_command = SysCommand("lsblk", str_cmd)
+ if lsblk_command.execute() == 0:
+ self.__raw_out = lsblk_command.getOutput()
+ if self.__raw_out == "":
+ print("failed: no command output")
+ self.fail("failed: no command output")
+ else:
+ lines = lsblk_command.getOutput().splitlines()
+ for i in range(len(host_list)):
+ file_path=str(lines[host_list[i]].decode('ascii')) + self.__usbFileName
+ usb_file = open(file_path, 'r')
+ read=usb_file.read()
+ if read.find(self.__usbtext)!=-1:
+ print(file_path + " --> OK!")
+ else:
+ self.fail("failed: could not read from usb {}".format(lines[host_list[i]].decode('ascii')))
+ self.__numUsbFail.append(host_list[i])
+ usb_file.close()
+ else:
+ self.fail("failed: couldn't execute lsblk command")
+
+ else:
+ self.fail("failed: reference and real usb host devices number mismatch")
+ else:
+ self.fail("failed: couldn't execute lsblk command")
diff --git a/scripts/PYTHON_SOFTWARE/test/tests/qwifi.py b/scripts/PYTHON_SOFTWARE/test/tests/qwifi.py
new file mode 100644
index 0000000..8235937
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/tests/qwifi.py
@@ -0,0 +1,44 @@
+from test.helpers.syscmd import SysCommand
+import unittest
+import subprocess
+
+class Qwifi(unittest.TestCase):
+
+ def __init__(self, testname, testfunc, signal):
+ super(Qwifi, self).__init__(testfunc)
+ self.__signal = signal
+ self._testMethodDoc = testname
+ # WiFi SERVERIP fixed at the moment.
+ self._serverip = "192.168.5.1"
+
+ def execute(self):
+ # First check connection with the wifi server using ping command
+ #str_cmd = "ping -c 1 {} > /dev/null".format(self._serverip)
+ #wifi_ping = SysCommand("wifi_ping", str_cmd)
+ #wifi_ping.execute()
+ #res = subprocess.call(['ping', '-c', '1', self._serverip])
+ p = subprocess.Popen(['ping','-c','1',self._serverip,'-W','2'],stdout=subprocess.PIPE)
+ p.wait()
+ res=p.poll()
+ if res == 0:
+ str_cmd= "iw wlan0 link"
+ wifi_stats = SysCommand("wifi_stats", str_cmd)
+ if wifi_stats.execute() == 0:
+ w_stats = wifi_stats.getOutput().decode('ascii').splitlines()
+ #self._longMessage = str(self.__raw_out).replace("'", "")
+ if not w_stats[0] == "Not connected.":
+ signal_st = w_stats[5].split(" ")[1]
+ try:
+ int(signal_st)
+ if -1*int(signal_st) > int(self.__signal):
+ self.fail("failed: signal to server lower than expected")
+ except ValueError:
+ self.fail("failed: error output (Bad connection?)")
+ else:
+ self.fail("failed: error output (Bad connection?)")
+ #tx_brate = float(w_stats[6].split(" ")[2])
+ else:
+ self.fail("failed: couldn't execute iw command")
+ else:
+ self.fail("failed: ping to server {}".format(self._serverip))
+