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
|
import sh
import os
import os.path
from os import path
class Qdmesg:
params = None
__resultlist = None # resultlist is a python list of python dictionaries
def __init__(self, testname, testfunc, varlist):
self.params = varlist
self.__testMethodDoc = testname
self.__resultlist = []
self.pgObj = varlist["db"]
self.__xmlObj = varlist["xml"]
self.__QdmesgName = varlist.get('name', 'qdmesg')
self.__syslog_dmesg_file = varlist.get('syslog_dmesg',self.__xmlObj.getKeyVal(self.__QdmesgName, "syslog_dmesg",
"/var/log/kern.log"))
def getTestName(self):
return self.__testMethodDoc
def execute(self):
self.pgObj.run_test(self.params["testidctl"], self.params["testid"])
if not os.path.isfile('{}'.format(self.__syslog_dmesg_file)):
self.pgObj.finish_test(self.params["testidctl"], self.params["testid"], "TEST_FAILED", "")
return False
self.pgObj.upload_result_file(self.params["testidctl"], self.params["testid"], "{}".format(self.__syslog_dmesg_file),
"{}".format(self.__syslog_dmesg_file), "text/plain")
self.pgObj.finish_test(self.params["testidctl"], self.params["testid"], "TEST_COMPLETE", "")
return True
|