Bug 7865

Summary: oe-selftest to detect test cases in other layers else than OE-Core
Product: [QA/Testing] Build Testing Reporter: sharron.liu
Component: generalAssignee: Costin <costin.c.constantin>
Status: RESOLVED FIXED QA Contact: sharron.liu
Severity: enhancement    
Priority: Medium CC: alexandru.c.georgescu, anibal.limon, benjamin.esquivel, cathy.shen, francisco.j.pedraza.gonzalez, jing.j.wang, richard.purdie, sharron.liu
Version: unspecified   
Target Milestone: 2.1   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description sharron.liu 2015-06-09 07:16:35 UTC
Hi Alex, and Yocto team,

I'm working on a project using Yocto as build tool. I developed my own build-time test cases, and I wanted to use oe-selftest to run my tests. 

I have my test cases locating in my own layer. And I found oe-selftest failed to detect my test cases, when typing the command "--list-modules".

I don't want to put them under "poky/meta/" since they're not for Yocto testing and they're for my project specific build testing. Any other project that use Yocto tool may face this issue, also. Could I expect oe-selftest to detect and launch test cases locating in other layers? 

For more details, here's my folder structure:
poky
  meta/lib/oeqa/
  meta-selftest
  scripts/oe-selftest
meta-mylayer (added to "BBPATH")
  lib/oeqa/selftest (I want test cases here detected by oe-selftest)

I tried to add minor changes in oe-selftest, and that patch will detect any cases under "lib/oeqa/selftest" from all layers that are added to "BBPATH". I would share that to you.

Thanks,
Sharron
Comment 1 sharron.liu 2015-06-09 08:11:31 UTC
Alex, 
My test cases need to be organized into sub folders indeed, each sub folder represents a single test suite. 

meta-mylayer (added to "BBPATH")
  lib/oeqa/selftest (I want test cases here detected by oe-selftest)
  lib/oeqa/selftest/cfg/mytest.py ==> expect "--list-modules" list it as "cfg.mytest"
  lib/oeqa/selftest/cfg/files/mytest_data.json, mytest_dependency.py ==> These are test data and dependency, don't expect "--list-modules" list it is as test case. 

I also modify the oe-selftest a few lines for this purpose. Let me know what do you think :)

Thanks,
Sharron
Comment 2 Costin 2015-06-09 14:52:19 UTC
Hello Liu,

Please have a look on 7833 and let me know if it suffices your needs.

Costin
Comment 3 Costin 2015-06-10 11:49:35 UTC
Hi Liu,

I think i did a mistake in my last comment. 7833 is not referring to something similar to this feature. However, i posted a comment with some steps to perform in order to achieve multi layer test inclusions. I will come back shortly with a patch for this request

Costin
Comment 4 sharron.liu 2015-06-11 08:40:32 UTC
Costin,

Thanks for your prompt reply! You're right, 7833 is related to runtime test, while this 7865 is for build-time test. Here I would provide more detail steps for how-to-reproduce my issue :)

1. follow step 1~3 (of 7833) to add my test layer. 
meta-mylayer (added to "BBLAYERS", added to "BBPATH")
  lib/oeqa/selftest 
  lib/oeqa/selftest/__init__.py 
  lib/oeqa/selftest/cfg/__init__.py 
  lib/oeqa/selftest/cfg/mytest.py
  lib/oeqa/selftest/cfg/files/mytest_data.json

2. from poky, setup build env, and from "BUILDDIR" type
  oe-selftest --list-modules

3. expect mytest being listed:
<here's test modules from "meta/lib/oeqa/selftest/*.py", like buildhistory etc.>
cfg.mytest

4. run mytest from oe-selftest
   oe-selftest --run-tests cfg.mytest

5. expect tests in "cfg.mytest" being run.

Thanks,
Sharron
Comment 5 Costin 2015-06-13 20:19:34 UTC
Hi Sharron,

I managed to add few features to oe-selftest, allowing it to support tests from any meta*/lib/oeqa/selftest directories plus subdirectories to them.

Still left to do:
 - considering an external cfg.mytest file for tests. Will be done shortly. 

I will upload the patch upstream.
 
Costin
Comment 6 Costin 2015-06-14 20:07:33 UTC
Hi Sharron,

For whatever reason, i misunderstood your needs, so please disregard comment #5. 
I'll come back with a solution shortly.

Costin
Comment 7 Costin 2015-06-16 12:49:52 UTC
Hello,

Patch submitted to be merged. This is Sharron's contribution.

Costin
Comment 8 Cathy Shen 2015-07-07 08:21:07 UTC
Costin, is it merged?
Comment 9 Costin 2015-07-29 08:15:00 UTC
Hi Cathy,

Just had a chat with Sharron and she proposed a better formatted version of the patch. I will update you after having a look on it
Comment 10 Costin 2015-07-31 11:24:20 UTC
Hello,

As with the http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=d2023c34e4c3735d919c35d80daf991aab579500
and 
http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=51d760e2a7e22f1b07608fc925da343e56a9ae74

oe-selftest considers test files in other layers present in bblayers.conf having lib/oeqa/selftest directory structure.
Comment 11 Cathy Shen 2015-09-09 08:10:21 UTC
Thanks for the information, Costin. I'd like to close this ticket considering it's already supported in Yocto.
Comment 12 Costin 2015-09-21 06:43:26 UTC
Thank you Cathy for the update. I delayed this comment because i wanted to clarify few things with Sharron. I will not close this feature until she will update it with her comment if the patches solve her needs. 
Until then marking it as resolved.
Comment 13 Alexandru Georgescu 2015-09-28 11:58:48 UTC
(In reply to comment #12)
> Thank you Cathy for the update. I delayed this comment because i wanted to
> clarify few things with Sharron. I will not close this feature until she
> will update it with her comment if the patches solve her needs. 
> Until then marking it as resolved.

Hi Sharron, can you update with the info Costin needs to close the enhancement?

Thanks,
AlexG
Comment 14 Alexandru Georgescu 2015-09-28 11:59:17 UTC
Changed the status to NEEDINFO
Comment 15 sharron.liu 2015-09-30 06:18:13 UTC
Verified in latest poky (commit 4bc3f09 Sep 23 2015)

meta-mylayer (added to "BBLAYERS", added to "BBPATH")
  lib/oeqa/selftest 
  lib/oeqa/selftest/__init__.py 
  lib/oeqa/selftest/cfg/__init__.py 
  lib/oeqa/selftest/cfg/mytest.py
  lib/oeqa/selftest/cfg/files/mytest_data.json

oe-selftest --list-modules
   >> here "cfg.mytest" is not listed  ===> failed

oe-selftest --run-tests cfg.mytest
   >> here "cfg.mytest" run as expected  ==> passed.
Comment 17 Stephen K Jolley 2015-11-19 15:57:35 UTC
This was REOPENED
Comment 18 Benjamin Esquivel 2016-01-13 16:09:49 UTC
CCing Anibal and Paco
Comment 19 Costin 2016-02-09 13:36:50 UTC
Hello,

Patch submitted for review
Comment 20 Costin 2016-02-29 10:07:17 UTC
merged into master: 
http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=d2a563c32c62908a8c8eb9618f86a3fc9e5fe5bc

Marking as resolved