From b52a9cba0a9e606f776214a8c30b8ba8a56da8b0 Mon Sep 17 00:00:00 2001 From: Scott Rifenbark Date: Thu, 11 Apr 2013 11:47:40 -0700 Subject: [PATCH] dev-manual: First draft of new Ptest section. (From yocto-docs rev: 0580709bedec80446e6de5b9c135c3df89e2805f) Signed-off-by: Scott Rifenbark Signed-off-by: Richard Purdie --- .../dev-manual/dev-manual-common-tasks.xml | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) diff --git a/documentation/dev-manual/dev-manual-common-tasks.xml b/documentation/dev-manual/dev-manual-common-tasks.xml index db12ca518d..07189e8a9c 100644 --- a/documentation/dev-manual/dev-manual-common-tasks.xml +++ b/documentation/dev-manual/dev-manual-common-tasks.xml @@ -2847,6 +2847,9 @@ Setting up Runtime Package Management + Setting up and running package test + (Ptest) + @@ -3472,6 +3475,129 @@ + +
+ Setting Up and Running Package Test (Ptest) + + + Intro shit + + +
+ Getting Your Package Ready + + + In order to run installed Ptests on target hardware, + you need to prepare each recipe so that it can run + its test. + Here is what you have to do: + + Be sure the package recipe + inherits Ptest: + Include the following line in your recipe: + + inherit ptest + + + Ensure dependencies are + met: + If the test adds build or runtime dependencies + to the package that do not normally exist + (such as requiring "make" to run the test suite), + use the + RDEPENDS + variable in your package to meet the dependency. + Here is an example where the recipe has a build + dependency on "make": + + RDEPENDS_${PN}-ptest += "make" + + + Add a function to build the + test suite: + Few packages support cross-compiling their test + suites. + Consequently, you usually need to add a function + to do that. + Many packages based on Automake compile and + run the test suite by using a single command + such as make check. + However, this method does not work when you are + cross-compiling packages because building occurs on + the host and execution occurs on the target. + Thus, compilation needs to occur separately on + the host. + The built version of Automake that ships with + the Yocto Project does this automatically through + a patch. + Consequently, packages that use + make check automatically + are deal with the cross-compile situation. + However, you still must add a + do_compile_ptest function to + build the test suite. + Add a function similar to the following to your + package recipe: + + do_compile_ptest() { + oe_runmake buildtest-TESTS + } + + + Ensure special configurations + are set: + If the package requires special configuration + actions prior to compiling the test code, you must + insert a do_configure_ptest + function into the recipe. + + Install the test + suite: + The ptest.bbclass class + automatically copies the required files that both + "make" and run the tests assuming there is a + make target in the top-level + Makefile. + If this is not the case, you need to create a + do_install_ptest in the + package recipe that is called after the + "make install-ptest" has completed. + + + +
+ +
+ Adding Ptest to Your Build + + + To add Ptest to your build, add the following + into your local.conf file, + which is found in the + Build Directory: + + DISTRO_FEATURES += "ptest" + IMAGE_FEATURES += "ptest" + + Once your build is complete, the Ptest files are installed + into the /usr/lib/<package>/ptest + directory, where <package> is the name of the + package. + +
+ +
+ Running Ptest + + + The ptest-runner package installs a + shell script that loops through all installed Ptest test + suites and runs them in sequence. + Consequently, you might want to add this package to + your image. + +
+