summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test-cli/.idea/dictionaries/hfernandez.xml3
-rw-r--r--test-cli/.idea/inspectionProfiles/profiles_settings.xml1
-rw-r--r--test-cli/.idea/workspace.xml126
-rw-r--r--test-cli/test/helpers/int_registers.py (renamed from test-cli/test/helpers/get_dieid.py)46
-rw-r--r--test-cli/test/helpers/testsrv_db.py26
-rw-r--r--test-cli/test/runners/simple.py39
-rw-r--r--test-cli/test/tests/qamp.py25
-rw-r--r--test-cli/test/tests/qaudio.py35
-rw-r--r--test-cli/test/tests/qbutton.py5
-rw-r--r--test-cli/test/tests/qduplex_ser.py4
-rw-r--r--test-cli/test/tests/qeeprom.py3
-rw-r--r--test-cli/test/tests/qethernet.py3
-rw-r--r--test-cli/test/tests/qflash.py3
-rw-r--r--test-cli/test/tests/qi2c.py3
-rw-r--r--test-cli/test/tests/qiperf.py53
-rw-r--r--test-cli/test/tests/qnand.py5
-rw-r--r--test-cli/test/tests/qram.py5
-rw-r--r--test-cli/test/tests/qrtc.py4
-rw-r--r--test-cli/test/tests/qscreen.py4
-rw-r--r--test-cli/test/tests/qserial.py4
-rw-r--r--test-cli/test/tests/qusb.py28
-rw-r--r--test-cli/test/tests/qwifi.py14
-rw-r--r--test-cli/test_main.py16
23 files changed, 276 insertions, 179 deletions
diff --git a/test-cli/.idea/dictionaries/hfernandez.xml b/test-cli/.idea/dictionaries/hfernandez.xml
new file mode 100644
index 0000000..c85feeb
--- /dev/null
+++ b/test-cli/.idea/dictionaries/hfernandez.xml
@@ -0,0 +1,3 @@
+<component name="ProjectDictionaryState">
+ <dictionary name="hfernandez" />
+</component> \ No newline at end of file
diff --git a/test-cli/.idea/inspectionProfiles/profiles_settings.xml b/test-cli/.idea/inspectionProfiles/profiles_settings.xml
index 105ce2d..dd4c951 100644
--- a/test-cli/.idea/inspectionProfiles/profiles_settings.xml
+++ b/test-cli/.idea/inspectionProfiles/profiles_settings.xml
@@ -1,5 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
+ <option name="PROJECT_PROFILE" value="Default" />
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
diff --git a/test-cli/.idea/workspace.xml b/test-cli/.idea/workspace.xml
index 42f0f8f..cd587e0 100644
--- a/test-cli/.idea/workspace.xml
+++ b/test-cli/.idea/workspace.xml
@@ -2,12 +2,26 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="4991a6e0-1b9d-4824-9b6e-5ac031eb4816" name="Default Changelist" comment="">
- <change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/.idea/test-cli.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/test-cli.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/test/helpers/get_dieid.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/helpers/int_registers.py" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/test/helpers/testsrv_db.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/helpers/testsrv_db.py" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/test/runners/simple.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/runners/simple.py" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/test/tests/qamp.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/tests/qamp.py" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/test/tests/qaudio.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/tests/qaudio.py" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/test/tests/qbutton.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/tests/qbutton.py" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/test/tests/qduplex_ser.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/tests/qduplex_ser.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/tests/qeeprom.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/tests/qeeprom.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/tests/qethernet.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/tests/qethernet.py" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/test/tests/qflash.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/tests/qflash.py" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/test/tests/qi2c.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/tests/qi2c.py" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/test/tests/qiperf.py" beforeDir="false" />
+ <change beforePath="$PROJECT_DIR$/test/tests/qnand.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/tests/qnand.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/tests/qram.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/tests/qram.py" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/test/tests/qrtc.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/tests/qrtc.py" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/test/tests/qscreen.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/tests/qscreen.py" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/test/tests/qserial.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/tests/qserial.py" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/test/tests/qusb.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/tests/qusb.py" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/test/tests/qwifi.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/tests/qwifi.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test_main.py" beforeDir="false" afterPath="$PROJECT_DIR$/test_main.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
@@ -27,9 +41,33 @@
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
+ <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
- <property name="last_opened_file_path" value="$PROJECT_DIR$" />
- <property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
+ <property name="last_opened_file_path" value="$PROJECT_DIR$/test_main.py" />
+ <property name="settings.editor.selected.configurable" value="Errors" />
+ </component>
+ <component name="RunManager">
+ <configuration name="test" type="PythonConfigurationType" factoryName="Python">
+ <module name="test-cli" />
+ <option name="INTERPRETER_OPTIONS" value="" />
+ <option name="PARENT_ENVS" value="true" />
+ <envs>
+ <env name="PYTHONUNBUFFERED" value="1" />
+ </envs>
+ <option name="SDK_HOME" value="/usr/bin/python3.6" />
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+ <option name="IS_MODULE_SDK" value="false" />
+ <option name="ADD_CONTENT_ROOTS" value="true" />
+ <option name="ADD_SOURCE_ROOTS" value="true" />
+ <option name="SCRIPT_NAME" value="$PROJECT_DIR$/test_main.py" />
+ <option name="PARAMETERS" value="" />
+ <option name="SHOW_COMMAND_LINE" value="false" />
+ <option name="EMULATE_TERMINAL" value="false" />
+ <option name="MODULE_MODE" value="false" />
+ <option name="REDIRECT_INPUT" value="false" />
+ <option name="INPUT_FILE" value="" />
+ <method v="2" />
+ </configuration>
</component>
<component name="SvnConfiguration">
<configuration />
@@ -49,13 +87,89 @@
<option name="version" value="1" />
</component>
<component name="WindowStateProjectService">
- <state x="482" y="187" key="SettingsEditor" timestamp="1583395937697">
+ <state x="451" y="210" width="1084" height="713" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1583487479234">
+ <screen x="67" y="27" width="1853" height="1053" />
+ </state>
+ <state x="451" y="210" width="1084" height="713" key="#com.intellij.execution.impl.EditConfigurationsDialog/67.27.1853.1053@67.27.1853.1053" timestamp="1583487479234" />
+ <state width="717" height="568" key="DebuggerActiveHint" timestamp="1583488899608">
+ <screen x="67" y="27" width="1853" height="1053" />
+ </state>
+ <state width="717" height="568" key="DebuggerActiveHint/67.27.1853.1053@67.27.1853.1053" timestamp="1583488899608" />
+ <state x="776" y="324" width="424" height="484" key="FileChooserDialogImpl" timestamp="1583487456480">
+ <screen x="67" y="27" width="1853" height="1053" />
+ </state>
+ <state x="776" y="324" width="424" height="484" key="FileChooserDialogImpl/67.27.1853.1053@67.27.1853.1053" timestamp="1583487456480" />
+ <state width="1830" height="344" key="GridCell.Tab.-1.bottom" timestamp="1583490172702">
+ <screen x="67" y="27" width="1853" height="1053" />
+ </state>
+ <state width="1830" height="344" key="GridCell.Tab.-1.bottom/67.27.1853.1053@67.27.1853.1053" timestamp="1583490172702" />
+ <state width="1830" height="344" key="GridCell.Tab.-1.center" timestamp="1583490172701">
+ <screen x="67" y="27" width="1853" height="1053" />
+ </state>
+ <state width="1830" height="344" key="GridCell.Tab.-1.center/67.27.1853.1053@67.27.1853.1053" timestamp="1583490172701" />
+ <state width="1830" height="344" key="GridCell.Tab.-1.left" timestamp="1583490172701">
+ <screen x="67" y="27" width="1853" height="1053" />
+ </state>
+ <state width="1830" height="344" key="GridCell.Tab.-1.left/67.27.1853.1053@67.27.1853.1053" timestamp="1583490172701" />
+ <state width="1830" height="344" key="GridCell.Tab.-1.right" timestamp="1583490172702">
+ <screen x="67" y="27" width="1853" height="1053" />
+ </state>
+ <state width="1830" height="344" key="GridCell.Tab.-1.right/67.27.1853.1053@67.27.1853.1053" timestamp="1583490172702" />
+ <state width="1807" height="278" key="GridCell.Tab.0.bottom" timestamp="1583492691320">
+ <screen x="67" y="27" width="1853" height="1053" />
+ </state>
+ <state width="1807" height="278" key="GridCell.Tab.0.bottom/67.27.1853.1053@67.27.1853.1053" timestamp="1583492691320" />
+ <state width="1807" height="278" key="GridCell.Tab.0.center" timestamp="1583492691319">
+ <screen x="67" y="27" width="1853" height="1053" />
+ </state>
+ <state width="1807" height="278" key="GridCell.Tab.0.center/67.27.1853.1053@67.27.1853.1053" timestamp="1583492691319" />
+ <state width="1807" height="278" key="GridCell.Tab.0.left" timestamp="1583492691319">
+ <screen x="67" y="27" width="1853" height="1053" />
+ </state>
+ <state width="1807" height="278" key="GridCell.Tab.0.left/67.27.1853.1053@67.27.1853.1053" timestamp="1583492691319" />
+ <state width="1807" height="278" key="GridCell.Tab.0.right" timestamp="1583492691320">
+ <screen x="67" y="27" width="1853" height="1053" />
+ </state>
+ <state width="1807" height="278" key="GridCell.Tab.0.right/67.27.1853.1053@67.27.1853.1053" timestamp="1583492691320" />
+ <state width="1830" height="344" key="GridCell.Tab.1.bottom" timestamp="1583490132185">
+ <screen x="67" y="27" width="1853" height="1053" />
+ </state>
+ <state width="1830" height="344" key="GridCell.Tab.1.bottom/67.27.1853.1053@67.27.1853.1053" timestamp="1583490132185" />
+ <state width="1830" height="344" key="GridCell.Tab.1.center" timestamp="1583490132185">
+ <screen x="67" y="27" width="1853" height="1053" />
+ </state>
+ <state width="1830" height="344" key="GridCell.Tab.1.center/67.27.1853.1053@67.27.1853.1053" timestamp="1583490132185" />
+ <state width="1830" height="344" key="GridCell.Tab.1.left" timestamp="1583490132185">
+ <screen x="67" y="27" width="1853" height="1053" />
+ </state>
+ <state width="1830" height="344" key="GridCell.Tab.1.left/67.27.1853.1053@67.27.1853.1053" timestamp="1583490132185" />
+ <state width="1830" height="344" key="GridCell.Tab.1.right" timestamp="1583490132185">
+ <screen x="67" y="27" width="1853" height="1053" />
+ </state>
+ <state width="1830" height="344" key="GridCell.Tab.1.right/67.27.1853.1053@67.27.1853.1053" timestamp="1583490132185" />
+ <state x="482" y="187" key="SettingsEditor" timestamp="1583495091828">
<screen x="67" y="27" width="1853" height="1053" />
</state>
- <state x="482" y="187" key="SettingsEditor/67.27.1853.1053@67.27.1853.1053" timestamp="1583395937697" />
+ <state x="482" y="187" key="SettingsEditor/67.27.1853.1053@67.27.1853.1053" timestamp="1583495091828" />
<state x="641" y="119" width="704" height="867" key="find.popup" timestamp="1583427991724">
<screen x="67" y="27" width="1853" height="1053" />
</state>
<state x="641" y="119" width="704" height="867" key="find.popup/67.27.1853.1053@67.27.1853.1053" timestamp="1583427991724" />
</component>
+ <component name="XDebuggerManager">
+ <breakpoint-manager>
+ <breakpoints>
+ <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
+ <url>file://$PROJECT_DIR$/test/runners/simple.py</url>
+ <line>83</line>
+ <option name="timeStamp" value="14" />
+ </line-breakpoint>
+ <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
+ <url>file://$PROJECT_DIR$/test/runners/simple.py</url>
+ <line>58</line>
+ <option name="timeStamp" value="15" />
+ </line-breakpoint>
+ </breakpoints>
+ </breakpoint-manager>
+ </component>
</project> \ No newline at end of file
diff --git a/test-cli/test/helpers/get_dieid.py b/test-cli/test/helpers/int_registers.py
index 48e724e..cf2e35b 100644
--- a/test-cli/test/helpers/get_dieid.py
+++ b/test-cli/test/helpers/int_registers.py
@@ -21,24 +21,36 @@ def read(addr):
os.close(fd)
return "%08X" % retval[0]
-def getRegisters(model):
- if model.find("IGEP0046") == 0:
+
+def get_die_id(modelid):
+ dieid = ""
+
+ # get registers
+ if modelid.find("IGEP0046") == 0:
registers = [0x021BC420, 0x021BC410]
- elif model.find("IGEP0034") == 0 or model.find("SOPA0000") == 0:
+ elif modelid.find("IGEP0034") == 0 or modelid.find("SOPA0000") == 0:
+ # registers: mac_id0_lo, mac_id0_hi, mac_id1_lo, mac_id1_hi
registers = [0x44e10630, 0x44e10634, 0x44e10638, 0x44e1063C]
- elif model.find("OMAP3") == 0:
+ elif modelid.find("OMAP3") == 0:
registers = [0x4830A224, 0x4830A220, 0x4830A21C, 0x4830A218]
- elif model.find("OMAP5") == 0:
+ elif modelid.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))
+ else:
+ raise Exception('modelid not defined')
+
+ for rg in registers:
+ dieid = dieid + read(rg)
+ return dieid
+
+
+def get_mac(modelid):
+ mac = None
+
+ if modelid.find("IGEP0034") == 0 or modelid.find("SOPA0000") == 0:
+ # registers: mac_id0_lo, mac_id0_hi
+ registers = [0x44e10630, 0x44e10634]
+ mac = ""
+ for rg in registers:
+ mac = mac + read(rg)
+
+ return mac
diff --git a/test-cli/test/helpers/testsrv_db.py b/test-cli/test/helpers/testsrv_db.py
index b7b75b1..d937d3e 100644
--- a/test-cli/test/helpers/testsrv_db.py
+++ b/test-cli/test/helpers/testsrv_db.py
@@ -27,11 +27,13 @@ class TestSrv_Database(object):
def create_board(self, processor_id, model_id, variant, station, bmac=None):
'''create a new board'''
if bmac is None:
- sql = "SELECT isee.f_create_board('{}', '{}', '{}', NULL, '{}');".format(processor_id, model_id, variant,
- station)
+ sql = "SELECT * FROM isee.f_create_board('{}', '{}', '{}', NULL, '{}');".format(processor_id, model_id,
+ variant,
+ station)
else:
- sql = "SELECT isee.f_create_board('{}', '{}', '{}', '{}', '{}');".format(processor_id, model_id, variant,
- bmac, station)
+ sql = "SELECT * FROM isee.f_create_board('{}', '{}', '{}', '{}', '{}');".format(processor_id, model_id,
+ variant,
+ bmac, station)
# print('>>>' + sql)
try:
res = self.__sqlObject.db_execute_query(sql)
@@ -57,7 +59,7 @@ class TestSrv_Database(object):
def get_test_params_list(self, testid):
'''get the board test list'''
- sql = "SELECT * FROM isee.f_get_test_params_list('{}')".format(testid)
+ sql = "SELECT * FROM isee.f_get_test_params_list({})".format(testid)
# print('>>>' + sql)
try:
res = self.__sqlObject.db_execute_query(sql)
@@ -75,7 +77,7 @@ class TestSrv_Database(object):
try:
res = self.__sqlObject.db_execute_query(sql)
# print(res)
- return res
+ return res[0][0]
except Exception as err:
r = find_between(str(err), '#', '#')
# print(r)
@@ -83,12 +85,10 @@ class TestSrv_Database(object):
def run_test(self, testid_ctl, testid):
'''get the board test list'''
- sql = "SELECT * FROM isee.f_run_test('{}','{}')".format(testid_ctl, testid)
+ sql = "SELECT isee.f_run_test({},{})".format(testid_ctl, testid)
# print('>>>' + sql)
try:
- res = self.__sqlObject.db_execute_query(sql)
- # print(res)
- return res
+ self.__sqlObject.db_execute_query(sql)
except Exception as err:
r = find_between(str(err), '#', '#')
# print(r)
@@ -96,12 +96,10 @@ class TestSrv_Database(object):
def finish_test(self, testid_ctl, testid, newstatus):
'''get the board test list'''
- sql = "SELECT * FROM isee.f_finish_test('{}','{}','{}')".format(testid_ctl, testid, newstatus)
+ sql = "SELECT isee.f_finish_test({},{},'{}')".format(testid_ctl, testid, newstatus)
# print('>>>' + sql)
try:
- res = self.__sqlObject.db_execute_query(sql)
- # print(res)
- return res
+ self.__sqlObject.db_execute_query(sql)
except Exception as err:
r = find_between(str(err), '#', '#')
# print(r)
diff --git a/test-cli/test/runners/simple.py b/test-cli/test/runners/simple.py
index 084a5b8..dd7c74d 100644
--- a/test-cli/test/runners/simple.py
+++ b/test-cli/test/runners/simple.py
@@ -12,7 +12,6 @@ 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.
@@ -33,15 +32,12 @@ class SimpleTestRunner:
self.stream.write(message)
def run(self, test):
- """ Run the given test case or Test Suite.
-
- """
+ """ Run the given test case or Test Suite. """
result = TextTestResult(self, self.__pgObj)
test(result)
- result.testsRun
- # self.writeUpdate("---------------------------------------------\n")
return result
+
class TextTestResult(unittest.TestResult):
# Print in terminal with colors
PASS = '\033[32mPASS\033[0m\n'
@@ -60,14 +56,11 @@ class TextTestResult(unittest.TestResult):
unittest.TestResult.startTest(self, test)
self.runner.writeUpdate("%s : " % test.shortDescription())
# SEND TO DB THE UPDATE THAT WE RUN EACH TEST
- self.__pgObj.update_set_test_row(globalVar.station, globalVar.testid_ctl, globalVar.g_uuid, test.shortDescription(), "RUNNING")
- # psdb = TestSrv_Database()
- # psdb.open("setup.xml")
- # psdb.update_set_test_row(globalVar.station, globalVar.testid_ctl, globalVar.g_uuid, test.shortDescription(), "RUNNING")
+ self.__pgObj.run_test(test.params["testidctl"], test.params["testid"])
def addSuccess(self, test):
unittest.TestResult.addSuccess(self, test)
- self.result=self.PASS
+ self.result = self.PASS
def addError(self, test, err):
unittest.TestResult.addError(self, test, err)
@@ -76,25 +69,17 @@ class TextTestResult(unittest.TestResult):
def addFailure(self, test, err):
unittest.TestResult.addFailure(self, test, err)
- test.longMessage=err[1]
+ 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)
- #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")
- self.__pgObj.add_test_to_batch(globalVar.g_uuid, test.shortDescription(), globalVar.testid_ctl, simple_result, globalVar.g_mid, test.longMessage)
- # psdb.add_test_to_batch(globalVar.g_uuid, test.shortDescription(), globalVar.testid_ctl, simple_result, globalVar.g_mid, test.longMessage)
+ # SEND TO DB THE RESULT OF THE TEST
+ if self.result == self.PASS:
+ status = "TEST_COMPLETE"
+ else:
+ status = "TEST_FAILED"
+ self.__pgObj.finish_test(test.params["testidctl"], test.params["testid"], status)
+
diff --git a/test-cli/test/tests/qamp.py b/test-cli/test/tests/qamp.py
index 3e38ce9..cf18fc5 100644
--- a/test-cli/test/tests/qamp.py
+++ b/test-cli/test/tests/qamp.py
@@ -3,10 +3,13 @@ import unittest
import serial
import time
+
class Qamp(unittest.TestCase):
+ params = None
- #varlist: undercurrent, overcurrent
+ # varlist: undercurrent, overcurrent
def __init__(self, testname, testfunc, varlist):
+ self.params = varlist
self._current = 0.0
if "undercurrent" in varlist:
self._undercurrent = varlist["undercurrent"]
@@ -16,7 +19,7 @@ class Qamp(unittest.TestCase):
self._overcurrent = varlist["overcurrent"]
else:
raise Exception('overcurrent param inside Qamp must be defined')
- self._vshuntfactor=16384.0
+ self._vshuntfactor = 16384.0
self._ser = serial.Serial()
self._ser.port = '/dev/ttyUSB0'
self._ser.baudrate = 115200
@@ -34,19 +37,19 @@ class Qamp(unittest.TestCase):
def execute(self):
# Open Serial port ttyUSB0
- error=0
+ error = 0
try:
self._ser.open()
except:
self.fail("failed: IMPOSSIBLE OPEN USB-SERIAL PORT ( {} )".format(self._ser.port))
- error=1
- if error==0:
+ error = 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+in?\n\r')
+ 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.
@@ -57,7 +60,7 @@ class Qamp(unittest.TestCase):
# Read, 1 by 1 byte
res = []
- while (self._ser.inWaiting() > 0): # if incoming bytes are waiting to be read from the serial input buffer
+ 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)
@@ -65,12 +68,8 @@ class Qamp(unittest.TestCase):
self._current = float(int(string, 0)) / self._vshuntfactor
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)):
+ if self._current > float(self._overcurrent):
self.fail("failed: OVERCURRENT DETECTED ( {} )".format(self._current))
- if (self._current < float(self._undercurrent)):
+ if self._current < float(self._undercurrent):
self.fail("failed: UNDERCURRENT DETECTED ( {} )".format(self._current))
-
-
-
-
diff --git a/test-cli/test/tests/qaudio.py b/test-cli/test/tests/qaudio.py
index fe57be2..ef4da67 100644
--- a/test-cli/test/tests/qaudio.py
+++ b/test-cli/test/tests/qaudio.py
@@ -1,38 +1,39 @@
from test.helpers.syscmd import SysCommand
import unittest
-#class name
+
+
class Qaudio(unittest.TestCase):
- # Initialize the variables
+ params = None
- def __init__(self, testname, testfunc, dtmfFile):
- # Doing this we will initialize the class and later on perform a particular method inside this class
+ def __init__(self, testname, testfunc, varlist):
+ self.params = varlist
super(Qaudio, self).__init__(testfunc)
self._testMethodDoc = testname
- self._dtmfFile=dtmfFile
- self.__sum=0
- self.__refSum = 25 # 1+3+5+7+9
+ if "dtmfFile" in varlist:
+ self._dtmfFile = varlist["dtmfFile"]
+ else:
+ raise Exception('undercurrent param inside Qamp must be defined')
+ self.__sum = 0
+ self.__refSum = 25 # 1+3+5+7+9
def execute(self):
- str_cmd = "aplay test/files/dtmf-13579.wav & arecord -r 8000 -d 1 recorded.wav" #.format(self.__dtmfFile)
+ str_cmd = "aplay test/files/dtmf-13579.wav & arecord -r 8000 -d 1 recorded.wav" # .format(self.__dtmfFile)
audio_loop = SysCommand("command-name", str_cmd)
- if audio_loop.execute() == -1:# BUG: Returns -1 but work
+ if audio_loop.execute() == -1: # BUG: Returns -1 but work
lines = audio_loop.getOutput().splitlines()
str_cmd = "multimon -t wav -a DTMF recorded.wav -q"
dtmf_decoder = SysCommand("command-name", str_cmd)
- a=dtmf_decoder.execute()
- if dtmf_decoder.execute() == -1: # BUG: Returns -1 but work
+ a = dtmf_decoder.execute()
+ if dtmf_decoder.execute() == -1: # BUG: Returns -1 but work
self.__raw_out = dtmf_decoder.getOutput()
if self.__raw_out == "":
- return -1
+ self.fail("failed: can not execute multimon command")
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]
+ 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
- return 0 \ No newline at end of file
diff --git a/test-cli/test/tests/qbutton.py b/test-cli/test/tests/qbutton.py
index 4718924..46ddde0 100644
--- a/test-cli/test/tests/qbutton.py
+++ b/test-cli/test/tests/qbutton.py
@@ -1,11 +1,14 @@
from test.helpers.syscmd import SysCommand
import unittest
-import uuid
import time
+
class Qbutton(unittest.TestCase):
+ params = None
def __init__(self, testname, testfunc, varlist):
+ self.params = varlist
+ super(Qbutton, self).__init__(testfunc)
if "gpio" in varlist:
self.__gpio = varlist["gpio"]
else:
diff --git a/test-cli/test/tests/qduplex_ser.py b/test-cli/test/tests/qduplex_ser.py
index 837b4d0..46fb5db 100644
--- a/test-cli/test/tests/qduplex_ser.py
+++ b/test-cli/test/tests/qduplex_ser.py
@@ -1,12 +1,14 @@
-from test.helpers.syscmd import SysCommand
import unittest
import uuid
import serial
import time
+
class Qduplex(unittest.TestCase):
+ params = None
def __init__(self, testname, testfunc, varlist):
+ self.params = varlist
super(Qduplex, self).__init__(testfunc)
if "port1" in varlist:
self.__port1 = varlist["port1"]
diff --git a/test-cli/test/tests/qeeprom.py b/test-cli/test/tests/qeeprom.py
index acdc1f6..d2c55ef 100644
--- a/test-cli/test/tests/qeeprom.py
+++ b/test-cli/test/tests/qeeprom.py
@@ -3,12 +3,13 @@ import unittest
class Qeeprom(unittest.TestCase):
-
+ params = None
__position = None
__eeprompath = None
# varlist: position, eeprompath
def __init__(self, testname, testfunc, varlist):
+ self.params = varlist
super(Qeeprom, self).__init__(testfunc)
self._testMethodDoc = testname
if "position" in varlist:
diff --git a/test-cli/test/tests/qethernet.py b/test-cli/test/tests/qethernet.py
index adee67f..1d4c9bc 100644
--- a/test-cli/test/tests/qethernet.py
+++ b/test-cli/test/tests/qethernet.py
@@ -9,8 +9,11 @@ class Qethernet(unittest.TestCase):
__bind = None
__bwexpected = None
__port = None
+ params = None
+ #varlist content: serverip, bwexpected, port, (optional)bind
def __init__(self, testname, testfunc, varlist):
+ self.params = varlist
super(Qethernet, self).__init__(testfunc)
if "serverip" in varlist:
self.__serverip = varlist["serverip"]
diff --git a/test-cli/test/tests/qflash.py b/test-cli/test/tests/qflash.py
index 0c3fcb5..59ed13d 100644
--- a/test-cli/test/tests/qflash.py
+++ b/test-cli/test/tests/qflash.py
@@ -2,9 +2,12 @@ from test.helpers.syscmd import SysCommand
import unittest
from test.helpers.globalVariables import globalVar
+
class Qflasher(unittest.TestCase):
+ params = None
def __init__(self, testname, testfunc, varlist):
+ self.params = varlist
super(Qflasher, self).__init__(testfunc)
self._testMethodDoc = testname
model=globalVar.g_mid
diff --git a/test-cli/test/tests/qi2c.py b/test-cli/test/tests/qi2c.py
index 2f14424..71eb64e 100644
--- a/test-cli/test/tests/qi2c.py
+++ b/test-cli/test/tests/qi2c.py
@@ -1,9 +1,12 @@
from test.helpers.syscmd import SysCommand
import unittest
+
class Qi2c(unittest.TestCase):
+ params = None
def __init__(self, testname, testfunc, varlist):
+ self.params = varlist
super(Qi2c, self).__init__(testfunc)
if "busnum" in varlist:
self.__busnum = varlist["busnum"]
diff --git a/test-cli/test/tests/qiperf.py b/test-cli/test/tests/qiperf.py
deleted file mode 100644
index 126b6ee..0000000
--- a/test-cli/test/tests/qiperf.py
+++ /dev/null
@@ -1,53 +0,0 @@
-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/test-cli/test/tests/qnand.py b/test-cli/test/tests/qnand.py
index 9f2cd47..5125c1c 100644
--- a/test-cli/test/tests/qnand.py
+++ b/test-cli/test/tests/qnand.py
@@ -1,14 +1,15 @@
import unittest
import sh
-class Qnand(unittest.TestCase):
+class Qnand(unittest.TestCase):
+ params = None
__device = "10M"
# varlist: device
def __init__(self, testname, testfunc, varlist):
+ self.params = varlist
super(Qnand, self).__init__(testfunc)
-
if "device" in varlist:
self.__device = varlist["device"]
else:
diff --git a/test-cli/test/tests/qram.py b/test-cli/test/tests/qram.py
index ade7aeb..cc75b68 100644
--- a/test-cli/test/tests/qram.py
+++ b/test-cli/test/tests/qram.py
@@ -1,15 +1,16 @@
import unittest
import sh
-class Qram(unittest.TestCase):
+class Qram(unittest.TestCase):
+ params = None
__memsize = "10M"
__loops = "1"
# varlist: memsize, loops
def __init__(self, testname, testfunc, varlist):
+ self.params = varlist
super(Qram, self).__init__(testfunc)
-
if "memsize" in varlist:
self.__memsize = varlist["memsize"]
else:
diff --git a/test-cli/test/tests/qrtc.py b/test-cli/test/tests/qrtc.py
index 8e31572..884a290 100644
--- a/test-cli/test/tests/qrtc.py
+++ b/test-cli/test/tests/qrtc.py
@@ -2,11 +2,13 @@ from test.helpers.syscmd import SysCommand
import unittest
import time
-class Qrtc(unittest.TestCase):
+class Qrtc(unittest.TestCase):
+ params = None
__rtc = "/dev/rtc0"
def __init__(self, testname, testfunc, varlist):
+ self.params = varlist
super(Qrtc, self).__init__(testfunc)
if "rtc" in varlist:
self.__rtc = varlist["rtc"]
diff --git a/test-cli/test/tests/qscreen.py b/test-cli/test/tests/qscreen.py
index 87e53b2..aaee628 100644
--- a/test-cli/test/tests/qscreen.py
+++ b/test-cli/test/tests/qscreen.py
@@ -1,12 +1,14 @@
from test.helpers.syscmd import SysCommand
import unittest
-import time
from test.helpers.cv_display_test import pattern_detect
+
class Qscreen(unittest.TestCase):
+ params = None
#varlist: display
def __init__(self, testname, testfunc, varlist):
+ self.params = varlist
super(Qscreen, self).__init__(testfunc)
if "display" in varlist:
self.__display = varlist["display"]
diff --git a/test-cli/test/tests/qserial.py b/test-cli/test/tests/qserial.py
index d3e2ee6..d798578 100644
--- a/test-cli/test/tests/qserial.py
+++ b/test-cli/test/tests/qserial.py
@@ -1,12 +1,14 @@
-from test.helpers.syscmd import SysCommand
import unittest
import uuid
import serial
import time
+
class Qserial(unittest.TestCase):
+ params = None
def __init__(self, testname, testfunc, varlist):
+ self.params = varlist
super(Qserial, self).__init__(testfunc)
if "port" in varlist:
self.__port = varlist["port"]
diff --git a/test-cli/test/tests/qusb.py b/test-cli/test/tests/qusb.py
index 0390143..70265a5 100644
--- a/test-cli/test/tests/qusb.py
+++ b/test-cli/test/tests/qusb.py
@@ -1,9 +1,14 @@
from test.helpers.syscmd import SysCommand
import unittest
+
class Qusb(unittest.TestCase):
+ __numPorts = None
+ __devLabel = None
+ params = None
def __init__(self, testname, testfunc, varlist):
+ self.params = varlist
super(Qusb, self).__init__(testfunc)
if "numPorts" in varlist:
self.__numPorts = varlist["numPorts"]
@@ -14,27 +19,27 @@ class Qusb(unittest.TestCase):
self.__devLabel = varlist["devLabel"]
else:
raise Exception('devLabel param inside Qusb must be defined')
- if testname=="USBOTG":
+ if testname == "USBOTG":
self.__usbFileName = "/this_is_an_usb_otg"
self.__usbtext = "USBOTG"
else:
self.__usbFileName = "/this_is_an_usb_host"
self.__usbtext = "USBHOST"
- self.__numUsbFail=[]
+ self.__numUsbFail = []
def execute(self):
- str_cmd= "lsblk -o LABEL"
+ 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=[]
+ host_list = []
for i in range(len(lines)):
- if str(lines[i].decode('ascii'))==self.__devLabel:
+ if str(lines[i].decode('ascii')) == self.__devLabel:
host_list.append(i)
- if len(host_list)==int(self.__numPorts):
+ if len(host_list) == int(self.__numPorts):
str_cmd = "lsblk -o MOUNTPOINT"
lsblk_command = SysCommand("lsblk", str_cmd)
if lsblk_command.execute() == 0:
@@ -45,13 +50,14 @@ class Qusb(unittest.TestCase):
else:
lines = lsblk_command.getOutput().splitlines()
for i in range(len(host_list)):
- file_path=str(lines[host_list[i]].decode('ascii')) + self.__usbFileName
+ 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:
+ 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.fail(
+ "failed: could not read from usb {}".format(lines[host_list[i]].decode('ascii')))
self.__numUsbFail.append(host_list[i])
usb_file.close()
else:
@@ -60,4 +66,4 @@ class Qusb(unittest.TestCase):
else:
self.fail("failed: reference and real usb host devices number mismatch")
else:
- self.fail("failed: couldn't execute lsblk command") \ No newline at end of file
+ self.fail("failed: couldn't execute lsblk command")
diff --git a/test-cli/test/tests/qwifi.py b/test-cli/test/tests/qwifi.py
index 154dd52..2a5fa0c 100644
--- a/test-cli/test/tests/qwifi.py
+++ b/test-cli/test/tests/qwifi.py
@@ -9,14 +9,16 @@ class Qwifi(unittest.TestCase):
__bind = None
__OKBW = None
__port = None
+ params = None
- #varlist: sip, bind, OKBW, port
+ #varlist: serverip, bind, OKBW, port
def __init__(self, testname, testfunc, varlist):
+ self.params = varlist
super(Qwifi, self).__init__(testfunc)
- if "sip" in varlist:
- self.__sip = varlist["sip"]
+ if "serverip" in varlist:
+ self.__serverip = varlist["serverip"]
else:
- raise Exception('sip param inside Qwifi have been be defined')
+ raise Exception('serverip param inside Qwifi have been be defined')
if "OKBW" in varlist:
self.__OKBW = varlist["OKBW"]
else:
@@ -47,10 +49,10 @@ class Qwifi(unittest.TestCase):
if result:
# execute iperf command against the server
if self.__bind is None:
- p = sh.iperf("-c", self.__sip, "-x", "CMSV", "-n", self.__numbytestx, "-f", "m", "-p",
+ p = sh.iperf("-c", self.__serverip, "-x", "CMSV", "-n", self.__numbytestx, "-f", "m", "-p",
self.__port)
else:
- p = sh.iperf("-c", self.__sip, "-x", "CMSV", "-n", self.__numbytestx, "-f", "m", "-p",
+ p = sh.iperf("-c", self.__serverip, "-x", "CMSV", "-n", self.__numbytestx, "-f", "m", "-p",
self.__port, "-B", self.__bind)
# check if it was executed succesfully
if p.exit_code == 0:
diff --git a/test-cli/test_main.py b/test-cli/test_main.py
index c09d703..48ec534 100644
--- a/test-cli/test_main.py
+++ b/test-cli/test_main.py
@@ -1,4 +1,5 @@
-from test.helpers.get_dieid import genDieid
+from test.helpers.int_registers import get_die_id
+from test.helpers.int_registers import get_mac
from subprocess import call
import xml.etree.ElementTree as XMLParser
import errno
@@ -92,6 +93,8 @@ def add_test_task(suite, testdefname, paramlist):
def create_testsuite():
# create an object TestSuite
suite = unittest.TestSuite()
+ # get id of the full test for this board
+ globalVar.testid_ctl = psdbObj.open_test(globalVar.g_uuid)
# get list of tests for this board
tests = psdbObj.get_tests_list(globalVar.g_uuid)
# loop in every test for this board
@@ -100,11 +103,13 @@ def create_testsuite():
# get params for this test
params = psdbObj.get_test_params_list(testid)
paramlist = create_paramslist(params)
+ # add the testid as parameter
+ paramlist["testid"] = testid
+ paramlist["boarduuid"] = globalVar.g_uuid
+ paramlist["testidctl"] = globalVar.testid_ctl
# add test to TestSuite
add_test_task(suite, testdefname, paramlist)
- globalVar.testid_ctl = psdbObj.open_test(globalVar.g_uuid)
-
return suite
@@ -118,10 +123,11 @@ def create_board():
# get station
globalVar.station = socket.gethostname()
- processor_id = genDieid(globalVar.g_mid)
+ processor_id = get_die_id(globalVar.g_mid)
print(globalVar.g_mid)
print(processor_id)
- globalVar.g_uuid = psdbObj.create_board(processor_id, model_id, variant, globalVar.station, bmac=None)
+ globalVar.g_uuid = psdbObj.create_board(processor_id, model_id, variant, globalVar.station,
+ get_mac(globalVar.g_mid))
def main():