<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>8920</bug_id>
          
          <creation_ts>2016-01-13 22:36:13 +0000</creation_ts>
          <short_desc>oe-selftest: users should be able to specify those folders that &apos;coverage&apos; should look into</short_desc>
          <delta_ts>2016-03-03 20:36:38 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>10</classification_id>
          <classification>QA/Testing</classification>
          <product>Build Testing</product>
          <component>general</component>
          <version>2.0</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>2.1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Leonardo Sandoval Gonzalez">leonardo.sandoval.gonzalez</reporter>
          <assigned_to name="Humberto Ibarra">humberto.ibarra.lopez</assigned_to>
          <cc>benjamin.esquivel</cc>
    
    <cc>eduard.bartosh</cc>
    
    <cc>humberto.ibarra.lopez</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>57799</commentid>
    <comment_count>0</comment_count>
    <who name="Leonardo Sandoval Gonzalez">leonardo.sandoval.gonzalez</who>
    <bug_when>2016-01-13 22:36:13 +0000</bug_when>
    <thetext>Currently, the source code coverage is done on those files under the meta, meta-*, scripts and bitbake folders. Users should be able to specify the latter through a command line argument (--coverage-source scripts, for example)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57820</commentid>
    <comment_count>1</comment_count>
    <who name="Leonardo Sandoval Gonzalez">leonardo.sandoval.gonzalez</who>
    <bug_when>2016-01-14 14:46:18 +0000</bug_when>
    <thetext>after discussing with Ed, a parameter &apos;--coverage-include&apos; would be more appropriate in this case, which would have the same meaning as the --include parameter in coverage:

    --include is a list of file name patterns. If specified, only files matching those patterns will be measured.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57878</commentid>
    <comment_count>2</comment_count>
    <who name="Leonardo Sandoval Gonzalez">leonardo.sandoval.gonzalez</who>
    <bug_when>2016-01-15 17:31:02 +0000</bug_when>
    <thetext>Per conversation with Humberto Ibarra, we agree on the following command line arguments:


oe-selftest --coverage &lt;run-command&gt; &lt;run-value&gt;

for example

oe-selftest --coverage include scripts/wic

where &lt;run-command&gt; could be any of [1]

[1] https://coverage.readthedocs.org/en/coverage-4.0.2/config.html#run</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57879</commentid>
    <comment_count>3</comment_count>
    <who name="Benjamin Esquivel">benjamin.esquivel</who>
    <bug_when>2016-01-15 18:15:25 +0000</bug_when>
    <thetext>I think this approach might have some difficulties that I&apos;d like to discuss with you.

Some examples,

- sub-arguments become positional
- oe-selftest already has his own set of arguments, try seeing how a full line will look like when doing an actual run of tests with coverage.

I want to weigh in on the design of this. I&apos;ll look you up.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57880</commentid>
    <comment_count>4</comment_count>
    <who name="Leonardo Sandoval Gonzalez">leonardo.sandoval.gonzalez</who>
    <bug_when>2016-01-15 18:22:53 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; I think this approach might have some difficulties that I&apos;d like to discuss
&gt; with you.
&gt; 
&gt; Some examples,
&gt; 
&gt; - sub-arguments become positional
&gt; - oe-selftest already has his own set of arguments, try seeing how a full
&gt; line will look like when doing an actual run of tests with coverage.
&gt; 
&gt; I want to weigh in on the design of this. I&apos;ll look you up.

There is a similar (in term of syntax) argument:

 --list-tests-by [LIST_TESTS_BY [LIST_TESTS_BY ...]]
                        list-tests-by &lt;name|class|module|id|tag&gt; &lt;list of

so we are basically repeating the patter with coverage.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57885</commentid>
    <comment_count>5</comment_count>
    <who name="Benjamin Esquivel">benjamin.esquivel</who>
    <bug_when>2016-01-15 19:25:31 +0000</bug_when>
    <thetext>I like the fact that you make it consistent with what is there already but I think I still have some doubts about the current approach of the options that oe-selftest takes. Let&apos;s make a full running example:

$ oe-selftest --run-tests-by name test1 test2 --coverage include /this/path1/ /this/path2/

Questions:
- is that how it should be specified a list of paths? the same way it is specified a list of tests (consecutively)?

- when --coverage obtains more &apos;run-command&apos;s, will you need to add --coverage next-command?

