summaryrefslogtreecommitdiff
path: root/test-cli/test/tests/qi2c.py
diff options
context:
space:
mode:
authorHector Fernandez <hector@iatec.biz>2020-07-01 10:45:34 +0200
committerHector Fernandez <hector@iatec.biz>2020-07-01 10:45:34 +0200
commit34df86b37d6838b115e65e5f3a332344afeb86b8 (patch)
tree946e1d7d6d55a4339e453c84c4fbbf4b785a1712 /test-cli/test/tests/qi2c.py
parent9ac8a326412b04e4873b883c2f2a056ca0b22480 (diff)
downloadboard-34df86b37d6838b115e65e5f3a332344afeb86b8.zip
board-34df86b37d6838b115e65e5f3a332344afeb86b8.tar.gz
board-34df86b37d6838b115e65e5f3a332344afeb86b8.tar.bz2
Changes to adapt to new way to save results in DB. Created audio test. Added protections against unexpected status in DB.
Diffstat (limited to 'test-cli/test/tests/qi2c.py')
-rw-r--r--test-cli/test/tests/qi2c.py67
1 files changed, 0 insertions, 67 deletions
diff --git a/test-cli/test/tests/qi2c.py b/test-cli/test/tests/qi2c.py
deleted file mode 100644
index 3afedfa..0000000
--- a/test-cli/test/tests/qi2c.py
+++ /dev/null
@@ -1,67 +0,0 @@
-from test.helpers.syscmd import SysCommand
-import unittest
-
-
-class Qi2c(unittest.TestCase):
- params = None
- __resultlist = None # resultlist is a python list of python dictionaries
-
- def __init__(self, testname, testfunc, varlist):
- self.params = varlist
- super(Qi2c, self).__init__(testfunc)
- if "busnum" in varlist:
- self.__busnum = varlist["busnum"]
- else:
- raise Exception('busnum param inside Qi2c must be defined')
- if "register" in varlist:
- self.__register = varlist["register"].split("/")
- else:
- raise Exception('register param inside Qi2c must be defined')
- self.__devices = []
- self._testMethodDoc = testname
- self.__resultlist = []
-
- 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.__resultlist.append(
- {
- "desc": "Test result",
- "data": "FAILED: device {} not found in bus i2c-{}".format(self.__register[i], self.__busnum),
- "type": "string"
- }
- )
- self.fail("failed: device {} not found in bus i2c-{}".format(self.__register[i], self.__busnum))
- else:
- self.__resultlist.append(
- {
- "desc": "Test result",
- "data": "FAILED: could not complete i2cdedtect command",
- "type": "string"
- }
- )
- self.fail("failed: could not complete i2cdedtect command.")
-
- # Test successful
- self.__resultlist.append(
- {
- "desc": "Test result",
- "data": "OK",
- "type": "string"
- }
- )
-
- def getresults(self):
- return self.__resultlist