diff options
author | Scott Rifenbark <scott.m.rifenbark@intel.com> | 2013-04-11 11:47:40 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-04-12 17:02:02 +0100 |
commit | 07879e5865871ffa299ef2a3ac8db5cd6db4ab61 (patch) | |
tree | e26178c4318daff16de072aa827385a2aeb6b70b /documentation | |
parent | 7561640dd22dbf2f2ab7b1a5afe8394a4cca5796 (diff) | |
download | poky-07879e5865871ffa299ef2a3ac8db5cd6db4ab61.tar.gz |
dev-manual: First draft of new Ptest section.
(From yocto-docs rev: 0580709bedec80446e6de5b9c135c3df89e2805f)
Signed-off-by: Scott Rifenbark <scott.m.rifenbark@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation')
-rw-r--r-- | documentation/dev-manual/dev-manual-common-tasks.xml | 126 |
1 files changed, 126 insertions, 0 deletions
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 @@ | |||
2847 | </para></listitem> | 2847 | </para></listitem> |
2848 | <listitem><para>Setting up Runtime Package Management | 2848 | <listitem><para>Setting up Runtime Package Management |
2849 | </para></listitem> | 2849 | </para></listitem> |
2850 | <listitem><para>Setting up and running package test | ||
2851 | (Ptest) | ||
2852 | </para></listitem> | ||
2850 | </itemizedlist> | 2853 | </itemizedlist> |
2851 | </para> | 2854 | </para> |
2852 | 2855 | ||
@@ -3472,6 +3475,129 @@ | |||
3472 | </literallayout> | 3475 | </literallayout> |
3473 | </para> | 3476 | </para> |
3474 | </section> | 3477 | </section> |
3478 | |||
3479 | <section id='setting-up-and-running-package-test-ptest'> | ||
3480 | <title>Setting Up and Running Package Test (Ptest)</title> | ||
3481 | |||
3482 | <para> | ||
3483 | Intro shit | ||
3484 | </para> | ||
3485 | |||
3486 | <section id='getting-your-package-ready'> | ||
3487 | <title>Getting Your Package Ready</title> | ||
3488 | |||
3489 | <para> | ||
3490 | In order to run installed Ptests on target hardware, | ||
3491 | you need to prepare each recipe so that it can run | ||
3492 | its test. | ||
3493 | Here is what you have to do: | ||
3494 | <itemizedlist> | ||
3495 | <listitem><para><emphasis>Be sure the package recipe | ||
3496 | inherits Ptest:</emphasis> | ||
3497 | Include the following line in your recipe: | ||
3498 | <literallayout class='monospaced'> | ||
3499 | inherit ptest | ||
3500 | </literallayout> | ||
3501 | </para></listitem> | ||
3502 | <listitem><para><emphasis>Ensure dependencies are | ||
3503 | met:</emphasis> | ||
3504 | If the test adds build or runtime dependencies | ||
3505 | to the package that do not normally exist | ||
3506 | (such as requiring "make" to run the test suite), | ||
3507 | use the | ||
3508 | <ulink url='&YOCTO_DOCS_REF_URL;#var-RDEPENDS'><filename>RDEPENDS</filename></ulink> | ||
3509 | variable in your package to meet the dependency. | ||
3510 | Here is an example where the recipe has a build | ||
3511 | dependency on "make": | ||
3512 | <literallayout class='monospaced'> | ||
3513 | RDEPENDS_${PN}-ptest += "make" | ||
3514 | </literallayout> | ||
3515 | </para></listitem> | ||
3516 | <listitem><para><emphasis>Add a function to build the | ||
3517 | test suite:</emphasis> | ||
3518 | Few packages support cross-compiling their test | ||
3519 | suites. | ||
3520 | Consequently, you usually need to add a function | ||
3521 | to do that.</para> | ||
3522 | <para>Many packages based on Automake compile and | ||
3523 | run the test suite by using a single command | ||
3524 | such as <filename>make check</filename>. | ||
3525 | However, this method does not work when you are | ||
3526 | cross-compiling packages because building occurs on | ||
3527 | the host and execution occurs on the target. | ||
3528 | Thus, compilation needs to occur separately on | ||
3529 | the host. | ||
3530 | The built version of Automake that ships with | ||
3531 | the Yocto Project does this automatically through | ||
3532 | a patch. | ||
3533 | Consequently, packages that use | ||
3534 | <filename>make check</filename> automatically | ||
3535 | are deal with the cross-compile situation.</para> | ||
3536 | <para>However, you still must add a | ||
3537 | <filename>do_compile_ptest</filename> function to | ||
3538 | build the test suite. | ||
3539 | Add a function similar to the following to your | ||
3540 | package recipe: | ||
3541 | <literallayout class='monospaced'> | ||
3542 | do_compile_ptest() { | ||
3543 | oe_runmake buildtest-TESTS | ||
3544 | } | ||
3545 | </literallayout> | ||
3546 | </para></listitem> | ||
3547 | <listitem><para><emphasis>Ensure special configurations | ||
3548 | are set:</emphasis> | ||
3549 | If the package requires special configuration | ||
3550 | actions prior to compiling the test code, you must | ||
3551 | insert a <filename>do_configure_ptest</filename> | ||
3552 | function into the recipe. | ||
3553 | </para></listitem> | ||
3554 | <listitem><para><emphasis>Install the test | ||
3555 | suite:</emphasis> | ||
3556 | The <filename>ptest.bbclass</filename> class | ||
3557 | automatically copies the required files that both | ||
3558 | "make" and run the tests assuming there is a | ||
3559 | make target in the top-level | ||
3560 | <filename>Makefile</filename>. | ||
3561 | If this is not the case, you need to create a | ||
3562 | <filename>do_install_ptest</filename> in the | ||
3563 | package recipe that is called after the | ||
3564 | "make install-ptest" has completed. | ||
3565 | </para></listitem> | ||
3566 | </itemizedlist> | ||
3567 | </para> | ||
3568 | </section> | ||
3569 | |||
3570 | <section id='adding-ptest-to-your-build'> | ||
3571 | <title>Adding Ptest to Your Build</title> | ||
3572 | |||
3573 | <para> | ||
3574 | To add Ptest to your build, add the following | ||
3575 | into your <filename>local.conf</filename> file, | ||
3576 | which is found in the | ||
3577 | <link linkend='build-directory'>Build Directory</link>: | ||
3578 | <literallayout class='monospaced'> | ||
3579 | DISTRO_FEATURES += "ptest" | ||
3580 | IMAGE_FEATURES += "ptest" | ||
3581 | </literallayout> | ||
3582 | Once your build is complete, the Ptest files are installed | ||
3583 | into the <filename>/usr/lib/<package>/ptest</filename> | ||
3584 | directory, where <package> is the name of the | ||
3585 | package. | ||
3586 | </para> | ||
3587 | </section> | ||
3588 | |||
3589 | <section id='running-ptest'> | ||
3590 | <title>Running Ptest</title> | ||
3591 | |||
3592 | <para> | ||
3593 | The <filename>ptest-runner</filename> package installs a | ||
3594 | shell script that loops through all installed Ptest test | ||
3595 | suites and runs them in sequence. | ||
3596 | Consequently, you might want to add this package to | ||
3597 | your image. | ||
3598 | </para> | ||
3599 | </section> | ||
3600 | </section> | ||
3475 | </section> | 3601 | </section> |
3476 | 3602 | ||
3477 | <section id="building-software-from-an-external-source"> | 3603 | <section id="building-software-from-an-external-source"> |