summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/runtime/cases/ptest.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/runtime/cases/ptest.py')
-rw-r--r--meta/lib/oeqa/runtime/cases/ptest.py40
1 files changed, 3 insertions, 37 deletions
diff --git a/meta/lib/oeqa/runtime/cases/ptest.py b/meta/lib/oeqa/runtime/cases/ptest.py
index 1ce22a09e7..ae54a01669 100644
--- a/meta/lib/oeqa/runtime/cases/ptest.py
+++ b/meta/lib/oeqa/runtime/cases/ptest.py
@@ -1,50 +1,16 @@
1import unittest 1import unittest
2import pprint 2import pprint
3import re
3 4
4from oeqa.runtime.case import OERuntimeTestCase 5from oeqa.runtime.case import OERuntimeTestCase
5from oeqa.core.decorator.depends import OETestDepends 6from oeqa.core.decorator.depends import OETestDepends
6from oeqa.core.decorator.oeid import OETestID 7from oeqa.core.decorator.oeid import OETestID
7from oeqa.core.decorator.data import skipIfNotFeature 8from oeqa.core.decorator.data import skipIfNotFeature
8from oeqa.runtime.decorator.package import OEHasPackage 9from oeqa.runtime.decorator.package import OEHasPackage
9from oeqa.utils.logparser import PtestParser, Result 10from oeqa.utils.logparser import PtestParser
10 11
11class PtestRunnerTest(OERuntimeTestCase): 12class PtestRunnerTest(OERuntimeTestCase):
12 13
13 # a ptest log parser
14 def parse_ptest(self, logfile):
15 parser = PtestParser()
16 result = Result()
17
18 with open(logfile, errors='replace') as f:
19 for line in f:
20 result_tuple = parser.parse_line(line)
21 if not result_tuple:
22 continue
23 line_type, category, status, name = result_tuple
24
25 if line_type == 'section' and status == 'begin':
26 current_section = name
27 continue
28
29 if line_type == 'section' and status == 'end':
30 current_section = None
31 continue
32
33 if line_type == 'test' and status == 'pass':
34 result.store(current_section, name, status)
35 continue
36
37 if line_type == 'test' and status == 'fail':
38 result.store(current_section, name, status)
39 continue
40
41 if line_type == 'test' and status == 'skip':
42 result.store(current_section, name, status)
43 continue
44
45 result.sort_tests()
46 return result
47
48 @OETestID(1600) 14 @OETestID(1600)
49 @skipIfNotFeature('ptest', 'Test requires ptest to be in DISTRO_FEATURES') 15 @skipIfNotFeature('ptest', 'Test requires ptest to be in DISTRO_FEATURES')
50 @OETestDepends(['ssh.SSHTest.test_ssh']) 16 @OETestDepends(['ssh.SSHTest.test_ssh'])
@@ -83,7 +49,7 @@ class PtestRunnerTest(OERuntimeTestCase):
83 extras['ptestresult.rawlogs'] = {'log': output} 49 extras['ptestresult.rawlogs'] = {'log': output}
84 50
85 # Parse and save results 51 # Parse and save results
86 parse_result = self.parse_ptest(ptest_runner_log) 52 parse_result = PtestParser().parse(ptest_runner_log)
87 parse_result.log_as_files(ptest_log_dir, test_status = ['pass','fail', 'skip']) 53 parse_result.log_as_files(ptest_log_dir, test_status = ['pass','fail', 'skip'])
88 if os.path.exists(ptest_log_dir_link): 54 if os.path.exists(ptest_log_dir_link):
89 # Remove the old link to create a new one 55 # Remove the old link to create a new one