Add imports for the resulttools durations.py module, then add a basic test for checking that testcase names and durations are properly extracted.
AI-Generated: Uses Claude Sonnet 5 Signed-off-by: Trevor Gamblin <[email protected]> --- .../oeqa/selftest/cases/resulttooltests.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/meta/lib/oeqa/selftest/cases/resulttooltests.py b/meta/lib/oeqa/selftest/cases/resulttooltests.py index b03a880b2b..a380d08156 100644 --- a/meta/lib/oeqa/selftest/cases/resulttooltests.py +++ b/meta/lib/oeqa/selftest/cases/resulttooltests.py @@ -11,6 +11,7 @@ lib_path = basepath + '/scripts/lib' sys.path = sys.path + [lib_path] from resulttool.report import ResultsTextReport from resulttool import regression as regression +from resulttool import durations as durations from resulttool import resultutils as resultutils from oeqa.selftest.case import OESelftestTestCase @@ -18,6 +19,8 @@ from resulttool.junit import junit_tree, PtestSummary import xml.etree.ElementTree as ET import logging import json +import tempfile +from types import SimpleNamespace class ResultToolTests(OESelftestTestCase): @@ -669,3 +672,28 @@ class ResultToolTests(OESelftestTestCase): # Package testsuite should not exist (no ptestresult.sections) package_suite = testsuites_node.find(".//testsuite[@name='Package Tests']") self.assertIsNone(package_suite) + + def test_durations_get_durations_extracts_testcase_and_suite_durations(self): + results_data = {'result1': {'configuration': {"TEST_TYPE": "runtime", + "TESTSERIES": "series1", + "IMAGE_BASENAME": "image", + "IMAGE_PKGTYPE": "ipk", + "DISTRO": "mydistro", + "MACHINE": "qemux86"}, + 'result': { + 'test.Foo.test_bar': {'status': 'PASSED', 'duration': 12.345}, + 'test.Foo.test_no_duration': {'status': 'PASSED'}, + 'ptestresult.sections': { + 'bash': {'duration': '5', 'log': 'xxx'}, + # a timed-out suite has " T" appended to its duration + 'timedout': {'duration': '30 T'}, + }, + }}} + results = {} + resultutils.append_resultsdata(results, results_data) + flattened = durations.get_durations(results) + path = 'runtime/mydistro/qemux86/image' + self.assertEqual(flattened[path]['test.Foo.test_bar'], 12.345) + self.assertNotIn('test.Foo.test_no_duration', flattened[path]) + self.assertEqual(flattened[path]['ptestresult.sections.bash'], 5.0) + self.assertEqual(flattened[path]['ptestresult.sections.timedout'], 30.0) -- 2.55.0
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#246542): https://lists.openembedded.org/g/openembedded-core/message/246542 Mute This Topic: https://lists.openembedded.org/mt/121399136/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
