From 7edd6c5f599533e67bdf494df13cab06d5995209 Mon Sep 17 00:00:00 2001 From: Manel Caro Date: Sat, 9 Mar 2019 21:38:10 +0100 Subject: Modify some Execution Tests and EEprom Support - Change Board Model to IGEP0000 - Change Audio Test - Change qbutton Test - Change qScreen Test - Added EEprom Support --- test-cli/setup.xml | 4 +- test-cli/test/__pycache__/__init__.cpython-35.pyc | Bin 138 -> 110 bytes test-cli/test/files/test_ok.png | Bin 0 -> 18150 bytes .../helpers/__pycache__/__init__.cpython-35.pyc | Bin 118 -> 118 bytes .../__pycache__/cv_display_test.cpython-35.pyc | Bin 3246 -> 3161 bytes .../helpers/__pycache__/finisher.cpython-35.pyc | Bin 0 -> 4475 bytes .../helpers/__pycache__/get_dieid.cpython-35.pyc | Bin 1496 -> 1535 bytes .../__pycache__/globalVariables.cpython-35.pyc | Bin 345 -> 375 bytes .../test/helpers/__pycache__/psqldb.cpython-35.pyc | Bin 1939 -> 1882 bytes .../helpers/__pycache__/setup_xml.cpython-35.pyc | Bin 1481 -> 1481 bytes .../test/helpers/__pycache__/syscmd.cpython-35.pyc | Bin 3694 -> 3683 bytes .../helpers/__pycache__/testsrv_db.cpython-35.pyc | Bin 5230 -> 6077 bytes test-cli/test/helpers/cv_display_test.py | 10 +- test-cli/test/helpers/finisher.py | 151 +++++++++++++++++++++ test-cli/test/helpers/get_dieid.py | 2 + test-cli/test/helpers/globalVariables.py | 2 + test-cli/test/helpers/psqldb.py | 20 +-- test-cli/test/helpers/testsrv_db.py | 16 ++- .../runners/__pycache__/__init__.cpython-35.pyc | Bin 146 -> 118 bytes .../test/runners/__pycache__/simple.cpython-35.pyc | Bin 3452 -> 3613 bytes test-cli/test/tests/.qaudio.py.swp | Bin 0 -> 1024 bytes .../test/tests/__pycache__/__init__.cpython-35.pyc | Bin 144 -> 116 bytes .../test/tests/__pycache__/qamp.cpython-35.pyc | Bin 0 -> 2510 bytes .../test/tests/__pycache__/qaudio.cpython-35.pyc | Bin 1750 -> 1751 bytes .../test/tests/__pycache__/qbutton.cpython-35.pyc | Bin 1962 -> 2058 bytes .../tests/__pycache__/qduplex_ser.cpython-35.pyc | Bin 1799 -> 1788 bytes .../test/tests/__pycache__/qeeprom.cpython-35.pyc | Bin 1623 -> 1612 bytes .../tests/__pycache__/qethernet.cpython-35.pyc | Bin 2122 -> 2111 bytes .../test/tests/__pycache__/qflash.cpython-35.pyc | Bin 0 -> 2707 bytes .../test/tests/__pycache__/qi2c.cpython-35.pyc | Bin 1548 -> 1537 bytes .../test/tests/__pycache__/qiperf.cpython-35.pyc | Bin 1746 -> 1709 bytes .../test/tests/__pycache__/qram.cpython-35.pyc | Bin 1372 -> 1335 bytes .../test/tests/__pycache__/qrtc.cpython-35.pyc | Bin 1317 -> 1306 bytes .../test/tests/__pycache__/qscreen.cpython-35.pyc | Bin 1165 -> 1403 bytes .../test/tests/__pycache__/qserial.cpython-35.pyc | Bin 1473 -> 1462 bytes .../test/tests/__pycache__/qusb.cpython-35.pyc | Bin 2068 -> 2119 bytes .../test/tests/__pycache__/qwifi.cpython-35.pyc | Bin 1299 -> 1572 bytes test-cli/test/tests/qamp.py | 1 + test-cli/test/tests/qaudio.py | 39 +++--- test-cli/test/tests/qbutton.py | 3 + test-cli/test/tests/qflash.py | 5 +- test-cli/test/tests/qscreen.py | 21 ++- test-cli/test/tests/qwifi.py | 1 + test-cli/test_main.py | 19 ++- 44 files changed, 238 insertions(+), 56 deletions(-) create mode 100644 test-cli/test/files/test_ok.png create mode 100644 test-cli/test/helpers/__pycache__/finisher.cpython-35.pyc create mode 100644 test-cli/test/helpers/finisher.py create mode 100644 test-cli/test/tests/.qaudio.py.swp create mode 100644 test-cli/test/tests/__pycache__/qamp.cpython-35.pyc create mode 100644 test-cli/test/tests/__pycache__/qflash.cpython-35.pyc diff --git a/test-cli/setup.xml b/test-cli/setup.xml index d0a7504..41295b5 100644 --- a/test-cli/setup.xml +++ b/test-cli/setup.xml @@ -2,8 +2,8 @@ - - + + diff --git a/test-cli/test/__pycache__/__init__.cpython-35.pyc b/test-cli/test/__pycache__/__init__.cpython-35.pyc index 306b3b8..8bae02f 100644 Binary files a/test-cli/test/__pycache__/__init__.cpython-35.pyc and b/test-cli/test/__pycache__/__init__.cpython-35.pyc differ diff --git a/test-cli/test/files/test_ok.png b/test-cli/test/files/test_ok.png new file mode 100644 index 0000000..6ccc7b3 Binary files /dev/null and b/test-cli/test/files/test_ok.png differ diff --git a/test-cli/test/helpers/__pycache__/__init__.cpython-35.pyc b/test-cli/test/helpers/__pycache__/__init__.cpython-35.pyc index 5224618..5a46842 100644 Binary files a/test-cli/test/helpers/__pycache__/__init__.cpython-35.pyc and b/test-cli/test/helpers/__pycache__/__init__.cpython-35.pyc differ diff --git a/test-cli/test/helpers/__pycache__/cv_display_test.cpython-35.pyc b/test-cli/test/helpers/__pycache__/cv_display_test.cpython-35.pyc index 5df3dbc..05de7f2 100644 Binary files a/test-cli/test/helpers/__pycache__/cv_display_test.cpython-35.pyc and b/test-cli/test/helpers/__pycache__/cv_display_test.cpython-35.pyc differ diff --git a/test-cli/test/helpers/__pycache__/finisher.cpython-35.pyc b/test-cli/test/helpers/__pycache__/finisher.cpython-35.pyc new file mode 100644 index 0000000..d647dd1 Binary files /dev/null and b/test-cli/test/helpers/__pycache__/finisher.cpython-35.pyc differ diff --git a/test-cli/test/helpers/__pycache__/get_dieid.cpython-35.pyc b/test-cli/test/helpers/__pycache__/get_dieid.cpython-35.pyc index d822bf3..23caec4 100644 Binary files a/test-cli/test/helpers/__pycache__/get_dieid.cpython-35.pyc and b/test-cli/test/helpers/__pycache__/get_dieid.cpython-35.pyc differ diff --git a/test-cli/test/helpers/__pycache__/globalVariables.cpython-35.pyc b/test-cli/test/helpers/__pycache__/globalVariables.cpython-35.pyc index 75d4904..7ac8396 100644 Binary files a/test-cli/test/helpers/__pycache__/globalVariables.cpython-35.pyc and b/test-cli/test/helpers/__pycache__/globalVariables.cpython-35.pyc differ diff --git a/test-cli/test/helpers/__pycache__/psqldb.cpython-35.pyc b/test-cli/test/helpers/__pycache__/psqldb.cpython-35.pyc index 8f85c0c..bdba2f1 100644 Binary files a/test-cli/test/helpers/__pycache__/psqldb.cpython-35.pyc and b/test-cli/test/helpers/__pycache__/psqldb.cpython-35.pyc differ diff --git a/test-cli/test/helpers/__pycache__/setup_xml.cpython-35.pyc b/test-cli/test/helpers/__pycache__/setup_xml.cpython-35.pyc index d1a3f94..58ec6f6 100644 Binary files a/test-cli/test/helpers/__pycache__/setup_xml.cpython-35.pyc and b/test-cli/test/helpers/__pycache__/setup_xml.cpython-35.pyc differ diff --git a/test-cli/test/helpers/__pycache__/syscmd.cpython-35.pyc b/test-cli/test/helpers/__pycache__/syscmd.cpython-35.pyc index 77658c7..fbb7322 100644 Binary files a/test-cli/test/helpers/__pycache__/syscmd.cpython-35.pyc and b/test-cli/test/helpers/__pycache__/syscmd.cpython-35.pyc differ diff --git a/test-cli/test/helpers/__pycache__/testsrv_db.cpython-35.pyc b/test-cli/test/helpers/__pycache__/testsrv_db.cpython-35.pyc index 2169783..b216640 100644 Binary files a/test-cli/test/helpers/__pycache__/testsrv_db.cpython-35.pyc and b/test-cli/test/helpers/__pycache__/testsrv_db.cpython-35.pyc differ diff --git a/test-cli/test/helpers/cv_display_test.py b/test-cli/test/helpers/cv_display_test.py index 7321667..b54a698 100644 --- a/test-cli/test/helpers/cv_display_test.py +++ b/test-cli/test/helpers/cv_display_test.py @@ -1,7 +1,5 @@ import cv2 import numpy as np -import subprocess - @@ -17,9 +15,7 @@ def pattern_detect(cam_device=0): 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) + capture = cv2.VideoCapture("/dev/v4l/by-id/usb-Creative_Technology_Ltd._Live__Cam_Sync_HD_VF0770-video-index0") try: _, image = capture.read() except: @@ -145,3 +141,7 @@ def pattern_detect(cam_device=0): msg = "AVG BLUE COUNT FAIL" return msg return msg + + + + diff --git a/test-cli/test/helpers/finisher.py b/test-cli/test/helpers/finisher.py new file mode 100644 index 0000000..73142d9 --- /dev/null +++ b/test-cli/test/helpers/finisher.py @@ -0,0 +1,151 @@ +from test.helpers.syscmd import SysCommand +from test.helpers.globalVariables import globalVar +import binascii +import uuid +import subprocess +from PIL import Image, ImageDraw, ImageFont +import qrcode +import PIL + +class Finisher(object): + __muhb = None + __final_to_burn_to_eeprom = None + __qr_image = None + + def __init__(self, muhb = None): + self.__muhb = muhb + self.__final_to_burn_to_eeprom = bytearray() + self.__qr_image = None + pass + + def eeprom_burn(self): + ## Create binary file + str_cmd2 = "find /sys/ -iname 'eeprom'" + eeprom_location = SysCommand("eeprom_location", str_cmd2) + if eeprom_location.execute() == 0: + raw_out = eeprom_location.getOutput() + if raw_out == "": + self.fail("Unable to get EEPROM location. IS EEPROM CONNECTED?") + eeprom = raw_out.decode('ascii') + eeprom = eeprom.strip('\n') + ## push binary data to eeprom like if working with files + file2 = open(eeprom, "w+b") + file2.write(self.__final_to_burn_to_eeprom) + else: + self.fail("failed: could not complete find eeprom command") + + def generate_qr_stamp(self): + # Generate QR to put in a stamp + qr = qrcode.QRCode( + version=1, + error_correction=qrcode.constants.ERROR_CORRECT_L, + box_size=10, + border=4, + ) + # Use board_uuid to generate the QR code + qr.add_data(globalVar.g_uuid) + qr.make(fit=True) + # Save QR as image stamp.png + img = qr.make_image() + # Store QR as a class atrib + self.__qr_image = img + img.save('/home/root/stamp.png') + + def print_stamp(self): + # Print stamp by sending a cmd to the printer + str_cmd3 = "lpr -o scaling=4 stamp.png".format(self.__display) + printstamp = SysCommand("printstamp", str_cmd3) + if printstamp.execute() != 0: + self.fail("failed: could not print stamp") + + def generate_screen(self): + # Generate green image with board uuid and QR maybe pasted on top of green image + # Define image size + W = 1250 + H = 703 + # Create blank rectangle to write on + image = Image.new('RGB', (W, H), (46, 204, 113, 0)) + draw = ImageDraw.Draw(image) + message = "TEST OK\n\n" + "Board UUID: "+ globalVar.g_uuid + font = ImageFont.truetype('/usr/share/fonts/truetype/dejavuu/DejaVuSans.ttf', 40) + # Calculate the width and height of the text to be drawn, given font size + w, h = draw.textsize(message, font=font) + # Write the text to the image, where (x,y) is the top left corner of the text + draw.text(((W-w)/2,(H-h)/2), message, align='center', font=font) + #draw.image(self.__qr_image) + image.save('/home/root/test/files/test_ok.png') + + def show_result_screen(self): + # If test OK show test_OK.png located in /home/root, If test fail show test_fail.png, located in /home/root/test/files/test_KO.png + if globalVar.fstatus: + str_cmd4 = "fbi -T 1 --noverbose -d /dev/{} test/files/test_ok.png".format('fb0') + else: + str_cmd4 = "fbi -T 1 --noverbose -d /dev/{} test/files/test_ko.png".format('fb0') + + display_image = SysCommand("display_image", str_cmd4) + #print(display_image.execute()) + if display_image.execute() != -1: + self.fail("failed: could not display the image") + + + def end_ok(self): + # Burn retrieved igep eeprom struct + new = self.__muhb[0][0] + + # Convert from string to hex + hnew = new.encode() + # Magic_id and default crc32 0x6d, 0x6a, 0x6d, 0xe4 with endianess changed so that u-boot loads it correctly + # IF magic ever changes this magic_id should be changed. At the end always magic_id of test and u-boot should + # be the same + magic_id = bytes([0xe4, 0x6d, 0x6a, 0x6d]) + default_igep_crc32 = bytes([0x00, 0x00, 0x00, 0x00]) + + # Create bytearray + to_calculate = bytearray() + # Build the final hex binary for crc32 operation + to_calculate.extend(magic_id) + to_calculate.extend(default_igep_crc32) + to_calculate.extend(hnew) + + # Calculate crc32! + new_crc32 = binascii.crc32(to_calculate) + hnew_crc32 = new_crc32.to_bytes(4, byteorder="little") + + # Recreate final eeprom struct in bytearray + self.__final_to_burn_to_eeprom = bytearray() + self.__final_to_burn_to_eeprom.extend(magic_id) + self.__final_to_burn_to_eeprom.extend(hnew_crc32) + self.__final_to_burn_to_eeprom.extend(hnew) + self.eeprom_burn() + + # Generate QR stamp + self.generate_qr_stamp() + # Send print stamp command + #self.print_stamp() + # Generate green image with board uuid and QR maybe pasted on top of green image + self.generate_screen() + # Show test_ok.png image in screen + self.show_result_screen() + + def end_fail(self): + # Burn igep eeprom bug struct + hnew = self.__muhb.encode() + default_fail = bytes([0xD0, 0xBA, 0xD0, 0xBA]) + self.__final_burn_to_eeprom = bytearray() + self.__final_to_burn_to_eeprom.extend(default_fail) + self.__final_to_burn_to_eeprom.extend(default_fail) + self.__final_to_burn_to_eeprom.extend(hnew) + self.__final_to_burn_to_eeprom.extend(default_fail) + self.__final_to_burn_to_eeprom.extend(default_fail) + self.__final_to_burn_to_eeprom.extend(default_fail) + self.__final_to_burn_to_eeprom.extend(default_fail) + self.__final_to_burn_to_eeprom.extend(default_fail) + self.__final_to_burn_to_eeprom.extend(default_fail) + self.__final_to_burn_to_eeprom.extend(default_fail) + self.__final_to_burn_to_eeprom.extend(default_fail) + self.__final_to_burn_to_eeprom.extend(default_fail) + self.__final_to_burn_to_eeprom.extend(default_fail) + self.__final_to_burn_to_eeprom.extend(default_fail) + self.eeprom_burn() + # Show test_ko.png image in screen + self.show_result_screen() \ No newline at end of file diff --git a/test-cli/test/helpers/get_dieid.py b/test-cli/test/helpers/get_dieid.py index 029ddb5..b20f143 100644 --- a/test-cli/test/helpers/get_dieid.py +++ b/test-cli/test/helpers/get_dieid.py @@ -21,6 +21,8 @@ def read(addr): def getRegisters(model): if model.find("IGEP0046") == 0: registers = [0x021BC420, 0x021BC410] + elif model.find("IGEP0000") == 0: + registers = [0x021BC420, 0x021BC410] elif model.find("IGEP0034") == 0 or model.find("SOPA0000") == 0: registers = [0x44e10630, 0x44e10634, 0x44e10638, 0x44e1063C] elif model.find("OMAP3") == 0: diff --git a/test-cli/test/helpers/globalVariables.py b/test-cli/test/helpers/globalVariables.py index 6b89f4d..c4d8358 100644 --- a/test-cli/test/helpers/globalVariables.py +++ b/test-cli/test/helpers/globalVariables.py @@ -6,3 +6,5 @@ def globalVar(): g_mid = "" outdata = "NONE" station = "" + fstatus = "" + gdisplay = None \ No newline at end of file diff --git a/test-cli/test/helpers/psqldb.py b/test-cli/test/helpers/psqldb.py index af08579..26dd03d 100644 --- a/test-cli/test/helpers/psqldb.py +++ b/test-cli/test/helpers/psqldb.py @@ -7,21 +7,21 @@ class PgSQLConnection(object): __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): + def __init__ (self): +# 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): result = False try: if connect_str == None: self.__conection_object = psycopg2.connect(**self.__db_config) else: - __db_config = connect_str; + self.__db_config = connect_str; self.__conection_object = psycopg2.connect(**self.__db_config) self.__conection_object.autocommit = True result = True diff --git a/test-cli/test/helpers/testsrv_db.py b/test-cli/test/helpers/testsrv_db.py index bac6ed8..94181f9 100644 --- a/test-cli/test/helpers/testsrv_db.py +++ b/test-cli/test/helpers/testsrv_db.py @@ -159,4 +159,18 @@ class TestSrv_Database(object): except Exception as err: r = find_between(str(err), '#', '#') #print(r) - return None \ No newline at end of file + return None + + def getboard_eeprom(self, board_uuid): + '''get the board eeprom struct ''' + sql = "SELECT isee.getboard_eeprom('{}')".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 + \ No newline at end of file diff --git a/test-cli/test/runners/__pycache__/__init__.cpython-35.pyc b/test-cli/test/runners/__pycache__/__init__.cpython-35.pyc index 2927283..ee06dda 100644 Binary files a/test-cli/test/runners/__pycache__/__init__.cpython-35.pyc and b/test-cli/test/runners/__pycache__/__init__.cpython-35.pyc differ diff --git a/test-cli/test/runners/__pycache__/simple.cpython-35.pyc b/test-cli/test/runners/__pycache__/simple.cpython-35.pyc index e7a35ea..4ad4554 100644 Binary files a/test-cli/test/runners/__pycache__/simple.cpython-35.pyc and b/test-cli/test/runners/__pycache__/simple.cpython-35.pyc differ diff --git a/test-cli/test/tests/.qaudio.py.swp b/test-cli/test/tests/.qaudio.py.swp new file mode 100644 index 0000000..7873edb Binary files /dev/null and b/test-cli/test/tests/.qaudio.py.swp differ diff --git a/test-cli/test/tests/__pycache__/__init__.cpython-35.pyc b/test-cli/test/tests/__pycache__/__init__.cpython-35.pyc index 8ec8ff0..53465da 100644 Binary files a/test-cli/test/tests/__pycache__/__init__.cpython-35.pyc and b/test-cli/test/tests/__pycache__/__init__.cpython-35.pyc differ diff --git a/test-cli/test/tests/__pycache__/qamp.cpython-35.pyc b/test-cli/test/tests/__pycache__/qamp.cpython-35.pyc new file mode 100644 index 0000000..76018fd Binary files /dev/null and b/test-cli/test/tests/__pycache__/qamp.cpython-35.pyc differ diff --git a/test-cli/test/tests/__pycache__/qaudio.cpython-35.pyc b/test-cli/test/tests/__pycache__/qaudio.cpython-35.pyc index 930961a..774488b 100644 Binary files a/test-cli/test/tests/__pycache__/qaudio.cpython-35.pyc and b/test-cli/test/tests/__pycache__/qaudio.cpython-35.pyc differ diff --git a/test-cli/test/tests/__pycache__/qbutton.cpython-35.pyc b/test-cli/test/tests/__pycache__/qbutton.cpython-35.pyc index fb10f23..91fa3ef 100644 Binary files a/test-cli/test/tests/__pycache__/qbutton.cpython-35.pyc and b/test-cli/test/tests/__pycache__/qbutton.cpython-35.pyc differ diff --git a/test-cli/test/tests/__pycache__/qduplex_ser.cpython-35.pyc b/test-cli/test/tests/__pycache__/qduplex_ser.cpython-35.pyc index 0cbd3af..f8f4f93 100644 Binary files a/test-cli/test/tests/__pycache__/qduplex_ser.cpython-35.pyc and b/test-cli/test/tests/__pycache__/qduplex_ser.cpython-35.pyc differ diff --git a/test-cli/test/tests/__pycache__/qeeprom.cpython-35.pyc b/test-cli/test/tests/__pycache__/qeeprom.cpython-35.pyc index 7a3a5c5..4dfecd2 100644 Binary files a/test-cli/test/tests/__pycache__/qeeprom.cpython-35.pyc and b/test-cli/test/tests/__pycache__/qeeprom.cpython-35.pyc differ diff --git a/test-cli/test/tests/__pycache__/qethernet.cpython-35.pyc b/test-cli/test/tests/__pycache__/qethernet.cpython-35.pyc index 0c7570c..257e244 100644 Binary files a/test-cli/test/tests/__pycache__/qethernet.cpython-35.pyc and b/test-cli/test/tests/__pycache__/qethernet.cpython-35.pyc differ diff --git a/test-cli/test/tests/__pycache__/qflash.cpython-35.pyc b/test-cli/test/tests/__pycache__/qflash.cpython-35.pyc new file mode 100644 index 0000000..a4fe2bc Binary files /dev/null and b/test-cli/test/tests/__pycache__/qflash.cpython-35.pyc differ diff --git a/test-cli/test/tests/__pycache__/qi2c.cpython-35.pyc b/test-cli/test/tests/__pycache__/qi2c.cpython-35.pyc index 2fdf24d..0f05f5a 100644 Binary files a/test-cli/test/tests/__pycache__/qi2c.cpython-35.pyc and b/test-cli/test/tests/__pycache__/qi2c.cpython-35.pyc differ diff --git a/test-cli/test/tests/__pycache__/qiperf.cpython-35.pyc b/test-cli/test/tests/__pycache__/qiperf.cpython-35.pyc index b5ac915..ccfc5ed 100644 Binary files a/test-cli/test/tests/__pycache__/qiperf.cpython-35.pyc and b/test-cli/test/tests/__pycache__/qiperf.cpython-35.pyc differ diff --git a/test-cli/test/tests/__pycache__/qram.cpython-35.pyc b/test-cli/test/tests/__pycache__/qram.cpython-35.pyc index 6e68601..e895f4b 100644 Binary files a/test-cli/test/tests/__pycache__/qram.cpython-35.pyc and b/test-cli/test/tests/__pycache__/qram.cpython-35.pyc differ diff --git a/test-cli/test/tests/__pycache__/qrtc.cpython-35.pyc b/test-cli/test/tests/__pycache__/qrtc.cpython-35.pyc index 81badbb..0955b5e 100644 Binary files a/test-cli/test/tests/__pycache__/qrtc.cpython-35.pyc and b/test-cli/test/tests/__pycache__/qrtc.cpython-35.pyc differ diff --git a/test-cli/test/tests/__pycache__/qscreen.cpython-35.pyc b/test-cli/test/tests/__pycache__/qscreen.cpython-35.pyc index cc3a852..001759e 100644 Binary files a/test-cli/test/tests/__pycache__/qscreen.cpython-35.pyc and b/test-cli/test/tests/__pycache__/qscreen.cpython-35.pyc differ diff --git a/test-cli/test/tests/__pycache__/qserial.cpython-35.pyc b/test-cli/test/tests/__pycache__/qserial.cpython-35.pyc index d4494a8..220e137 100644 Binary files a/test-cli/test/tests/__pycache__/qserial.cpython-35.pyc and b/test-cli/test/tests/__pycache__/qserial.cpython-35.pyc differ diff --git a/test-cli/test/tests/__pycache__/qusb.cpython-35.pyc b/test-cli/test/tests/__pycache__/qusb.cpython-35.pyc index 8f1ec80..ce8056f 100644 Binary files a/test-cli/test/tests/__pycache__/qusb.cpython-35.pyc and b/test-cli/test/tests/__pycache__/qusb.cpython-35.pyc differ diff --git a/test-cli/test/tests/__pycache__/qwifi.cpython-35.pyc b/test-cli/test/tests/__pycache__/qwifi.cpython-35.pyc index f894b13..a9e848e 100644 Binary files a/test-cli/test/tests/__pycache__/qwifi.cpython-35.pyc and b/test-cli/test/tests/__pycache__/qwifi.cpython-35.pyc differ diff --git a/test-cli/test/tests/qamp.py b/test-cli/test/tests/qamp.py index 58f4daf..9fcd6d2 100644 --- a/test-cli/test/tests/qamp.py +++ b/test-cli/test/tests/qamp.py @@ -84,3 +84,4 @@ class Qamp(unittest.TestCase): self.fail("failed: UNDERCURRENT DETECTED ( {} )".format(self._current)) return -1 + diff --git a/test-cli/test/tests/qaudio.py b/test-cli/test/tests/qaudio.py index b262c2d..a1572ca 100644 --- a/test-cli/test/tests/qaudio.py +++ b/test-cli/test/tests/qaudio.py @@ -13,32 +13,25 @@ class Qaudio(unittest.TestCase): 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") + 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("command-name", str_cmd) + if audio_loop.execute() == 0:# BUG: Returns -1 but work + lines = audio_loop.getOutput().splitlines() + str_cmd = "multimon -t wav -a DTMF recorded.wav -q 2> /dev/null" + dtmf_decoder = SysCommand("command-name", str_cmd) + if dtmf_decoder.execute() == 0: # BUG: Returns -1 but work + 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 playing/recording file") + self.fail("failed: fail reading recorded file") return -1 else: - self.fail("failed: could not increase loud level") + self.fail("failed: fail playing/recording file") return -1 return 0 diff --git a/test-cli/test/tests/qbutton.py b/test-cli/test/tests/qbutton.py index 1fb204a..72a897e 100644 --- a/test-cli/test/tests/qbutton.py +++ b/test-cli/test/tests/qbutton.py @@ -21,6 +21,9 @@ class Qbutton(unittest.TestCase): disable_pmic = SysCommand("disable_pmic", str_cmd) disable_pmic.execute() # BUG: REPEAT THIS EXECUTION TWICE BECAUSE FIRST TIME IT RETURNS AN ERROR + led_on="echo 1 > /sys/class/leds/red\:usbhost/brightness" + ledon = SysCommand("led_on", led_on) + ledon.execute() time.sleep(0.1) disable_pmic.execute() if disable_pmic.execute() == 0: diff --git a/test-cli/test/tests/qflash.py b/test-cli/test/tests/qflash.py index 660e1c0..cdc4109 100644 --- a/test-cli/test/tests/qflash.py +++ b/test-cli/test/tests/qflash.py @@ -11,6 +11,9 @@ class Qflasher(unittest.TestCase): if model.find("IGEP0046") == 0: self._flash_method = "mx6" self._binlocation="/boot/" + elif model.find("IGEP0000") == 0: + self._flash_method = "mx6" + self._binlocation="/boot/" elif model.find("IGEP0034") == 0: self._flash_method = "nandti" self._binlocation = "/boot/" @@ -71,4 +74,4 @@ class Qflasher(unittest.TestCase): self.fail("failed: could not complete nandtest mtd0") else: - self.fail("failed: could not find flash method") \ No newline at end of file + self.fail("failed: could not find flash method") diff --git a/test-cli/test/tests/qscreen.py b/test-cli/test/tests/qscreen.py index 3beff83..b8a5a48 100644 --- a/test-cli/test/tests/qscreen.py +++ b/test-cli/test/tests/qscreen.py @@ -11,20 +11,15 @@ class Qscreen(unittest.TestCase): 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) + str_cmd = "fbi -T 1 --noverbose -d /dev/{} test/files/test_pattern.png".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??") + if display_image.execute() == -1: + 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: could not display the image") try: diff --git a/test-cli/test/tests/qwifi.py b/test-cli/test/tests/qwifi.py index 8235937..d08149b 100644 --- a/test-cli/test/tests/qwifi.py +++ b/test-cli/test/tests/qwifi.py @@ -42,3 +42,4 @@ class Qwifi(unittest.TestCase): else: self.fail("failed: ping to server {}".format(self._serverip)) + diff --git a/test-cli/test_main.py b/test-cli/test_main.py index 6a8ed7e..3c4d1cb 100644 --- a/test-cli/test_main.py +++ b/test-cli/test_main.py @@ -24,6 +24,7 @@ from test.tests.qrtc import Qrtc from test.tests.qduplex_ser import Qduplex from test.tests.qamp import Qamp from test.tests.qflash import Qflasher +from test.helpers.finisher import Finisher from test.helpers.globalVariables import globalVar # define clear function @@ -80,7 +81,23 @@ def testsuite(): def finish_test(): psdb = TestSrv_Database() psdb.open("setup.xml") - psdb.close_testbatch(globalVar.g_uuid, globalVar.testid_ctl) + auxs = psdb.close_testbatch(globalVar.g_uuid, globalVar.testid_ctl) + globalVar.fstatus = auxs[0][0] + # Burn eeprom struct + psdb = TestSrv_Database() + psdb.open("setup.xml") + # We should call getboard_eeprom only if test was ok + if globalVar.fstatus: + aux = psdb.getboard_eeprom(globalVar.g_uuid) + finish = Finisher(aux) + finish.end_ok() + else: + finish = Finisher(globalVar.g_uuid) + finish.end_fail() + # Update set_test current_test with 'END' so that it finally gets painted in green + psdb = TestSrv_Database() + psdb.open("setup.xml") + psdb.update_set_test_row(globalVar.station, globalVar.testid_ctl, globalVar.g_uuid, "END","FINISH") def main(): #addtesttomodel() -- cgit v1.1