From af0640257120bc189ccc96003b8117a1f6a5d2c4 Mon Sep 17 00:00:00 2001 From: Scott Rifenbark Date: Thu, 11 Apr 2013 17:34:24 -0700 Subject: [PATCH] dev-manual: Completed first draft of the new Ptest section. (From yocto-docs rev: 90fbbc2eb6bc6292432060fbd3e806b809f70148) Signed-off-by: Scott Rifenbark Signed-off-by: Richard Purdie --- .../dev-manual/dev-manual-common-tasks.xml | 73 ++++++++++++------- 1 file changed, 47 insertions(+), 26 deletions(-) diff --git a/documentation/dev-manual/dev-manual-common-tasks.xml b/documentation/dev-manual/dev-manual-common-tasks.xml index 07189e8a9c..ad37eeb31d 100644 --- a/documentation/dev-manual/dev-manual-common-tasks.xml +++ b/documentation/dev-manual/dev-manual-common-tasks.xml @@ -3476,11 +3476,32 @@ -
- Setting Up and Running Package Test (Ptest) +
+ Testing Packages with Ptest - Intro shit + A Packate Test (Ptest) runs tests against packages built + by the OpenEmbedded build system. + Minimaly, a Ptest contains two things: a shell script that + starts the test, and the actual test. + The shell that starts the test must not contain + the actual test, the script only starts it. + On the other hand, the test can be anything from a simple + schell script that runs a binary and checks the output to + an elaborate system of test binaries and data files. + + + + The test formats the output into the single, common + format used by Automake: + + <result>: <testname&gr; + + The <result> can be + PASS, FAIL, or + SKIP. + The <testname> can be any + identifying string.
@@ -3488,13 +3509,13 @@ 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: + you need to prepare the recipes that build the packages + you want to test. + Here is what you have to do for each recipe: Be sure the package recipe inherits Ptest: - Include the following line in your recipe: + Include the following line in your recipes: inherit ptest @@ -3506,8 +3527,9 @@ (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 + variable in your recipe so the package meets the + dependency. + Here is an example where the package has a build dependency on "make": RDEPENDS_${PN}-ptest += "make" @@ -3517,8 +3539,8 @@ test suite: Few packages support cross-compiling their test suites. - Consequently, you usually need to add a function - to do that. + Consequently, you usually need to add that function. + Many packages based on Automake compile and run the test suite by using a single command such as make check. @@ -3528,11 +3550,11 @@ 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. + the Yocto Project separates these actions + automatically through a patch. Consequently, packages that use make check automatically - are deal with the cross-compile situation. + cross-compile. However, you still must add a do_compile_ptest function to build the test suite. @@ -3546,8 +3568,8 @@ Ensure special configurations are set: - If the package requires special configuration - actions prior to compiling the test code, you must + If the package requires special configurations + prior to compiling the test code, you must insert a do_configure_ptest function into the recipe. @@ -3555,13 +3577,12 @@ 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. + "make" (assuming there is a make target in the + top-level Makefile) and run + the tests. 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. + do_install_ptest that gets + called after the "make install-ptest" completes. @@ -3571,8 +3592,8 @@ Adding Ptest to Your Build - To add Ptest to your build, add the following - into your local.conf file, + To add package testing to your build, add the following + two statements to your local.conf file, which is found in the Build Directory: @@ -3581,8 +3602,8 @@ 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. + directory, where <package> + is the name of the package.