diff options
author | Hector Fernandez <hector@iatec.biz> | 2020-07-01 10:45:34 +0200 |
---|---|---|
committer | Hector Fernandez <hector@iatec.biz> | 2020-07-01 10:45:34 +0200 |
commit | 34df86b37d6838b115e65e5f3a332344afeb86b8 (patch) | |
tree | 946e1d7d6d55a4339e453c84c4fbbf4b785a1712 /test-cli/test/tests/qdmesg.py | |
parent | 9ac8a326412b04e4873b883c2f2a056ca0b22480 (diff) | |
download | board-34df86b37d6838b115e65e5f3a332344afeb86b8.zip board-34df86b37d6838b115e65e5f3a332344afeb86b8.tar.gz board-34df86b37d6838b115e65e5f3a332344afeb86b8.tar.bz2 |
Changes to adapt to new way to save results in DB. Created audio test. Added protections against unexpected status in DB.
Diffstat (limited to 'test-cli/test/tests/qdmesg.py')
-rw-r--r-- | test-cli/test/tests/qdmesg.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test-cli/test/tests/qdmesg.py b/test-cli/test/tests/qdmesg.py new file mode 100644 index 0000000..45dd4eb --- /dev/null +++ b/test-cli/test/tests/qdmesg.py @@ -0,0 +1,38 @@ +import sh +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"] + + def execute(self): + print("running dmesg test") + self.pgObj.run_test(self.params["testidctl"], self.params["testid"]) + # delete previous file + if path.exists("/tmp/station/dmesg.txt"): + print("dmesg remove") + os.remove("/tmp/station/dmesg.txt") + # generate file + p = sh.dmesg("--color=never", _out="/tmp/station/dmesg.txt") + print("Exit code: {}".format(p.exit_code)) + if p.exit_code == 0: + # save result + # with open('/tmp/station/dmesg.txt', 'w') as outfile: + # n = outfile.write(p.stdout.decode('ascii')) + # outfile.close() + + # save dmesg result in DB + self.pgObj.upload_result_file(self.params["testidctl"], self.params["testid"], "dmesg output", + "/tmp/station/dmesg.txt", "text/plain") + self.pgObj.finish_test(self.params["testidctl"], self.params["testid"], "TEST_COMPLETE", "") + print("success dmesg test") + else: + self.pgObj.finish_test(self.params["testidctl"], self.params["testid"], "TEST_FAILED", "") + print("fail dmesg test") |