summaryrefslogtreecommitdiffstats
path: root/documentation/dev-manual
diff options
context:
space:
mode:
authorScott Rifenbark <scott.m.rifenbark@intel.com>2013-04-11 17:34:24 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-04-12 17:02:00 +0100
commitaf0640257120bc189ccc96003b8117a1f6a5d2c4 (patch)
treee6c58a27d75118244a87730afe12394244df8798 /documentation/dev-manual
parentb52a9cba0a9e606f776214a8c30b8ba8a56da8b0 (diff)
downloadpoky-af0640257120bc189ccc96003b8117a1f6a5d2c4.tar.gz
dev-manual: Completed first draft of the new Ptest section.
(From yocto-docs rev: 90fbbc2eb6bc6292432060fbd3e806b809f70148) Signed-off-by: Scott Rifenbark <scott.m.rifenbark@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation/dev-manual')
-rw-r--r--documentation/dev-manual/dev-manual-common-tasks.xml73
1 files 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 @@
3476 </para> 3476 </para>
3477 </section> 3477 </section>
3478 3478
3479 <section id='setting-up-and-running-package-test-ptest'> 3479 <section id='testing-packages-with-ptest'>
3480 <title>Setting Up and Running Package Test (Ptest)</title> 3480 <title>Testing Packages with Ptest</title>
3481 3481
3482 <para> 3482 <para>
3483 Intro shit 3483 A Packate Test (Ptest) runs tests against packages built
3484 by the OpenEmbedded build system.
3485 Minimaly, a Ptest contains two things: a shell script that
3486 starts the test, and the actual test.
3487 The shell that starts the test must not contain
3488 the actual test, the script only starts it.
3489 On the other hand, the test can be anything from a simple
3490 schell script that runs a binary and checks the output to
3491 an elaborate system of test binaries and data files.
3492 </para>
3493
3494 <para>
3495 The test formats the output into the single, common
3496 format used by Automake:
3497 <literallayout class='monospaced'>
3498 &lt;result&gt;: &lt;testname&gr;
3499 </literallayout>
3500 The <filename>&lt;result&gt;</filename> can be
3501 <filename>PASS</filename>, <filename>FAIL</filename>, or
3502 <filename>SKIP</filename>.
3503 The <filename>&lt;testname&gt;</filename> can be any
3504 identifying string.
3484 </para> 3505 </para>
3485 3506
3486 <section id='getting-your-package-ready'> 3507 <section id='getting-your-package-ready'>
@@ -3488,13 +3509,13 @@
3488 3509
3489 <para> 3510 <para>
3490 In order to run installed Ptests on target hardware, 3511 In order to run installed Ptests on target hardware,
3491 you need to prepare each recipe so that it can run 3512 you need to prepare the recipes that build the packages
3492 its test. 3513 you want to test.
3493 Here is what you have to do: 3514 Here is what you have to do for each recipe:
3494 <itemizedlist> 3515 <itemizedlist>
3495 <listitem><para><emphasis>Be sure the package recipe 3516 <listitem><para><emphasis>Be sure the package recipe
3496 inherits Ptest:</emphasis> 3517 inherits Ptest:</emphasis>
3497 Include the following line in your recipe: 3518 Include the following line in your recipes:
3498 <literallayout class='monospaced'> 3519 <literallayout class='monospaced'>
3499 inherit ptest 3520 inherit ptest
3500 </literallayout> 3521 </literallayout>
@@ -3506,8 +3527,9 @@
3506 (such as requiring "make" to run the test suite), 3527 (such as requiring "make" to run the test suite),
3507 use the 3528 use the
3508 <ulink url='&YOCTO_DOCS_REF_URL;#var-RDEPENDS'><filename>RDEPENDS</filename></ulink> 3529 <ulink url='&YOCTO_DOCS_REF_URL;#var-RDEPENDS'><filename>RDEPENDS</filename></ulink>
3509 variable in your package to meet the dependency. 3530 variable in your recipe so the package meets the
3510 Here is an example where the recipe has a build 3531 dependency.
3532 Here is an example where the package has a build
3511 dependency on "make": 3533 dependency on "make":
3512 <literallayout class='monospaced'> 3534 <literallayout class='monospaced'>
3513 RDEPENDS_${PN}-ptest += "make" 3535 RDEPENDS_${PN}-ptest += "make"
@@ -3517,8 +3539,8 @@
3517 test suite:</emphasis> 3539 test suite:</emphasis>
3518 Few packages support cross-compiling their test 3540 Few packages support cross-compiling their test
3519 suites. 3541 suites.
3520 Consequently, you usually need to add a function 3542 Consequently, you usually need to add that function.
3521 to do that.</para> 3543 </para>
3522 <para>Many packages based on Automake compile and 3544 <para>Many packages based on Automake compile and
3523 run the test suite by using a single command 3545 run the test suite by using a single command
3524 such as <filename>make check</filename>. 3546 such as <filename>make check</filename>.
@@ -3528,11 +3550,11 @@
3528 Thus, compilation needs to occur separately on 3550 Thus, compilation needs to occur separately on
3529 the host. 3551 the host.
3530 The built version of Automake that ships with 3552 The built version of Automake that ships with
3531 the Yocto Project does this automatically through 3553 the Yocto Project separates these actions
3532 a patch. 3554 automatically through a patch.
3533 Consequently, packages that use 3555 Consequently, packages that use
3534 <filename>make check</filename> automatically 3556 <filename>make check</filename> automatically
3535 are deal with the cross-compile situation.</para> 3557 cross-compile.</para>
3536 <para>However, you still must add a 3558 <para>However, you still must add a
3537 <filename>do_compile_ptest</filename> function to 3559 <filename>do_compile_ptest</filename> function to
3538 build the test suite. 3560 build the test suite.
@@ -3546,8 +3568,8 @@
3546 </para></listitem> 3568 </para></listitem>
3547 <listitem><para><emphasis>Ensure special configurations 3569 <listitem><para><emphasis>Ensure special configurations
3548 are set:</emphasis> 3570 are set:</emphasis>
3549 If the package requires special configuration 3571 If the package requires special configurations
3550 actions prior to compiling the test code, you must 3572 prior to compiling the test code, you must
3551 insert a <filename>do_configure_ptest</filename> 3573 insert a <filename>do_configure_ptest</filename>
3552 function into the recipe. 3574 function into the recipe.
3553 </para></listitem> 3575 </para></listitem>
@@ -3555,13 +3577,12 @@
3555 suite:</emphasis> 3577 suite:</emphasis>
3556 The <filename>ptest.bbclass</filename> class 3578 The <filename>ptest.bbclass</filename> class
3557 automatically copies the required files that both 3579 automatically copies the required files that both
3558 "make" and run the tests assuming there is a 3580 "make" (assuming there is a make target in the
3559 make target in the top-level 3581 top-level <filename>Makefile</filename>) and run
3560 <filename>Makefile</filename>. 3582 the tests.
3561 If this is not the case, you need to create a 3583 If this is not the case, you need to create a
3562 <filename>do_install_ptest</filename> in the 3584 <filename>do_install_ptest</filename> that gets
3563 package recipe that is called after the 3585 called after the "make install-ptest" completes.
3564 "make install-ptest" has completed.
3565 </para></listitem> 3586 </para></listitem>
3566 </itemizedlist> 3587 </itemizedlist>
3567 </para> 3588 </para>
@@ -3571,8 +3592,8 @@
3571 <title>Adding Ptest to Your Build</title> 3592 <title>Adding Ptest to Your Build</title>
3572 3593
3573 <para> 3594 <para>
3574 To add Ptest to your build, add the following 3595 To add package testing to your build, add the following
3575 into your <filename>local.conf</filename> file, 3596 two statements to your <filename>local.conf</filename> file,
3576 which is found in the 3597 which is found in the
3577 <link linkend='build-directory'>Build Directory</link>: 3598 <link linkend='build-directory'>Build Directory</link>:
3578 <literallayout class='monospaced'> 3599 <literallayout class='monospaced'>
@@ -3581,8 +3602,8 @@
3581 </literallayout> 3602 </literallayout>
3582 Once your build is complete, the Ptest files are installed 3603 Once your build is complete, the Ptest files are installed
3583 into the <filename>/usr/lib/&lt;package&gt;/ptest</filename> 3604 into the <filename>/usr/lib/&lt;package&gt;/ptest</filename>
3584 directory, where &lt;package&gt; is the name of the 3605 directory, where <filename>&lt;package&gt;</filename>
3585 package. 3606 is the name of the package.
3586 </para> 3607 </para>
3587 </section> 3608 </section>
3588 3609