diff options
author | Manel Caro <mcaro@iseebcn.com> | 2020-03-04 17:46:36 +0100 |
---|---|---|
committer | Manel Caro <mcaro@iseebcn.com> | 2020-03-04 17:46:36 +0100 |
commit | 09de774dcc1a5abc1c8f3a00fdb039aa3c522f52 (patch) | |
tree | c4bd3963d0df01d2e3a33732247388ed4651b186 /test-cli/test/tests/qram.py | |
parent | b6932fbaf898724ae87c29f8965621610f377084 (diff) | |
download | board-09de774dcc1a5abc1c8f3a00fdb039aa3c522f52.zip board-09de774dcc1a5abc1c8f3a00fdb039aa3c522f52.tar.gz board-09de774dcc1a5abc1c8f3a00fdb039aa3c522f52.tar.bz2 |
SOPA Initial Commit
Diffstat (limited to 'test-cli/test/tests/qram.py')
-rw-r--r-- | test-cli/test/tests/qram.py | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/test-cli/test/tests/qram.py b/test-cli/test/tests/qram.py index 8ec0210..1b66e5c 100644 --- a/test-cli/test/tests/qram.py +++ b/test-cli/test/tests/qram.py @@ -1,22 +1,27 @@ -from test.helpers.syscmd import SysCommand import unittest +import sh class Qram(unittest.TestCase): - def __init__(self, testname, testfunc, memSize): + __memSize = "10M" + __loops = "1" + + # varlist: memSize, loops + def __init__(self, testname, testfunc, varlist): super(Qram, self).__init__(testfunc) - self.__memSize = memSize + + if "memSize" in varlist: + self.__memSize = varlist["memSize"] + else: + raise Exception('memSize param inside Qram must be defined') + if "loops" in varlist: + self.__loops = varlist["loops"] + else: + raise Exception('loops param inside Qram must be defined') 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") + try: + sh.memtester(self.__memSize, "1") + except sh.ErrorReturnCode as e: + self.fail("failed: could not complete memtester command") |