summaryrefslogtreecommitdiff
path: root/scripts/PYTHON_SOFTWARE/test
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/PYTHON_SOFTWARE/test')
-rw-r--r--scripts/PYTHON_SOFTWARE/test/__init__.py0
-rw-r--r--scripts/PYTHON_SOFTWARE/test/__init__.pycbin0 -> 114 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/__pycache__/__init__.cpython-35.pycbin0 -> 138 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/files/dtmf-13579.wavbin0 -> 8045 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/files/test_pattern.pngbin0 -> 4457 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/helpers/__init__.py0
-rw-r--r--scripts/PYTHON_SOFTWARE/test/helpers/__init__.pycbin0 -> 122 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/__init__.cpython-35.pycbin0 -> 118 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/cv_display_test.cpython-35.pycbin0 -> 3246 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/get_dieid.cpython-35.pycbin0 -> 1496 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/globalVariables.cpython-35.pycbin0 -> 345 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/psqldb.cpython-35.pycbin0 -> 1939 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/setup_xml.cpython-35.pycbin0 -> 1481 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/syscmd.cpython-35.pycbin0 -> 3694 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/testsrv_db.cpython-35.pycbin0 -> 5230 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/helpers/button_script.sh4
-rw-r--r--scripts/PYTHON_SOFTWARE/test/helpers/cv_display_test.py147
-rw-r--r--scripts/PYTHON_SOFTWARE/test/helpers/get_dieid.py41
-rw-r--r--scripts/PYTHON_SOFTWARE/test/helpers/globalVariables.py8
-rw-r--r--scripts/PYTHON_SOFTWARE/test/helpers/globalVariables.pycbin0 -> 375 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/helpers/psqldb.py55
-rw-r--r--scripts/PYTHON_SOFTWARE/test/helpers/setup_xml.py40
-rw-r--r--scripts/PYTHON_SOFTWARE/test/helpers/syscmd.py108
-rw-r--r--scripts/PYTHON_SOFTWARE/test/helpers/syscmd.pycbin0 -> 3984 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/helpers/testsrv_db.py162
-rw-r--r--scripts/PYTHON_SOFTWARE/test/helpers/uboot_flasher.py0
-rw-r--r--scripts/PYTHON_SOFTWARE/test/runners/__init__.py0
-rw-r--r--scripts/PYTHON_SOFTWARE/test/runners/__pycache__/__init__.cpython-35.pycbin0 -> 146 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/runners/__pycache__/simple.cpython-35.pycbin0 -> 3452 bytes
-rw-r--r--scripts/PYTHON_SOFTWARE/test/runners/simple.py98
-rw-r--r--scripts/PYTHON_SOFTWARE/test/suites/__init__.py0
-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
63 files changed, 1412 insertions, 0 deletions
diff --git a/scripts/PYTHON_SOFTWARE/test/__init__.py b/scripts/PYTHON_SOFTWARE/test/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/__init__.py
diff --git a/scripts/PYTHON_SOFTWARE/test/__init__.pyc b/scripts/PYTHON_SOFTWARE/test/__init__.pyc
new file mode 100644
index 0000000..cd50092
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/__init__.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/__pycache__/__init__.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/__pycache__/__init__.cpython-35.pyc
new file mode 100644
index 0000000..306b3b8
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/__pycache__/__init__.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/files/dtmf-13579.wav b/scripts/PYTHON_SOFTWARE/test/files/dtmf-13579.wav
new file mode 100644
index 0000000..1ca5b93
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/files/dtmf-13579.wav
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/files/test_pattern.png b/scripts/PYTHON_SOFTWARE/test/files/test_pattern.png
new file mode 100644
index 0000000..353aab5
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/files/test_pattern.png
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/helpers/__init__.py b/scripts/PYTHON_SOFTWARE/test/helpers/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/helpers/__init__.py
diff --git a/scripts/PYTHON_SOFTWARE/test/helpers/__init__.pyc b/scripts/PYTHON_SOFTWARE/test/helpers/__init__.pyc
new file mode 100644
index 0000000..7d1c907
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/helpers/__init__.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/__init__.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/__init__.cpython-35.pyc
new file mode 100644
index 0000000..5224618
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/__init__.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/cv_display_test.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/cv_display_test.cpython-35.pyc
new file mode 100644
index 0000000..5df3dbc
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/cv_display_test.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/get_dieid.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/get_dieid.cpython-35.pyc
new file mode 100644
index 0000000..d822bf3
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/get_dieid.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/globalVariables.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/globalVariables.cpython-35.pyc
new file mode 100644
index 0000000..75d4904
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/globalVariables.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/psqldb.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/psqldb.cpython-35.pyc
new file mode 100644
index 0000000..8f85c0c
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/psqldb.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/setup_xml.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/setup_xml.cpython-35.pyc
new file mode 100644
index 0000000..d1a3f94
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/setup_xml.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/syscmd.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/syscmd.cpython-35.pyc
new file mode 100644
index 0000000..77658c7
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/syscmd.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/testsrv_db.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/testsrv_db.cpython-35.pyc
new file mode 100644
index 0000000..2169783
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/helpers/__pycache__/testsrv_db.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/helpers/button_script.sh b/scripts/PYTHON_SOFTWARE/test/helpers/button_script.sh
new file mode 100644
index 0000000..6908f22
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/helpers/button_script.sh
@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+i2cset -f -y 1 0x2d 0x40 0x31
+i2cset -f -y 1 0x2d 0x50 0xff
+i2cget -f -y 1 0x2d 0x50
diff --git a/scripts/PYTHON_SOFTWARE/test/helpers/cv_display_test.py b/scripts/PYTHON_SOFTWARE/test/helpers/cv_display_test.py
new file mode 100644
index 0000000..7321667
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/helpers/cv_display_test.py
@@ -0,0 +1,147 @@
+import cv2
+import numpy as np
+import subprocess
+
+
+
+
+def adjust_gamma(image, gamma=1.0):
+ invGamma = 1.0 / gamma
+ table = np.array([((i / 255.0) ** invGamma) * 255
+ for i in np.arange(0, 256)]).astype("uint8")
+ return cv2.LUT(image, table)
+
+def pattern_detect(cam_device=0):
+
+ # RETURN 0 only if the test is ok
+ msg="0"
+ # Capture the corresponding camera device [0,1]
+ #capture = cv2.VideoCapture(0)
+ camid = subprocess.check_output("ls /dev/v4l/by-id/usb-Creative_Technology*", stderr=subprocess.STDOUT, shell=True)
+ camid = camid.decode('ascii').rstrip()
+ capture = cv2.VideoCapture(camid)
+ try:
+ _, image = capture.read()
+ except:
+ msg="Camera error"
+ print(msg)
+ return msg
+
+ # If the USB cam is not connected the capture image doesn't not have size atribbute
+ if not hasattr(image, 'shape'):
+ msg = "USB camera connection error"
+ print(msg)
+ return msg
+ else:
+ size_img=image.shape
+ # Create little squares of each color section
+ # The size of the suare will be 1/6 of the total Y size on the y axis
+ # and 1/25 of the total X size on the x axis
+ y1 = int(size_img[0] / 2 - size_img[0] / 12)
+ y2 = int(size_img[0] / 2 + size_img[0] / 12)
+
+ # Square for RED COLOR
+ xr1 = int(size_img[1] / 6 - size_img[1] / 25)
+ xr2 = int(size_img[1] / 6 + size_img[1] / 25)
+ red_cal = image[y1:y2, xr1:xr2]
+ # Square for GREEN COLOR
+ xg1 = int(size_img[1] / 2 - size_img[1] / 25)
+ xg2 = int(size_img[1] / 2 + size_img[1] / 25)
+ green_cal = image[y1:y2, xg1:xg2]
+ # Square for BLUE COLOR
+ xb1 = int(5 * size_img[1] / 6 - size_img[1] / 25)
+ xb2 = int(5 * size_img[1] / 6 + size_img[1] / 25)
+ blue_cal = image[y1:y2, xb1:xb2]
+ # Get the average color in the box as repeting the np.average funtion
+ # Average color for red
+ avg_color_per_row = np.average(red_cal, axis=0)
+ avg_color_rawr = np.average(avg_color_per_row, axis=0)
+ # Average color for green
+ avg_color_per_row = np.average(green_cal, axis=0)
+ avg_color_rawg = np.average(avg_color_per_row, axis=0)
+ # Average color for blue
+ avg_color_per_row = np.average(blue_cal, axis=0)
+ avg_color_rawb = np.average(avg_color_per_row, axis=0)
+
+ # In cas of the illumintion is not correct, it is performed a gamma filter in order to
+ # correct this illumination problem
+ # After testing the gamma factor correction is computed with the green color
+ # gamma = gamma_factor / blue+red into green part
+ # gamma factor = 50-100
+ #gamma = (100 / (avg_color_rawg[0] + avg_color_rawg[2] + 1))
+ gamma=1
+ # Adjust the image acording to this gamma value
+ adjusted = adjust_gamma(image, gamma=gamma)
+# adjusted=image
+ cv2.imwrite( "/home/root/result_hdmi_img.jpg", adjusted);
+ # Calculate again the average color using the gamma adjusted image
+ # Crop the gamma adjusted image for wach color section
+ red_cal = adjusted[y1:y2, xr1:xr2]
+ green_cal = adjusted[y1:y2, xg1:xg2]
+ blue_cal = adjusted[y1:y2, xb1:xb2]
+ # Calculate the average for the red
+ avg_color_per_row = np.average(red_cal, axis=0)
+ avg_color_red = np.average(avg_color_per_row, axis=0)
+ # Calculate the average for the green
+ avg_color_per_row = np.average(green_cal, axis=0)
+ avg_color_green = np.average(avg_color_per_row, axis=0)
+ # Calculate the average for the blue
+ avg_color_per_row = np.average(blue_cal, axis=0)
+ avg_color_blue = np.average(avg_color_per_row, axis=0)
+ # In order to count colour use the hsv conversion
+ hsv = cv2.cvtColor(adjusted, cv2.COLOR_BGR2HSV)
+ # Create a mask for each color, definig the upper and lower bound of each color in hsv space
+ # Create the blue mask with the bounds
+ lower_blue = np.array([100, 50, 50])
+ upper_blue = np.array([130, 255, 255])
+ mask_b = cv2.inRange(hsv, lower_blue, upper_blue)
+ # Create the green mask with the bounds
+ lower_green = np.array([50, 50, 50])
+ upper_green = np.array([80, 255, 255])
+ mask_g = cv2.inRange(hsv, lower_green, upper_green)
+ # Create the red mask with the bounds. In this case we use a composed mask, sum of two different
+ # group of bounds
+ # First red mask
+ lower_red = np.array([0, 50, 50])
+ upper_red = np.array([10, 255, 255])
+ mask0 = cv2.inRange(hsv, lower_red, upper_red)
+ # Second red mask
+ lower_red = np.array([170, 50, 50])
+ upper_red = np.array([180, 255, 255])
+ mask1 = cv2.inRange(hsv, lower_red, upper_red)
+ # compose both masks
+ mask_r = mask0 + mask1
+ # mask_r = cv2.inRange(hsv, lower_red, upper_red)
+ # Perform a morphological open to expand
+# kernel = np.ones((5, 5), np.uint8)
+# closing_r = cv2.morphologyEx(mask_r, cv2.MORPH_OPEN, kernel)
+# closing_b = cv2.morphologyEx(mask_b, cv2.MORPH_OPEN, kernel)
+# closing_g = cv2.morphologyEx(mask_g, cv2.MORPH_OPEN, kernel)
+ # Count the number of pixels that are not of the corresponding color (black)
+# count_r = cv2.countNonZero(closing_r)
+# count_b = cv2.countNonZero(closing_b)
+# count_g = cv2.countNonZero(closing_g)
+ #-----------
+ count_r = cv2.countNonZero(mask_r)
+ count_b = cv2.countNonZero(mask_b)
+ count_g = cv2.countNonZero(mask_g)
+ #-------
+ if (count_r < 5):
+ msg = "RED COUNT FAIL"
+ return msg
+ if (count_g < 5):
+ msg = "GREEN COUNT FAIL"
+ return msg
+ if (count_b < 5):
+ msg = "BLUE COUNT FAIL"
+ return msg
+ if (avg_color_red[2] < 150 or avg_color_rawr[2] < 200):
+ msg = "AVG RED COUNT FAIL"
+ return msg
+ if (avg_color_green[1] < 200 or avg_color_rawg[1] < 200):
+ msg = "AVG GREEN COUNT FAIL"
+ return msg
+ if (avg_color_blue[0] < 200 or avg_color_rawb[0] < 200):
+ msg = "AVG BLUE COUNT FAIL"
+ return msg
+ return msg
diff --git a/scripts/PYTHON_SOFTWARE/test/helpers/get_dieid.py b/scripts/PYTHON_SOFTWARE/test/helpers/get_dieid.py
new file mode 100644
index 0000000..029ddb5
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/helpers/get_dieid.py
@@ -0,0 +1,41 @@
+import mmap
+import os
+import struct
+MAP_MASK = mmap.PAGESIZE - 1
+WORD = 4
+def read(addr):
+ """ Read from any location in memory
+ Returns the readed value in hexadecimal format
+ Keyword arguments:
+ - addr: The memory address to be readed.
+ """
+ fd = os.open("/dev/mem", os.O_RDWR | os.O_SYNC)
+ # Map one page
+ mm = mmap.mmap(fd, mmap.PAGESIZE, mmap.MAP_SHARED, mmap.PROT_WRITE | mmap.PROT_READ, offset=addr & ~MAP_MASK)
+ mm.seek(addr & MAP_MASK)
+ retval = struct.unpack('I', mm.read(WORD))
+ mm.close()
+ os.close(fd)
+ return "%08X" % retval[0]
+
+def getRegisters(model):
+ if model.find("IGEP0046") == 0:
+ registers = [0x021BC420, 0x021BC410]
+ elif model.find("IGEP0034") == 0 or model.find("SOPA0000") == 0:
+ registers = [0x44e10630, 0x44e10634, 0x44e10638, 0x44e1063C]
+ elif model.find("OMAP3") == 0:
+ registers = [0x4830A224, 0x4830A220, 0x4830A21C, 0x4830A218]
+ elif model.find("OMAP5") == 0:
+ registers = [0x4A002210, 0x4A00220C, 0x4A002208, 0x4A002200]
+ return registers
+
+def genDieid(modelid):
+ registers=getRegisters(modelid)
+ id=""
+ for i in range(len(registers)):
+ id=id+(read(registers[i]))
+ return id
+
+#if __name__ == "__main__":
+ #registers = [0x021BC420, 0x021BC410]
+ #print(main(registers))
diff --git a/scripts/PYTHON_SOFTWARE/test/helpers/globalVariables.py b/scripts/PYTHON_SOFTWARE/test/helpers/globalVariables.py
new file mode 100644
index 0000000..6b89f4d
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/helpers/globalVariables.py
@@ -0,0 +1,8 @@
+def globalVar():
+ guuid = ""
+ procid = ""
+ mid = ""
+ testid_ctl = ""
+ g_mid = ""
+ outdata = "NONE"
+ station = ""
diff --git a/scripts/PYTHON_SOFTWARE/test/helpers/globalVariables.pyc b/scripts/PYTHON_SOFTWARE/test/helpers/globalVariables.pyc
new file mode 100644
index 0000000..3450022
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/helpers/globalVariables.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/helpers/psqldb.py b/scripts/PYTHON_SOFTWARE/test/helpers/psqldb.py
new file mode 100644
index 0000000..af08579
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/helpers/psqldb.py
@@ -0,0 +1,55 @@
+import psycopg2
+
+class PgSQLConnection(object):
+ """aaaaaaa"""
+
+ __conection_object = None
+ __db_config = {'dbname': 'testsrv', 'host': '192.168.2.171',
+ 'password': 'Idkfa2009', 'port': 5432, 'user': 'admin'}
+
+ def __init__ (self, connect_str = None):
+ self.__conection_object = None
+ if connect_str is not None:
+ self.__db_config = connect_str
+ else:
+ self.__db_config = {'dbname': 'testsrv', 'host': '192.168.2.171',
+ 'password': 'Idkfa2009', 'port': 5432, 'user': 'admin'}
+
+ def db_connect (self, connect_str = None):
+ result = False
+ try:
+ if connect_str == None:
+ self.__conection_object = psycopg2.connect(**self.__db_config)
+ else:
+ __db_config = connect_str;
+ self.__conection_object = psycopg2.connect(**self.__db_config)
+ self.__conection_object.autocommit = True
+ result = True
+ except Exception as error:
+ print(error)
+ return result
+
+ def db_execute_query(self, query):
+ cur = self.__conection_object.cursor()
+ cur.execute(query)
+ data = cur.fetchall()
+ cur.close()
+ return data
+
+ def commit(self):
+ self.__conection_object.commit()
+
+
+ def db_close(self):
+ if self.__conection_object is not None:
+ self.__conection_object.close()
+ del self.__conection_object
+ self.__conection_object = None
+
+
+ def __del__(self):
+ if self.__conection_object is not None:
+ self.__conection_object.close()
+ #print("disconnected")
+
+
diff --git a/scripts/PYTHON_SOFTWARE/test/helpers/setup_xml.py b/scripts/PYTHON_SOFTWARE/test/helpers/setup_xml.py
new file mode 100644
index 0000000..3fd9fd5
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/helpers/setup_xml.py
@@ -0,0 +1,40 @@
+import xml.etree.ElementTree as XMLParser
+
+class XMLSetup (object):
+ """aaaaa"""
+ __tree = None # Parser
+ __dbType = None # database connection required: PgSQLConnection
+ __dbConnectionRaw = None # Connection string in raw
+ __dbConnectionStr = None # Connection string to use in sql object connection
+
+ def __init__(self, filename):
+ """aaaaa"""
+ self.__tree = XMLParser.parse(filename)
+
+ def __del__(self):
+ """aaaaa"""
+ pass
+
+ def getdbConnectionStr (self):
+ """aaaaa"""
+ if self.__dbConnectionRaw is not None:
+ return self.__dbConnectionRaw
+
+ for element in self.__tree.iter('db'):
+ self.__dbConnectionRaw = element.attrib
+ self.__dbType = self.__dbConnectionRaw['type']
+ if self.__dbType == "PgSQLConnection":
+ self.__dbConnectionStr = self.getPostgresConnectionStr()
+ return self.__dbConnectionStr
+
+ return None
+
+ def getPostgresConnectionStr (self):
+ """aaaaa"""
+ str = self.__dbConnectionRaw
+ del str['type']
+ return str
+
+ def getMysqlConnectionStr (self):
+ """aaaaa"""
+ pass \ No newline at end of file
diff --git a/scripts/PYTHON_SOFTWARE/test/helpers/syscmd.py b/scripts/PYTHON_SOFTWARE/test/helpers/syscmd.py
new file mode 100644
index 0000000..b579e39
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/helpers/syscmd.py
@@ -0,0 +1,108 @@
+import unittest
+import subprocess
+from test.helpers.globalVariables import globalVar
+
+
+class TestSysCommand(unittest.TestCase):
+ __str_cmd = None
+ __testname = None
+ __outfilename = None
+ __outdata = None
+ __outtofile = False
+
+ def __init__(self, testname, testfunc, str_cmd, outtofile = False):
+ """ init """
+ super(TestSysCommand, self).__init__(testfunc)
+ self.__str_cmd = str_cmd
+ self.__testname = testname
+ self.__outtofile = outtofile
+ self._testMethodDoc = testname
+ if self.__outtofile is True:
+ self.__outfilename = '/tmp/{}.txt'.format(testname)
+
+ def getName(self):
+ return self.__testname
+
+ def execute(self):
+ res = -1
+ try:
+ completed = subprocess.run(
+ self.__str_cmd,
+ check=True,
+ shell=True,
+ stdout=subprocess.PIPE,
+ )
+ self.assertTrue(completed.returncode is 0)
+ if completed.returncode is 0:
+ if self.__outtofile is True:
+ f = open(self.__outfilename, 'wb')
+ f.write(completed.stdout)
+ f.close()
+ res = 0
+ else:
+ res = -3
+ outdata = completed.stdout
+ self.longMessage=str(outdata).replace("'","")
+ self.assertTrue(True)
+ except subprocess.CalledProcessError as err:
+ self.assertTrue(False)
+ res = -1
+ except Exception as t:
+ res = -2
+ return res
+
+ def remove_file(self):
+ pass
+
+class SysCommand(object):
+ __str_cmd = None
+ __cmdname = None
+ __outdata = None
+ __errdata = None
+
+ def __init__(self, cmdname, str_cmd):
+ """ init """
+ self.__str_cmd = str_cmd
+ self.__cmdname = cmdname
+
+ def getName(self):
+ return self.__testname
+
+ def execute(self):
+ res = -1
+ try:
+ self.__outdata = None
+ self.__errdata = None
+ completed = subprocess.run(
+ self.__str_cmd,
+ check=True,
+ shell=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE
+ )
+ self.__outdata = completed.stdout
+ if completed.returncode is 0:
+ res = 0
+ if completed.stderr.decode('ascii') != "":
+ res = -1
+ self.__errdata = completed.stderr
+ except subprocess.CalledProcessError as err:
+ res = -2
+ except Exception as t:
+ res = -3
+ return res
+
+ def getOutput(self):
+ return self.__outdata
+
+ def getOutErr(self):
+ return self.__errdata
+
+ def getOutputlines(self):
+ return self.__outdata.splitlines()
+
+ def save_file(self, fname):
+ f = open(fname, 'wb')
+ f.write(self.__outdata)
+ f.close()
+
diff --git a/scripts/PYTHON_SOFTWARE/test/helpers/syscmd.pyc b/scripts/PYTHON_SOFTWARE/test/helpers/syscmd.pyc
new file mode 100644
index 0000000..1332c75
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/helpers/syscmd.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/helpers/testsrv_db.py b/scripts/PYTHON_SOFTWARE/test/helpers/testsrv_db.py
new file mode 100644
index 0000000..bac6ed8
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/helpers/testsrv_db.py
@@ -0,0 +1,162 @@
+from test.helpers.psqldb import PgSQLConnection
+from test.helpers.setup_xml import XMLSetup
+
+def find_between( s, first, last ):
+ try:
+ start = s.index( first ) + len( first )
+ end = s.index( last, start )
+ return s[start:end]
+ except ValueError:
+ return ""
+
+
+class TestSrv_Database(object):
+ ''' TestSrv Database Helper '''
+
+ __sqlObject = None
+ __xml_setup = None
+
+ def __init__(self):
+ pass
+
+ def open (self, filename):
+ '''Open database connection'''
+ self.__xml_setup = XMLSetup(filename)
+ self.__sqlObject = PgSQLConnection()
+ return self.__sqlObject.db_connect(self.__xml_setup.getdbConnectionStr())
+
+ def create_board(self, processor_id, model_id, variant, bmac = None):
+ '''create a new board'''
+ if bmac is None:
+ sql = "SELECT isee.create_board('{}', '{}', '{}', NULL);".format(processor_id, model_id, variant)
+ else:
+ sql = "SELECT isee.create_board('{}', '{}', '{}', '{}');".format(processor_id, model_id, variant, bmac)
+ #print('>>>' + sql)
+ try:
+ res = self.__sqlObject.db_execute_query(sql)
+ #print(res)
+ return res[0][0];
+ except Exception as err:
+ r = find_between(str(err), '#', '#')
+ #print(r)
+ return None
+
+ def create_model(self, modid, variant, descr, tgid):
+ '''create new model'''
+ sql = "SELECT isee.create_model('{}', '{}', '{}', '{}')".format(modid, variant, descr, tgid)
+ #print('>>>' + sql)
+ try:
+ res = self.__sqlObject.db_execute_query(sql)
+ #print(res)
+ return res[0][0];
+ except Exception as err:
+ r = find_between(str(err), '#', '#')
+ #print(r)
+ return None
+
+ def create_test_definition(self, testname, testdesc, testfunc):
+ '''Create a new definition and return definition id on fail (testname already exist) return -1'''
+ sql = "SELECT isee.define_test('{}', '{}', '{}')".format(testname, testdesc, testfunc)
+ #print('>>>' + sql)
+ try:
+ res = self.__sqlObject.db_execute_query(sql)
+ #print(res)
+ return res[0][0];
+ except Exception as err:
+ r = find_between(str(err), '#', '#')
+ #print(r)
+ return None
+
+ def add_testdef_to_group(self, testgroupid, testname, testparam):
+ '''Assign definition to group test return true on success or false if it fails'''
+ sql = "SELECT isee.add_test_to_group('{}', '{}', '{}')".format(testgroupid, testname, testparam)
+ #print('>>>' + sql)
+ try:
+ res = self.__sqlObject.db_execute_query(sql)
+ #print(res)
+ return res[0][0];
+ except Exception as err:
+ r = find_between(str(err), '#', '#')
+ #print(r)
+ return None
+
+ def getboard_test_list(self, board_uuid):
+ '''get the board test list'''
+ sql = "SELECT isee.gettestlist('{}')".format(board_uuid)
+ #print('>>>' + sql)
+ try:
+ res = self.__sqlObject.db_execute_query(sql)
+ #print(res)
+ return res;
+ except Exception as err:
+ r = find_between(str(err), '#', '#')
+ #print(r)
+ return None
+
+ def getboard_comp_test_list(self, board_uuid):
+ '''get the board test list'''
+ sql = "SELECT isee.gettestcompletelist('{}')".format(board_uuid)
+ #print('>>>' + sql)
+ try:
+ res = self.__sqlObject.db_execute_query(sql)
+ #print(res)
+ return res;
+ except Exception as err:
+ r = find_between(str(err), '#', '#')
+ #print(r)
+ return None
+
+ def open_testbatch(self, board_uuid):
+ '''get the board test list'''
+ sql = "SELECT isee.open_testbatch('{}')".format(board_uuid)
+ #print('>>>' + sql)
+ try:
+ res = str(self.__sqlObject.db_execute_query(sql)[0])
+ res = res.replace('(', '')
+ res = res.replace(')', '')
+ res = res.replace(',', '')
+ #print(res)
+ return res;
+ except Exception as err:
+ r = find_between(str(err), '#', '#')
+ #print(r)
+ return None
+
+ def add_test_to_batch(self, board_uuid, testid, testid_ctl, result, groupid, data):
+ '''get the board test list'''
+ sql = "SELECT isee.add_test_to_batch_c('{}','{}','{}','{}','{}','{}')".format(board_uuid, testid, testid_ctl, result, groupid, data)
+ #print('>>>' + sql)
+ try:
+ res = self.__sqlObject.db_execute_query(sql)
+ #print(res)
+ return res;
+ except Exception as err:
+ r = find_between(str(err), '#', '#')
+ #print(r)
+ return None
+
+ def close_testbatch(self, board_uuid, testid_ctl):
+ '''get the board test list'''
+ sql = "SELECT isee.close_testbatch('{}','{}')".format(board_uuid, testid_ctl)
+ #print('>>>' + sql)
+ try:
+ res = self.__sqlObject.db_execute_query(sql)
+ #print(res)
+ return res;
+ except Exception as err:
+ r = find_between(str(err), '#', '#')
+ #print(r)
+ return None
+
+ def update_set_test_row(self, nstation, testid_ctl, board_uuid, ctest, cstatus):
+ '''get the board test list'''
+ sql = "SELECT isee.update_set_test_row('{}','{}','{}','{}','{}')".format(nstation, testid_ctl ,board_uuid, ctest, cstatus)
+ #print('>>>' + sql)
+ try:
+ res = self.__sqlObject.db_execute_query(sql)
+ #print(res)
+ return res;
+ except Exception as err:
+ r = find_between(str(err), '#', '#')
+ #print(r)
+ return None \ No newline at end of file
diff --git a/scripts/PYTHON_SOFTWARE/test/helpers/uboot_flasher.py b/scripts/PYTHON_SOFTWARE/test/helpers/uboot_flasher.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/helpers/uboot_flasher.py
diff --git a/scripts/PYTHON_SOFTWARE/test/runners/__init__.py b/scripts/PYTHON_SOFTWARE/test/runners/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/runners/__init__.py
diff --git a/scripts/PYTHON_SOFTWARE/test/runners/__pycache__/__init__.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/runners/__pycache__/__init__.cpython-35.pyc
new file mode 100644
index 0000000..2927283
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/runners/__pycache__/__init__.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/runners/__pycache__/simple.cpython-35.pyc b/scripts/PYTHON_SOFTWARE/test/runners/__pycache__/simple.cpython-35.pyc
new file mode 100644
index 0000000..e7a35ea
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/runners/__pycache__/simple.cpython-35.pyc
Binary files differ
diff --git a/scripts/PYTHON_SOFTWARE/test/runners/simple.py b/scripts/PYTHON_SOFTWARE/test/runners/simple.py
new file mode 100644
index 0000000..5b2da5a
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/runners/simple.py
@@ -0,0 +1,98 @@
+#!/usr/bin/env python
+
+"""
+Simple Test Runner for unittest module
+
+"""
+
+import sys
+import unittest
+import os
+from test.helpers.globalVariables import globalVar
+from test.helpers.testsrv_db import TestSrv_Database
+
+
+
+class SimpleTestRunner:
+ """ A Test Runner that shows results in a simple human-readable format.
+
+ As example, a common output is:
+ This is a test short description : PASS
+ This is another test short description : FAIL
+ ---------------------------------------------
+
+ """
+ def __init__(self, stream=sys.stderr, verbosity=0):
+ self.stream = stream
+ self.verbosity = verbosity
+
+ def writeUpdate(self, message):
+ self.stream.write(message)
+
+ def run(self, test):
+ """ Run the given test case or Test Suite.
+
+ """
+ result = TextTestResult(self)
+ test(result)
+ result.testsRun
+ # self.writeUpdate("---------------------------------------------\n")
+ return result
+
+class TextTestResult(unittest.TestResult):
+ # Print in terminal with colors
+ PASS = '\033[32mPASS\033[0m\n'
+ FAIL = '\033[31mFAIL\033[0m\n'
+ ERROR = '\033[31mERROR\033[0m\n'
+
+ def __init__(self, runner):
+ unittest.TestResult.__init__(self)
+ self.runner = runner
+ self.result = self.ERROR
+
+ def startTest(self, test):
+ unittest.TestResult.startTest(self, test)
+ self.runner.writeUpdate("%s : " % test.shortDescription())
+ # SEND TO DB THE UPDATE THAT WE RUN EACH TEST
+ psdb = TestSrv_Database()
+ psdb.open("setup.xml")
+ psdb.update_set_test_row(globalVar.station, globalVar.testid_ctl, globalVar.g_uuid, test.shortDescription(), "RUNNING")
+
+ def addSuccess(self, test):
+ unittest.TestResult.addSuccess(self, test)
+ self.result=self.PASS
+
+ def addError(self, test, err):
+ unittest.TestResult.addError(self, test, err)
+ test.longMessage = err[1]
+ self.result = self.ERROR
+
+ def addFailure(self, test, err):
+ unittest.TestResult.addFailure(self, test, err)
+ test.longMessage=err[1]
+ self.result = self.FAIL
+
+ def stopTest(self, test):
+ unittest.TestResult.stopTest(self, test)
+ # display: print test result
+ self.runner.writeUpdate(self.result)
+ # DB: PREPARE THE DATA TO BE INSERTED
+ dbdata = {}
+ dbdata['uuid'] = globalVar.g_uuid
+ dbdata['name'] = test.shortDescription()
+ dbdata['result'] = self.result
+ dbdata['msg'] = str(test.longMessage)
+ #DB: INSERT IN THE DATABASE
+ filename='test_results.dat'
+ testResult = open(filename, 'a')
+ testResult.write(str(dbdata))
+ testResult.write("\n")
+ testResult.close()
+ #CONVERT FANCY FAIL AND PASS
+ if self.result==self.PASS: simple_result="TRUE"
+ if self.result == self.FAIL: simple_result = "FALSE"
+ elif self.result == self.ERROR: simple_result = "FALSE"
+ #SEND TO DB THE RESULT OF THE TEST
+ psdb = TestSrv_Database()
+ psdb.open("setup.xml")
+ psdb.add_test_to_batch(globalVar.g_uuid, test.shortDescription(), globalVar.testid_ctl, simple_result, globalVar.g_mid, test.longMessage)
diff --git a/scripts/PYTHON_SOFTWARE/test/suites/__init__.py b/scripts/PYTHON_SOFTWARE/test/suites/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/scripts/PYTHON_SOFTWARE/test/suites/__init__.py
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))
+