new PTEST_RUN_SCRIPT_PATH
cover new PTEST_RUN_SCRIPT_PATH
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(-)
Signature · 1 line
1.8.3.1
PATCH 1/1 ptest: user-specified run-ptest script location
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.
--- meta/classes/ptest.bbclass | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
meta/classes/ptest.bbclass +3 -2
@@ -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
Signature · 1 line
1.8.3.1
Re: [yocto][PATCH 1/1] ptest: user-specified run-ptest script location
Hi Ian
Quoted 23 lines · Ian Ray
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 <[email protected]>--- meta/classes/ptest.bbclass | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)meta/classes/ptest.bbclass +1
-0@@ -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"
meta/classes/ptest.bbclass do_install_ptest() { · line 42
Quoted 7 lines
meta/classes/ptest.bbclass +2
-2@@ -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.
Quoted 4 lines
meta/classes/ptest.bbclass +0
-0if grep -q install-ptest: Makefile; then oe_runmake DESTDIR=${D}${PTEST_PATH} install-ptest fi
Re: [yocto][PATCH 1/1] ptest: user-specified run-ptest script location
Hi Tudor
Quoted 4 lines · Tudor Florea
Quoted 3 lines · Ian Ray
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)
Quoted 2 lines
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.
Quoted 6 lines
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}
}Re: [yocto][PATCH 1/1] ptest: user-specified run-ptest script location
Quoted 3 lines · Ian (GE Healthcare)
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
Re: [yocto][PATCH 1/1] ptest: user-specified run-ptest script location
Hi Ross
Quoted 6 lines · Ross Burton
Quoted 3 lines · Ian (GE Healthcare)
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.)
Re: [yocto][PATCH 1/1] ptest: user-specified run-ptest script location
Quoted 8 lines · Ian (GE Healthcare)
Hi Ross
Quoted 5 lines · Ross Burton
Quoted 3 lines · Ian (GE Healthcare)
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.
Quoted 4 lines
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.)
Re: [yocto][PATCH 1/1] ptest: user-specified run-ptest script location
Quoted 8 lines · Tudor Florea
Quoted 4 lines · Ross Burton
Quoted 2 lines
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
Re: [yocto][PATCH 1/1] ptest: user-specified run-ptest script location
Quoted 38 lines · Ian (GE Healthcare)
Quoted 8 lines · Tudor Florea
Quoted 4 lines · Ross Burton
Quoted 2 lines
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-ptestoe_runmakeDESTDIR=${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.
}
Quoted 6 lines
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
Re: [yocto][PATCH 1/1] ptest: user-specified run-ptest script location
In reply to Ray, Ian (GE Healthcare)Quoted 33 lines · Ian (GE Healthcare)
Quoted 8 lines · Tudor Florea
Quoted 4 lines · Ross Burton
Quoted 2 lines
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-ptestoe_runmakeDESTDIR=${D}${PTEST_PATH} install-ptest chown -R root:root ${D}${PTEST_PATH}
Quoted 6 lines
# 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
Quoted 7 lines
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
Re: [yocto][PATCH 1/1] ptest: user-specified run-ptest script location
Quoted 14 lines
I think that we should modify
do_install_ptest_baseto rundo_install_ptestand install theMakefileirrespective 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 }
Quoted 1 line
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