summaryrefslogtreecommitdiffstats
path: root/documentation/dev-manual/packages.rst
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/dev-manual/packages.rst')
-rw-r--r--documentation/dev-manual/packages.rst112
1 files changed, 3 insertions, 109 deletions
diff --git a/documentation/dev-manual/packages.rst b/documentation/dev-manual/packages.rst
index 33cf78747d..4ba2dcae3a 100644
--- a/documentation/dev-manual/packages.rst
+++ b/documentation/dev-manual/packages.rst
@@ -16,7 +16,7 @@ This section describes a few tasks that involve packages:
16- :ref:`dev-manual/packages:generating and using signed packages` 16- :ref:`dev-manual/packages:generating and using signed packages`
17 17
18- :ref:`Setting up and running package test 18- :ref:`Setting up and running package test
19 (ptest) <dev-manual/packages:testing packages with ptest>` 19 (ptest) <test-manual/ptest:testing packages with ptest>`
20 20
21- :ref:`dev-manual/packages:creating node package manager (npm) packages` 21- :ref:`dev-manual/packages:creating node package manager (npm) packages`
22 22
@@ -882,114 +882,8 @@ related to signed package feeds are available:
882Testing Packages With ptest 882Testing Packages With ptest
883=========================== 883===========================
884 884
885A Package Test (ptest) runs tests against packages built by the 885See the :ref:`test-manual/ptest:Testing Packages With ptest` section of the
886OpenEmbedded build system on the target machine. A ptest contains at 886Yocto Project Test Environment Manual.
887least two items: the actual test, and a shell script (``run-ptest``)
888that starts the test. The shell script that starts the test must not
889contain the actual test --- the script only starts the test. On the other
890hand, the test can be anything from a simple shell script that runs a
891binary and checks the output to an elaborate system of test binaries and
892data files.
893
894The test generates output in the format used by Automake::
895
896 result: testname
897
898where the result can be ``PASS``, ``FAIL``, or ``SKIP``, and
899the testname can be any identifying string.
900
901For a list of Yocto Project recipes that are already enabled with ptest,
902see the :yocto_wiki:`Ptest </Ptest>` wiki page.
903
904.. note::
905
906 A recipe is "ptest-enabled" if it inherits the :ref:`ref-classes-ptest`
907 class.
908
909Adding ptest to Your Build
910--------------------------
911
912To add package testing to your build, add the :term:`DISTRO_FEATURES` and
913:term:`EXTRA_IMAGE_FEATURES` variables to your ``local.conf`` file, which
914is found in the :term:`Build Directory`::
915
916 DISTRO_FEATURES:append = " ptest"
917 EXTRA_IMAGE_FEATURES += "ptest-pkgs"
918
919Once your build is complete, the ptest files are installed into the
920``/usr/lib/package/ptest`` directory within the image, where ``package``
921is the name of the package.
922
923Running ptest
924-------------
925
926The ``ptest-runner`` package installs a shell script that loops through
927all installed ptest test suites and runs them in sequence. Consequently,
928you might want to add this package to your image.
929
930Getting Your Package Ready
931--------------------------
932
933In order to enable a recipe to run installed ptests on target hardware,
934you need to prepare the recipes that build the packages you want to
935test. Here is what you have to do for each recipe:
936
937- *Be sure the recipe inherits the* :ref:`ref-classes-ptest` *class:*
938 Include the following line in each recipe::
939
940 inherit ptest
941
942- *Create run-ptest:* This script starts your test. Locate the
943 script where you will refer to it using
944 :term:`SRC_URI`. Here is an
945 example that starts a test for ``dbus``::
946
947 #!/bin/sh
948 cd test
949 make -k runtest-TESTS
950
951- *Ensure dependencies are met:* If the test adds build or runtime
952 dependencies that normally do not exist for the package (such as
953 requiring "make" to run the test suite), use the
954 :term:`DEPENDS` and
955 :term:`RDEPENDS` variables in
956 your recipe in order for the package to meet the dependencies. Here
957 is an example where the package has a runtime dependency on "make"::
958
959 RDEPENDS:${PN}-ptest += "make"
960
961- *Add a function to build the test suite:* Not many packages support
962 cross-compilation of their test suites. Consequently, you usually
963 need to add a cross-compilation function to the package.
964
965 Many packages based on Automake compile and run the test suite by
966 using a single command such as ``make check``. However, the host
967 ``make check`` builds and runs on the same computer, while
968 cross-compiling requires that the package is built on the host but
969 executed for the target architecture (though often, as in the case
970 for ptest, the execution occurs on the host). The built version of
971 Automake that ships with the Yocto Project includes a patch that
972 separates building and execution. Consequently, packages that use the
973 unaltered, patched version of ``make check`` automatically
974 cross-compiles.
975
976 Regardless, you still must add a ``do_compile_ptest`` function to
977 build the test suite. Add a function similar to the following to your
978 recipe::
979
980 do_compile_ptest() {
981 oe_runmake buildtest-TESTS
982 }
983
984- *Ensure special configurations are set:* If the package requires
985 special configurations prior to compiling the test code, you must
986 insert a ``do_configure_ptest`` function into the recipe.
987
988- *Install the test suite:* The :ref:`ref-classes-ptest` class
989 automatically copies the file ``run-ptest`` to the target and then runs make
990 ``install-ptest`` to run the tests. If this is not enough, you need
991 to create a ``do_install_ptest`` function and make sure it gets
992 called after the "make install-ptest" completes.
993 887
994Creating Node Package Manager (NPM) Packages 888Creating Node Package Manager (NPM) Packages
995============================================ 889============================================