|
@@ -1,6 +1,6 @@
|
|
|
import unittest
|
|
|
import pprint
|
|
|
-import re
|
|
|
+import datetime
|
|
|
|
|
|
from oeqa.runtime.case import OERuntimeTestCase
|
|
|
from oeqa.core.decorator.depends import OETestDepends
|
|
@@ -21,8 +21,6 @@ class PtestRunnerTest(OERuntimeTestCase):
|
|
|
if status != 0:
|
|
|
self.skipTest("No -ptest packages are installed in the image")
|
|
|
|
|
|
- import datetime
|
|
|
-
|
|
|
test_log_dir = self.td.get('TEST_LOG_DIR', '')
|
|
|
# The TEST_LOG_DIR maybe NULL when testimage is added after
|
|
|
# testdata.json is generated.
|
|
@@ -30,9 +28,9 @@ class PtestRunnerTest(OERuntimeTestCase):
|
|
|
test_log_dir = os.path.join(self.td.get('WORKDIR', ''), 'testimage')
|
|
|
# Don't use self.td.get('DATETIME'), it's from testdata.json, not
|
|
|
# up-to-date, and may cause "File exists" when re-reun.
|
|
|
- datetime = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
|
|
|
+ timestamp = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
|
|
|
ptest_log_dir_link = os.path.join(test_log_dir, 'ptest_log')
|
|
|
- ptest_log_dir = '%s.%s' % (ptest_log_dir_link, datetime)
|
|
|
+ ptest_log_dir = '%s.%s' % (ptest_log_dir_link, timestamp)
|
|
|
ptest_runner_log = os.path.join(ptest_log_dir, 'ptest-runner.log')
|
|
|
|
|
|
status, output = self.target.run('ptest-runner', 0)
|
|
@@ -51,7 +49,7 @@ class PtestRunnerTest(OERuntimeTestCase):
|
|
|
# Parse and save results
|
|
|
parser = PtestParser()
|
|
|
results, sections = parser.parse(ptest_runner_log)
|
|
|
- parser.results_as_files(ptest_log_dir, test_status = ['pass','fail', 'skip'])
|
|
|
+ parser.results_as_files(ptest_log_dir)
|
|
|
if os.path.exists(ptest_log_dir_link):
|
|
|
# Remove the old link to create a new one
|
|
|
os.remove(ptest_log_dir_link)
|
|
@@ -60,12 +58,11 @@ class PtestRunnerTest(OERuntimeTestCase):
|
|
|
extras['ptestresult.sections'] = sections
|
|
|
|
|
|
trans = str.maketrans("()", "__")
|
|
|
- resmap = {'pass': 'PASSED', 'skip': 'SKIPPED', 'fail': 'FAILED'}
|
|
|
for section in results:
|
|
|
for test in results[section]:
|
|
|
result = results[section][test]
|
|
|
testname = "ptestresult." + (section or "No-section") + "." + "_".join(test.translate(trans).split())
|
|
|
- extras[testname] = {'status': resmap[result]}
|
|
|
+ extras[testname] = {'status': result}
|
|
|
|
|
|
failed_tests = {}
|
|
|
for section in results:
|