summaryrefslogtreecommitdiff
path: root/test-cli/test/tests/qram.py
blob: 21a01c8569fcf1f7d0bb9a85bc3565577bbc9333 (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
29
30
31
32
33
34
35
36
import unittest
import sh


class Qram(unittest.TestCase):
    params = None
    __memsize = "10M"
    __loops = "1"
    __resultlist = None  # resultlist is a python list of python dictionaries

    # 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
        self.__resultlist = []

    def execute(self):
        try:
            p = sh.memtester(self.__memsize, "1", _out="/dev/null")
        except sh.ErrorReturnCode as e:
            self.fail("failed: could not complete memtester command")

    def getresults(self):
        return self.__resultlist

    def gettextresult(self):
        return ""