Openembedded Core Discussions
 help / color / mirror / Atom feed
* [yocto][PATCH 0/1] new PTEST_RUN_SCRIPT_PATH
@ 2015-09-21  7:11 Ian Ray
  2015-09-21  7:11 ` [yocto][PATCH 1/1] ptest: user-specified run-ptest script location Ian Ray
  0 siblings, 1 reply; 11+ messages in thread
From: Ian Ray @ 2015-09-21  7:11 UTC (permalink / raw)
  To: openembedded-core

New "weak" assigned PTEST_RUN_SCRIPT_PATH to allow recipes to
override the default location of the run-ptest script.

This is useful if the package ships its own run-ptest script.

A documentation patch was submitted to https://lists.yoctoproject.org/pipermail/yocto/2015-September/026500.html

Ian Ray (1):
  ptest: user-specified run-ptest script location

 meta/classes/ptest.bbclass | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

-- 
1.8.3.1



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [yocto][PATCH 1/1] ptest: user-specified run-ptest script location
  2015-09-21  7:11 [yocto][PATCH 0/1] new PTEST_RUN_SCRIPT_PATH Ian Ray
@ 2015-09-21  7:11 ` Ian Ray
  2015-09-28 13:49   ` Tudor Florea
  0 siblings, 1 reply; 11+ messages in thread
From: Ian Ray @ 2015-09-21  7:11 UTC (permalink / raw)
  To: openembedded-core

Provides a new variable, PTEST_RUN_SCRIPT_PATH, which points to a
directory where the run-ptest script is located.  This location
defaults to the work directory but may be overridden within a recipe
if a package ships its own run-ptest script.

Signed-off-by: Ian Ray <ian.ray@ge.com>
---
 meta/classes/ptest.bbclass | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/meta/classes/ptest.bbclass b/meta/classes/ptest.bbclass
index b5f470f..7d9d0cc 100644
--- a/meta/classes/ptest.bbclass
+++ b/meta/classes/ptest.bbclass
@@ -3,6 +3,7 @@ DESCRIPTION_${PN}-ptest ?= "${DESCRIPTION}  \
 This package contains a test directory ${PTEST_PATH} for package test purposes."
 
 PTEST_PATH ?= "${libdir}/${PN}/ptest"
+PTEST_RUN_SCRIPT_PATH ??= "${WORKDIR}"
 FILES_${PN}-ptest = "${PTEST_PATH}"
 SECTION_${PN}-ptest = "devel"
 ALLOW_EMPTY_${PN}-ptest = "1"
@@ -37,8 +38,8 @@ do_install_ptest() {
 }
 
 do_install_ptest_base() {
-    if [ -f ${WORKDIR}/run-ptest ]; then
-        install -D ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/run-ptest
+    if [ -f ${PTEST_RUN_SCRIPT_PATH}/run-ptest ]; then
+        install -D ${PTEST_RUN_SCRIPT_PATH}/run-ptest ${D}${PTEST_PATH}/run-ptest
         if grep -q install-ptest: Makefile; then
             oe_runmake DESTDIR=${D}${PTEST_PATH} install-ptest
         fi
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [yocto][PATCH 1/1] ptest: user-specified run-ptest script location
  2015-09-21  7:11 ` [yocto][PATCH 1/1] ptest: user-specified run-ptest script location Ian Ray
@ 2015-09-28 13:49   ` Tudor Florea
  2015-09-28 14:46     ` Ray, Ian (GE Healthcare)
  0 siblings, 1 reply; 11+ messages in thread
From: Tudor Florea @ 2015-09-28 13:49 UTC (permalink / raw)
  To: Ian Ray, openembedded-core

Hi Ian

