Skip to contentSkip to conversation

test-result-log: testcase management tool to store test result

PATCH In review Yeoh Ee Peng 2 participants 4 messages Aug 29, 2018 – Sep 19, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test-result-log: testcase management tool to store test result

These scripts were developed as an alternative testcase management tool to Testopia. Using these scripts, user can store test result from OEQA automated testcase execution.

These scripts will store test result & log in GIT repository. To use these scripts, first source oe environment, then run the entry point script to look for help.

    $ test-result-log

To store test result for OEQA automated testcase, execute the below

    $ test-result-log store-auto <top-folder-name> <git-branch> /
      <oeqa-log-file-location> <type-of-oeqa-testcase-executed>
---
 scripts/lib/testresultlog/__init__.py         |   1 +
 scripts/lib/testresultlog/gitstore.py         | 250 ++++++++++++++++++++++++++
 scripts/lib/testresultlog/oeqalogparser.py    |  97 ++++++++++
 scripts/lib/testresultlog/oeqatestdiscover.py |  51 ++++++
 scripts/lib/testresultlog/storeauto.py        | 125 +++++++++++++
 scripts/test-result-log                       | 108 +++++++++++
 6 files changed, 632 insertions(+)
 create mode 100644 scripts/lib/testresultlog/__init__.py
 create mode 100644 scripts/lib/testresultlog/gitstore.py
 create mode 100644 scripts/lib/testresultlog/oeqalogparser.py
 create mode 100644 scripts/lib/testresultlog/oeqatestdiscover.py
 create mode 100644 scripts/lib/testresultlog/storeauto.py
 create mode 100755 scripts/test-result-log
scripts/lib/testresultlog/__init__.py new file +1 -0
new file mode 100644
index 0000000..d3f5a12
@@ -0,0 +1 @@
+
scripts/lib/testresultlog/gitstore.py new file +250 -0

250 lines not on this page · raw message

scripts/lib/testresultlog/oeqalogparser.py new file +97 -0

97 lines not on this page · raw message

scripts/lib/testresultlog/oeqatestdiscover.py new file +51 -0

51 lines not on this page · raw message

scripts/lib/testresultlog/storeauto.py new file +125 -0

125 lines not on this page · raw message

scripts/test-result-log new file +108 -0

108 lines not on this page · raw message

Signature · 1 line
2.7.4
#1 lore raw

Hi Ee Peng,

I've been having a look at this code and whilst some of it is good, I also have some concerns. With it coming in so late in the cycle, its made it hard to have time to review it and allow time to get it right. With something as important as this to the way the future QA work is done, we do need to ensure we use the right approach and that its maintainable.

The patches are ok as a first attempt at this. My biggest concern is that its currently parsing log files which we control and generate within out own codebase and that parsing is likely to break. In particular, these lines worry me from the qalogparser:

regex = ".*RESULTS - (?P<case_name>.*) - Testcase .*: (?P<status>PASSED|FAILED|SKIPPED|ERROR|UNKNOWN).*$" regex = "core-image.*().*Ran.*tests in .*s"
regex = "DEBUG: launchcmd=runqemu*
qemu_list = ['qemuarm', 'qemuarm64', 'qemumips', 'qemumips64', 'qemuppc', 'qemux86', 'qemux86-64']

since here we're hardcoding the list of qemu's we support, we're also only allowing core-image-* and we're relying upon the results format not changing. That makes it hard for anyone to extend/reuse this or to use it with real hardware?

For example the recent oe-selftest parallelisation code did change the output of the tests slightly. I'm not sure if this broke the parsing or not but it is an example of the kind of fragility this code has.

What would probably work better for us is if the oeqa framework wrote out a json file directly containing the information we need in it, then this code would just need to collect up the json files.

I'm also a little concerned at the way unittest discovery is being done, grepping for *.py files as far as I understand it. We should probably use the list options to the various current test pieces? Also, this is something we probably only ever need to do once to seed the QA results store?

Finally, much of the code is using "internal" methods prefixed with "_". I can understand why but it seems the code doesn't have a good well structured public API as a result.

As such there may me a little too much work needed on this to get it in for 2.6 :(

Cheers,

Richard

#2 lore raw

Hi Richard,

Great thanks for your feedbacks!
I will work on the improvement to address your concerns.

Best regards,
Ee Peng

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, September 11, 2018 11:09 PM
To: Yeoh, Ee Peng <[email protected]>; [email protected]
Subject: Re: [OE-core] [PATCH] test-result-log: testcase management tool to store test result

Hi Ee Peng,

I've been having a look at this code and whilst some of it is good, I also have some concerns. With it coming in so late in the cycle, its made it hard to have time to review it and allow time to get it right. With something as important as this to the way the future QA work is done, we do need to ensure we use the right approach and that its maintainable.

The patches are ok as a first attempt at this. My biggest concern is that its currently parsing log files which we control and generate within out own codebase and that parsing is likely to break. In particular, these lines worry me from the qalogparser:

regex = ".*RESULTS - (?P<case_name>.*) - Testcase .*: (?P<status>PASSED|FAILED|SKIPPED|ERROR|UNKNOWN).*$" regex = "core-image.*().*Ran.*tests in .*s"
regex = "DEBUG: launchcmd=runqemu*
qemu_list = ['qemuarm', 'qemuarm64', 'qemumips', 'qemumips64', 'qemuppc', 'qemux86', 'qemux86-64']

since here we're hardcoding the list of qemu's we support, we're also only allowing core-image-* and we're relying upon the results format not changing. That makes it hard for anyone to extend/reuse this or to use it with real hardware?

For example the recent oe-selftest parallelisation code did change the output of the tests slightly. I'm not sure if this broke the parsing or not but it is an example of the kind of fragility this code has.

What would probably work better for us is if the oeqa framework wrote out a json file directly containing the information we need in it, then this code would just need to collect up the json files.

I'm also a little concerned at the way unittest discovery is being done, grepping for *.py files as far as I understand it. We should probably use the list options to the various current test pieces? Also, this is something we probably only ever need to do once to seed the QA results store?

Finally, much of the code is using "internal" methods prefixed with "_". I can understand why but it seems the code doesn't have a good well structured public API as a result.

As such there may me a little too much work needed on this to get it in for 2.6 :(

Cheers,

Richard

#3 lore raw
In reply to Richard Purdie

Hi Richard,

To address the maintainable concern, I had restructured the codes in order to enable oeqa framework to write out a json file directly for testresult.

Attached were the patches to enble oeqa framework to write testresult into json files, where these files will later be used by the future QA test case management tools (eg. store testresult, test reporting, execute manual test case and write testresult to json).

This patch include enable oe-selftest to write json testresult. I had tested these patches on our local server where it will write out json files for testresult as expected.

Please let me know if you have any more feedback. Thank you very much!

Best regards,
Yeoh Ee Peng

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, September 11, 2018 11:09 PM
To: Yeoh, Ee Peng <[email protected]>; [email protected]
Subject: Re: [OE-core] [PATCH] test-result-log: testcase management tool to store test result

Hi Ee Peng,

I've been having a look at this code and whilst some of it is good, I also have some concerns. With it coming in so late in the cycle, its made it hard to have time to review it and allow time to get it right. With something as important as this to the way the future QA work is done, we do need to ensure we use the right approach and that its maintainable.

The patches are ok as a first attempt at this. My biggest concern is that its currently parsing log files which we control and generate within out own codebase and that parsing is likely to break. In particular, these lines worry me from the qalogparser:

regex = ".*RESULTS - (?P<case_name>.*) - Testcase .*: (?P<status>PASSED|FAILED|SKIPPED|ERROR|UNKNOWN).*$" regex = "core-image.*().*Ran.*tests in .*s"
regex = "DEBUG: launchcmd=runqemu*
qemu_list = ['qemuarm', 'qemuarm64', 'qemumips', 'qemumips64', 'qemuppc', 'qemux86', 'qemux86-64']

since here we're hardcoding the list of qemu's we support, we're also only allowing core-image-* and we're relying upon the results format not changing. That makes it hard for anyone to extend/reuse this or to use it with real hardware?

For example the recent oe-selftest parallelisation code did change the output of the tests slightly. I'm not sure if this broke the parsing or not but it is an example of the kind of fragility this code has.

What would probably work better for us is if the oeqa framework wrote out a json file directly containing the information we need in it, then this code would just need to collect up the json files.

I'm also a little concerned at the way unittest discovery is being done, grepping for *.py files as far as I understand it. We should probably use the list options to the various current test pieces? Also, this is something we probably only ever need to do once to seed the QA results store?

Finally, much of the code is using "internal" methods prefixed with "_". I can understand why but it seems the code doesn't have a good well structured public API as a result.

As such there may me a little too much work needed on this to get it in for 2.6 :(

Cheers,

Richard

To enable selftest to write testresult into json files, where these json files will be used by future test case management tools for test reporting.

---
 meta/lib/oeqa/selftest/context.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
meta/lib/oeqa/selftest/context.py +10 -2
index c78947e..9ed22ff 100644
@@ -73,6 +73,9 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
 
         parser.add_argument('--machine', required=False, choices=['random', 'all'],
                             help='Run tests on different machines (random/all).')
+
+        parser.add_argument('-ej', '--export-json', action='store_true',
+                            help='Output test result in json format to files.')
 
         parser.set_defaults(func=self.run)
 
@@ -99,8 +102,8 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
         return cases_paths
 
     def _process_args(self, logger, args):
-        args.output_log = '%s-results-%s.log' % (self.name,
-                time.strftime("%Y%m%d%H%M%S"))
+        args.test_start_time = time.strftime("%Y%m%d%H%M%S")
+        args.output_log = '%s-results-%s.log' % (self.name, args.test_start_time)
         args.test_data_file = None
         args.CASES_PATHS = None
 
@@ -222,6 +225,11 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
             rc = self.tc.runTests(**self.tc_kwargs['run'])
             rc.logDetails()
             rc.logSummary(self.name)
+            if args.export_json:
+                json_result_dir = os.path.join(os.path.dirname(os.path.abspath(args.output_log)),
+                                               'json_testresults-%s' % args.test_start_time,
+                                               'oe-selftest')
+                rc.logDetailsInJson(json_result_dir)
 
         return rc
 

--
2.7.4

To enable future QA work, we need the oeqa testresult to be written into json files, which will be used by the future test case management tools, where these testresult json files will be stored into git repository for test reporting.

Also this oeqa framework will be used by the future test case management tools to write testresult for manual test case executed into json files.

---
 meta/lib/oeqa/core/runner.py | 120 +++++++++++++++++++++++++++++++++++++++----
 1 file changed, 109 insertions(+), 11 deletions(-)
meta/lib/oeqa/core/runner.py +109 -11

160 lines not on this page · raw message

--
2.7.4