- are you thinking to &apos;--exclude&apos; as well?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57886</commentid>
    <comment_count>6</comment_count>
    <who name="Leonardo Sandoval Gonzalez">leonardo.sandoval.gonzalez</who>
    <bug_when>2016-01-15 19:38:14 +0000</bug_when>
    <thetext>(In reply to comment #5)
&gt; I like the fact that you make it consistent with what is there already but I
&gt; think I still have some doubts about the current approach of the options
&gt; that oe-selftest takes. Let&apos;s make a full running example:
&gt; 
&gt; $ oe-selftest --run-tests-by name test1 test2 --coverage include
&gt; /this/path1/ /this/path2/
&gt; 
&gt; Questions:
&gt; - is that how it should be specified a list of paths? the same way it is
&gt; specified a list of tests (consecutively)?
&gt; 

just &apos;comma&apos; separated, thus it will be

$ oe-selftest --run-tests-by name test1 test2 --coverage include
 /this/path1/,/this/path2/

&gt; - when --coverage obtains more &apos;run-command&apos;s, will you need to add
&gt; --coverage next-command?

--coverage expects just ONE run-command, so we cannot include and exclude at the same command line. This is of course a restriction, but in general, if user wants more flexibility, it can write a .coveragerc and oe-selftest would respect that file 
&gt; 
&gt; - are you thinking to &apos;--exclude&apos; as well?

In resume, 

&quot;--coverage&quot;: this will look into the .coveragerc, if present, it will use it, if not, it will create a default .coverarc (this is done already)

&quot;--coverage include scripts/wic,bitbake&quot;: this time, the .coveragerc run include section will be overwritten (or any other run parameter, like omit), otherwise it will create the .coveragerc and set this value</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57892</commentid>
    <comment_count>7</comment_count>
    <who name="Leonardo Sandoval Gonzalez">leonardo.sandoval.gonzalez</who>
    <bug_when>2016-01-15 23:05:09 +0000</bug_when>
    <thetext>Reviewing the oe-selftest command line arguments, I realized that there is a need to refactor, thus I filed the following bug

https://bugzilla.yoctoproject.org/show_bug.cgi?id=8938

Following this criteria, we should then follow this pattern:

# execute all, taking into account coverage. By default, --coverage-source contains just those poky folders containing python code (no-metadata)

oe-selftest --coverage

# execute all, just looking into the bitbake folder
oe-selftest --coverage --coverage-source bitbake

# execute all, including just meta-* folders
oe-selftest --coverage --coverage-include &apos;meta-*&apos;

# execute all, omitting scritps folder
oe-selftest --coverage --coverage-omit scripts

Thus, besides --coverage, there are three more coverage source related arguments:

--coverage--source
--coverage-include
--coverage-omit</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57925</commentid>
    <comment_count>8</comment_count>
    <who name="Leonardo Sandoval Gonzalez">leonardo.sandoval.gonzalez</who>
    <bug_when>2016-01-18 17:15:26 +0000</bug_when>
    <thetext>An interesting check would be to check these oe-selftest parameters against the coverage standalone tool, for example, these two commands should output the same .coverage file

1. coverage oe-selftest --run-all-tests
2. oe-selftest --run-all-tests --coverage

The same applies to the more refined coverage sub commands.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57930</commentid>
    <comment_count>9</comment_count>
    <who name="Benjamin Esquivel">benjamin.esquivel</who>
    <bug_when>2016-01-18 18:11:31 +0000</bug_when>
    <thetext>maybe that is a bit of duplication of work and have to maintain changes in the 2 of them. I agree that a coverage script will be required mainly for coverage reporting/processing but it should not mimic the runner&apos;s duties.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57932</commentid>
    <comment_count>10</comment_count>
    <who name="Leonardo Sandoval Gonzalez">leonardo.sandoval.gonzalez</who>
    <bug_when>2016-01-18 18:21:20 +0000</bug_when>
    <thetext>(In reply to comment #9)
&gt; maybe that is a bit of duplication of work and have to maintain changes in
&gt; the 2 of them. I agree that a coverage script will be required mainly for
&gt; coverage reporting/processing but it should not mimic the runner&apos;s duties.

we should mimic just these (the input data), not the reporting arguments. in fact, we wont expect to add more that these arguments. the reporting stuff should be done with the coverage tool. 

the reason for mimic these is to simple have the same user experience in both, and I believe this is important.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59121</commentid>
    <comment_count>11</comment_count>
    <who name="Humberto Ibarra">humberto.ibarra.lopez</who>
    <bug_when>2016-02-16 20:11:54 +0000</bug_when>
    <thetext>Fixed:

http://lists.openembedded.org/pipermail/openembedded-core/2016-February/117621.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59123</commentid>
    <comment_count>12</comment_count>
    <who name="Leonardo Sandoval Gonzalez">leonardo.sandoval.gonzalez</who>
    <bug_when>2016-02-16 20:33:05 +0000</bug_when>
    <thetext>it should be in progress review instead of resolved</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59173</commentid>
    <comment_count>13</comment_count>
    <who name="Humberto Ibarra">humberto.ibarra.lopez</who>
    <bug_when>2016-02-17 21:58:27 +0000</bug_when>
    <thetext>V2

http://lists.openembedded.org/pipermail/openembedded-core/2016-February/117675.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59287</commentid>
    <comment_count>14</comment_count>
    <who name="Humberto Ibarra">humberto.ibarra.lopez</who>
    <bug_when>2016-02-19 21:33:52 +0000</bug_when>
    <thetext>v3.

http://lists.openembedded.org/pipermail/openembedded-core/2016-February/117793.html</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>