On 9/21/2015 10:11, Ian Ray wrote:
> Provides a new variable, PTEST_RUN_SCRIPT_PATH, which points to a
> directory where the run-ptest script is located.  This location
> defaults to the work directory but may be overridden within a recipe
> if a package ships its own run-ptest script.
> 
> Signed-off-by: Ian Ray <ian.ray@ge.com>
> ---
>  meta/classes/ptest.bbclass | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/classes/ptest.bbclass b/meta/classes/ptest.bbclass
> index b5f470f..7d9d0cc 100644
> --- a/meta/classes/ptest.bbclass
> +++ b/meta/classes/ptest.bbclass
> @@ -3,6 +3,7 @@ DESCRIPTION_${PN}-ptest ?= "${DESCRIPTION}  \
>  This package contains a test directory ${PTEST_PATH} for package test purposes."
>  
>  PTEST_PATH ?= "${libdir}/${PN}/ptest"
> +PTEST_RUN_SCRIPT_PATH ??= "${WORKDIR}"
>  FILES_${PN}-ptest = "${PTEST_PATH}"
>  SECTION_${PN}-ptest = "devel"
>  ALLOW_EMPTY_${PN}-ptest = "1"
> @@ -37,8 +38,8 @@ do_install_ptest() {
>  }
>  
>  do_install_ptest_base() {
> -    if [ -f ${WORKDIR}/run-ptest ]; then
> -        install -D ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/run-ptest
> +    if [ -f ${PTEST_RUN_SCRIPT_PATH}/run-ptest ]; then
> +        install -D ${PTEST_RUN_SCRIPT_PATH}/run-ptest ${D}${PTEST_PATH}/run-ptest
Is there any benefit in adding this? Do you have an example of package
that contains a run-ptest file that could benefit of this approach?
Usually, run-ptest is not part of the package but rather is a standalone
file referred by the package recipe. It is the responsibility of the
person implementing ptest functionality come up with a run-ptest file
(containing a script to be run on target to implement testing
functionality) hence is his/her responsibility as well to put it in the
right place.

>          if grep -q install-ptest: Makefile; then
>              oe_runmake DESTDIR=${D}${PTEST_PATH} install-ptest
>          fi
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [yocto][PATCH 1/1] ptest: user-specified run-ptest script location
  2015-09-28 13:49   ` Tudor Florea
@ 2015-09-28 14:46     ` Ray, Ian (GE Healthcare)
  2015-09-28 15:23       ` Burton, Ross
  0 siblings, 1 reply; 11+ messages in thread
From: Ray, Ian (GE Healthcare) @ 2015-09-28 14:46 UTC (permalink / raw)
  To: Tudor Florea, openembedded-core@lists.openembedded.org

Hi Tudor

On 28 September 2015, Tudor Florea wrote:
> On 9/21/2015 10:11, Ian Ray wrote:
>> Provides a new variable, PTEST_RUN_SCRIPT_PATH, which points to a
>> directory where the run-ptest script is located.  This location
>> defaults to the work directory but may be overridden within a recipe
(snip)
> Is there any benefit in adding this? Do you have an example of package
> that contains a run-ptest file that could benefit of this approach?

The main benefit is for packages that are run-ptest /aware/, in which case
the recipe can be simplified.

I only have examples of our own, internal, packages which have been
developed with ptest in mind.

> Usually, run-ptest is not part of the package but rather is a standalone
> file referred by the package recipe. It is the responsibility of the
> person implementing ptest functionality come up with a run-ptest file
> (containing a script to be run on target to implement testing
> functionality) hence is his/her responsibility as well to put it in the
> right place.

Right.  And if the right place is /inside/ the package, then this patch makes
the recipe more explicit.  Admittedly, without this patch one can simply
copy the file explicitly in the recipe.

do_compile_ptest () {
        oe_runmake buildtest-TESTS
        cp ${S}/path/to/run-ptest ${WORKDIR}
}



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [yocto][PATCH 1/1] ptest: user-specified run-ptest script location
  2015-09-28 14:46     ` Ray, Ian (GE Healthcare)
@ 2015-09-28 15:23       ` Burton, Ross
  2015-09-28 15:41         ` Ray, Ian (GE Healthcare)
  0 siblings, 1 reply; 11+ messages in thread
From: Burton, Ross @ 2015-09-28 15:23 UTC (permalink / raw)
  To: Ray, Ian (GE Healthcare); +Cc: openembedded-core@lists.openembedded.org

[-- Attachment #1: Type: text/plain, Size: 330 bytes --]

On 28 September 2015 at 15:46, Ray, Ian (GE Healthcare) <ian.ray@ge.com>
wrote:

> The main benefit is for packages that are run-ptest /aware/, in which case
> the recipe can be simplified.
>

Surely if an upstream is under your control and is ptest-aware, it can also
install run-ptest into the right place too?

Ross

[-- Attachment #2: Type: text/html, Size: 731 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [yocto][PATCH 1/1] ptest: user-specified run-ptest script location
  2015-09-28 15:23       ` Burton, Ross
@ 2015-09-28 15:41         ` Ray, Ian (GE Healthcare)
  2015-09-28 18:44           ` Tudor Florea
  0 siblings, 1 reply; 11+ messages in thread
From: Ray, Ian (GE Healthcare) @ 2015-09-28 15:41 UTC (permalink / raw)
  To: Burton, Ross; +Cc: openembedded-core@lists.openembedded.org

Hi Ross

> On 28 September 2015, Ross Burton wrote:
>> On 28 September 2015 at 15:46, Ray, Ian (GE Healthcare) <ian.ray@ge.com> wrote:
>>The main benefit is for packages that are run-ptest /aware/, in which case
>> the recipe can be simplified.

> Surely if an upstream is under your control and is ptest-aware, it can also install run-ptest into the right place too?

The run-ptest script is currently required to be in WORKDIR.  Can a package
know WORKDIR without other changes to the recipe?  (WORKDIR did not
seem to be present in a quick check of a run.do_compile log I had handy.)


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [yocto][PATCH 1/1] ptest: user-specified run-ptest script location
  2015-09-28 15:41         ` Ray, Ian (GE Healthcare)
@ 2015-09-28 18:44           ` Tudor Florea
  2015-09-29  6:59             ` Ray, Ian (GE Healthcare)
  0 siblings, 1 reply; 11+ messages in thread
From: Tudor Florea @ 2015-09-28 18:44 UTC (permalink / raw)
  To: Ray, Ian (GE Healthcare), Burton, Ross
  Cc: openembedded-core@lists.openembedded.org



On 28.09.2015 18:41, Ray, Ian (GE Healthcare) wrote:
> Hi Ross
>
>> On 28 September 2015, Ross Burton wrote:
>>> On 28 September 2015 at 15:46, Ray, Ian (GE Healthcare) <ian.ray@ge.com> wrote:
>>> The main benefit is for packages that are run-ptest /aware/, in which case
>>> the recipe can be simplified.
>> Surely if an upstream is under your control and is ptest-aware, it can also install run-ptest into the right place too?
> The run-ptest script is currently required to be in WORKDIR.
Actually run-ptest is currently required to be present in 
/usr/lib/<package>/ptest. If a package is "ptest-aware", that  package 
should contain a  install-ptest make target which will take care of 
installing the run-ptest file.

>   Can a package
> know WORKDIR without other changes to the recipe?  (WORKDIR did not
> seem to be present in a quick check of a run.do_compile log I had handy.)
>



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [yocto][PATCH 1/1] ptest: user-specified run-ptest script location
  2015-09-28 18:44           ` Tudor Florea
@ 2015-09-29  6:59             ` Ray, Ian (GE Healthcare)
  2015-09-29 13:17               ` Richard Purdie
  2015-09-29 19:53               ` Tudor Florea
  0 siblings, 2 replies; 11+ messages in thread
From: Ray, Ian (GE Healthcare) @ 2015-09-29  6:59 UTC (permalink / raw)
  To: Tudor Florea, Burton, Ross; +Cc: openembedded-core@lists.openembedded.org

On 28 September 2015, Tudor Florea wrote:
> > On 28 September 2015, Ross Burton wrote:
> > > Surely if an upstream is under your control and is ptest-aware, it can also
> > > install run-ptest into the right place too?
> > The run-ptest script is currently required to be in WORKDIR.
> Actually run-ptest is currently required to be present in
> /usr/lib/<package>/ptest. If a package is "ptest-aware", that  package
> should contain a  install-ptest make target which will take care of
> installing the run-ptest file.

In summary, the options seem to be as follows:

# option 1 -- package includes run-ptest, recipe points to it
PTEST_RUN_SCRIPT_PATH = "path/to/run-ptest"

# option 2 -- recipe copies run-ptest to WORKDIR
# This leverages meta/classes/ptest.bbclass do_install_ptest_base.
do_compile_ptest () {
        oe_runmake buildtest-TESTS
        cp ${S}/path/to/run-ptest ${WORKDIR}
}

# option 3 -- package installs run-ptest
# The recipe requires custom do_install_ptest because there is no
# run-ptest in WORKDIR so meta/classes/ptest.bbclass does not call
# do_install_ptest_base.
do_install () {
        oe_runmake DESTDIR=${D} install

        # Copied from do_install_ptest_base.
        install -D ${S}/ptest/run-ptest ${D}${PTEST_PATH}/run-ptest
        oe_runmake DESTDIR=${D}${PTEST_PATH} install-ptest
        chown -R root:root ${D}${PTEST_PATH}

        # Hack alert!  had to comment out do_install_ptest_base[cleandirs] in
        # meta/classes/ptest.bbclass to test this option.
}

My inexperience shows here with option #3 which attempted to address the comments
by Ross and Tudor, but which does not actually work (tested on Fido branch).

Maybe there is an option #4, where the recipe does *not* inherit ptest, but that would
place a significant burden on the recipe author (detecting PTEST_ENABLED, adding
tasks, etc).  No doubt there is an easier way.  Sorry for being such a noob!

Ian


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [yocto][PATCH 1/1] ptest: user-specified run-ptest script location
  2015-09-29  6:59             ` Ray, Ian (GE Healthcare)
@ 2015-09-29 13:17               ` Richard Purdie
  2015-09-29 19:53               ` Tudor Florea
  1 sibling, 0 replies; 11+ messages in thread
From: Richard Purdie @ 2015-09-29 13:17 UTC (permalink / raw)
  To: Ray, Ian (GE Healthcare); +Cc: openembedded-core@lists.openembedded.org

On Tue, 2015-09-29 at 06:59 +0000, Ray, Ian (GE Healthcare) wrote:
> On 28 September 2015, Tudor Florea wrote:
> > > On 28 September 2015, Ross Burton wrote:
> > > > Surely if an upstream is under your control and is ptest-aware, it can also
> > > > install run-ptest into the right place too?
> > > The run-ptest script is currently required to be in WORKDIR.
> > Actually run-ptest is currently required to be present in
> > /usr/lib/<package>/ptest. If a package is "ptest-aware", that  package
> > should contain a  install-ptest make target which will take care of
> > installing the run-ptest file.
> 
> In summary, the options seem to be as follows:
> 
> # option 1 -- package includes run-ptest, recipe points to it
> PTEST_RUN_SCRIPT_PATH = "path/to/run-ptest"
> 
> # option 2 -- recipe copies run-ptest to WORKDIR
> # This leverages meta/classes/ptest.bbclass do_install_ptest_base.
> do_compile_ptest () {
>         oe_runmake buildtest-TESTS
>         cp ${S}/path/to/run-ptest ${WORKDIR}
> }
> 
> # option 3 -- package installs run-ptest
> # The recipe requires custom do_install_ptest because there is no
> # run-ptest in WORKDIR so meta/classes/ptest.bbclass does not call
> # do_install_ptest_base.
> do_install () {
>         oe_runmake DESTDIR=${D} install
> 
>         # Copied from do_install_ptest_base.
>         install -D ${S}/ptest/run-ptest ${D}${PTEST_PATH}/run-ptest
>         oe_runmake DESTDIR=${D}${PTEST_PATH} install-ptest
>         chown -R root:root ${D}${PTEST_PATH}
> 
>         # Hack alert!  had to comment out do_install_ptest_base[cleandirs] in
>         # meta/classes/ptest.bbclass to test this option.
> }
> 
> My inexperience shows here with option #3 which attempted to address the comments
> by Ross and Tudor, but which does not actually work (tested on Fido branch).
> 
> Maybe there is an option #4, where the recipe does *not* inherit ptest, but that would
> place a significant burden on the recipe author (detecting PTEST_ENABLED, adding
> tasks, etc).  No doubt there is an easier way.  Sorry for being such a noob!

I think people were suggesting option 4 where your "make install" puts
the file into the correct place in DESTDIR when the install is run.
There is then nothing the recipe needs to do.

Cheers,

Richard





^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [yocto][PATCH 1/1] ptest: user-specified run-ptest script location
  2015-09-29  6:59             ` Ray, Ian (GE Healthcare)
  2015-09-29 13:17               ` Richard Purdie
@ 2015-09-29 19:53               ` Tudor Florea
  2015-09-30 10:35                 ` Ray, Ian (GE Healthcare)
  1 sibling, 1 reply; 11+ messages in thread
From: Tudor Florea @ 2015-09-29 19:53 UTC (permalink / raw)
  To: Ray, Ian (GE Healthcare), Burton, Ross
  Cc: openembedded-core@lists.openembedded.org



On 29/09/2015 09:59, Ray, Ian (GE Healthcare) wrote:
> On 28 September 2015, Tudor Florea wrote:
>>> On 28 September 2015, Ross Burton wrote:
>>>> Surely if an upstream is under your control and is ptest-aware, it can also
>>>> install run-ptest into the right place too?
>>> The run-ptest script is currently required to be in WORKDIR.
>> Actually run-ptest is currently required to be present in
>> /usr/lib/<package>/ptest. If a package is "ptest-aware", that  package
>> should contain a  install-ptest make target which will take care of
>> installing the run-ptest file.
> In summary, the options seem to be as follows:
>
> # option 1 -- package includes run-ptest, recipe points to it
> PTEST_RUN_SCRIPT_PATH = "path/to/run-ptest"
>
> # option 2 -- recipe copies run-ptest to WORKDIR
> # This leverages meta/classes/ptest.bbclass do_install_ptest_base.
> do_compile_ptest () {
>          oe_runmake buildtest-TESTS
>          cp ${S}/path/to/run-ptest ${WORKDIR}
> }
>
> # option 3 -- package installs run-ptest
> # The recipe requires custom do_install_ptest because there is no
> # run-ptest in WORKDIR so meta/classes/ptest.bbclass does not call
> # do_install_ptest_base.
> do_install () {
>          oe_runmake DESTDIR=${D} install
>
>          # Copied from do_install_ptest_base.
>          install -D ${S}/ptest/run-ptest ${D}${PTEST_PATH}/run-ptest
>          oe_runmake DESTDIR=${D}${PTEST_PATH} install-ptest
>          chown -R root:root ${D}${PTEST_PATH}
>
>          # Hack alert!  had to comment out do_install_ptest_base[cleandirs] in
>          # meta/classes/ptest.bbclass to test this option.
> }
>
> My inexperience shows here with option #3 which attempted to address the comments
> by Ross and Tudor, but which does not actually work (tested on Fido branch).
I think that we should modify do_install_ptest_base to run 
do_install_ptest and install the Makefile irrespective of the presence 
of run-ptest file in ${WORKDIR}
Something like:
do_install_ptest_base() {
     if [ -f ${WORKDIR}/run-ptest ]; then
         install -D ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/run-ptest
     fi
     if grep -q install-ptest: Makefile; then
         oe_runmake DESTDIR=${D}${PTEST_PATH} install-ptest
     fi
     do_install_ptest
}

Does this fits with your needs?

Regards,
   Tudor

>
> Maybe there is an option #4, where the recipe does *not* inherit ptest, but that would
> place a significant burden on the recipe author (detecting PTEST_ENABLED, adding
> tasks, etc).  No doubt there is an easier way.  Sorry for being such a noob!
>
> Ian
>



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [yocto][PATCH 1/1] ptest: user-specified run-ptest script location
  2015-09-29 19:53               ` Tudor Florea
@ 2015-09-30 10:35                 ` Ray, Ian (GE Healthcare)
  0 siblings, 0 replies; 11+ messages in thread
From: Ray, Ian (GE Healthcare) @ 2015-09-30 10:35 UTC (permalink / raw)
  To: Tudor Florea, Burton, Ross; +Cc: openembedded-core@lists.openembedded.org

> I think that we should modify do_install_ptest_base to run
> do_install_ptest and install the Makefile irrespective of the presence
> of run-ptest file in ${WORKDIR}
> Something like:
> do_install_ptest_base() {
>      if [ -f ${WORKDIR}/run-ptest ]; then
>          install -D ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/run-ptest
>      fi
>      if grep -q install-ptest: Makefile; then
>          oe_runmake DESTDIR=${D}${PTEST_PATH} install-ptest
>      fi
>      do_install_ptest
> }
> 
> Does this fits with your needs?

That's a good idea!  Yes, that would fit very well indeed.

I submitted a new patch proposal in thread "[PATCH v2 0/1] ptest:
run-ptest not required to run do_install_ptest".

Thank you for your comments,

Ian


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-09-30 10:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-21  7:11 [yocto][PATCH 0/1] new PTEST_RUN_SCRIPT_PATH Ian Ray
2015-09-21  7:11 ` [yocto][PATCH 1/1] ptest: user-specified run-ptest script location Ian Ray
2015-09-28 13:49   ` Tudor Florea
2015-09-28 14:46     ` Ray, Ian (GE Healthcare)
2015-09-28 15:23       ` Burton, Ross
2015-09-28 15:41         ` Ray, Ian (GE Healthcare)
2015-09-28 18:44           ` Tudor Florea
2015-09-29  6:59             ` Ray, Ian (GE Healthcare)
2015-09-29 13:17               ` Richard Purdie
2015-09-29 19:53               ` Tudor Florea
2015-09-30 10:35                 ` Ray, Ian (GE Healthcare)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox