summaryrefslogtreecommitdiff
path: root/test-cli/test/tests/qram.py
blob: 5a7734a9c58439ae6fd2c911629cd79a0b2521e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import unittest
import sh


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:
            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):
        try:
            sh.memtester(self.__memsize, "1", _out="/dev/null")
        except sh.ErrorReturnCode as e:
            self.fail("failed: could not complete memtester command")