summaryrefslogtreecommitdiff
path: root/test-cli/test/tests/qeeprom.py
diff options
context:
space:
mode:
Diffstat (limited to 'test-cli/test/tests/qeeprom.py')
-rw-r--r--test-cli/test/tests/qeeprom.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/test-cli/test/tests/qeeprom.py b/test-cli/test/tests/qeeprom.py
new file mode 100644
index 0000000..f72f78f
--- /dev/null
+++ b/test-cli/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")