diff options
Diffstat (limited to 'documentation/dev-manual/dev-manual-common-tasks.xml')
-rw-r--r-- | documentation/dev-manual/dev-manual-common-tasks.xml | 171 |
1 files changed, 111 insertions, 60 deletions
diff --git a/documentation/dev-manual/dev-manual-common-tasks.xml b/documentation/dev-manual/dev-manual-common-tasks.xml index c11df717d3..6fa850d4ed 100644 --- a/documentation/dev-manual/dev-manual-common-tasks.xml +++ b/documentation/dev-manual/dev-manual-common-tasks.xml | |||
@@ -5588,77 +5588,116 @@ | |||
5588 | <para> | 5588 | <para> |
5589 | The OpenEmbedded build system makes available a series of automated | 5589 | The OpenEmbedded build system makes available a series of automated |
5590 | tests for images to verify runtime functionality. | 5590 | tests for images to verify runtime functionality. |
5591 | <note> | 5591 | You can run these tests on either QEMU or actual target hardware. |
5592 | Currently, there is only support for running these tests | 5592 | Tests are written in Python making use of the |
5593 | under QEMU. | ||
5594 | </note> | ||
5595 | These tests are written in Python making use of the | ||
5596 | <filename>unittest</filename> module, and the majority of them | 5593 | <filename>unittest</filename> module, and the majority of them |
5597 | run commands on the target system over SSH. | 5594 | run commands on the target system over SSH. |
5598 | This section describes how you set up the environment to use these | 5595 | This section describes how you set up the environment to use these |
5599 | tests, run available tests, and write and add your own tests. | 5596 | tests, run available tests, and write and add your own tests. |
5600 | </para> | 5597 | </para> |
5601 | 5598 | ||
5602 | <section id="qemu-image-enabling-tests"> | 5599 | <section id='enabling-tests'> |
5603 | <title>Enabling Tests</title> | 5600 | <title>Enabling Tests</title> |
5604 | 5601 | ||
5605 | <para> | 5602 | <para> |
5606 | In order to run tests, you need to do the following: | 5603 | Depending on whether you are planning on running tests using |
5607 | <itemizedlist> | 5604 | QEMU or on running them on the hardware, you have to take |
5608 | <listitem><para><emphasis>Set up to avoid interaction | 5605 | different steps to enable the tests. |
5609 | with <filename>sudo</filename> for networking:</emphasis> | 5606 | See the following subsections for information on how to |
5610 | To accomplish this, you must do one of the | 5607 | enable both types of tests. |
5611 | following: | ||
5612 | <itemizedlist> | ||
5613 | <listitem><para>Add | ||
5614 | <filename>NOPASSWD</filename> for your user | ||
5615 | in <filename>/etc/sudoers</filename> either for | ||
5616 | ALL commands or just for | ||
5617 | <filename>runqemu-ifup</filename>. | ||
5618 | You must provide the full path as that can | ||
5619 | change if you are using multiple clones of the | ||
5620 | source repository. | ||
5621 | <note> | ||
5622 | On some distributions, you also need to | ||
5623 | comment out "Defaults requiretty" in | ||
5624 | <filename>/etc/sudoers</filename>. | ||
5625 | </note></para></listitem> | ||
5626 | <listitem><para>Manually configure a tap interface | ||
5627 | for your system.</para></listitem> | ||
5628 | <listitem><para>Run as root the script in | ||
5629 | <filename>scripts/runqemu-gen-tapdevs</filename>, | ||
5630 | which should generate a list of tap devices. | ||
5631 | This is the option typically chosen for | ||
5632 | Autobuilder-type environments. | ||
5633 | </para></listitem> | ||
5634 | </itemizedlist></para></listitem> | ||
5635 | <listitem><para><emphasis>Set the | ||
5636 | <filename>DISPLAY</filename> variable:</emphasis> | ||
5637 | You need to set this variable so that you have an X | ||
5638 | server available (e.g. start | ||
5639 | <filename>vncserver</filename> for a headless machine). | ||
5640 | </para></listitem> | ||
5641 | <listitem><para><emphasis>Be sure your host's firewall | ||
5642 | accepts incoming connections from | ||
5643 | 192.168.7.0/24:</emphasis> | ||
5644 | Some of the tests (in particular smart tests) start an | ||
5645 | HTTP server on a random high number port, which is | ||
5646 | used to serve files to the target. | ||
5647 | The smart module serves | ||
5648 | <filename>${DEPLOY_DIR}/rpm</filename> so it can run | ||
5649 | smart channel commands. That means your host's firewall | ||
5650 | must accept incoming connections from 192.168.7.0/24, | ||
5651 | which is the default IP range used for tap devices | ||
5652 | by <filename>runqemu</filename>.</para></listitem> | ||
5653 | </itemizedlist> | ||
5654 | </para> | 5608 | </para> |
5655 | 5609 | ||
5656 | <note> | 5610 | <section id='qemu-image-enabling-tests'> |
5657 | Regardless of how you initiate the tests, if you built your | 5611 | <title>QEMU</title> |
5658 | image using <filename>rm_work</filename>, | 5612 | |
5659 | most of the tests will fail with errors because they rely on | 5613 | <para> |
5660 | <filename>${WORKDIR}/installed_pkgs.txt</filename>. | 5614 | In order to run tests, you need to do the following: |
5661 | </note> | 5615 | <itemizedlist> |
5616 | <listitem><para><emphasis>Set up to avoid interaction | ||
5617 | with <filename>sudo</filename> for networking:</emphasis> | ||
5618 | To accomplish this, you must do one of the | ||
5619 | following: | ||
5620 | <itemizedlist> | ||
5621 | <listitem><para>Add | ||
5622 | <filename>NOPASSWD</filename> for your user | ||
5623 | in <filename>/etc/sudoers</filename> either for | ||
5624 | ALL commands or just for | ||
5625 | <filename>runqemu-ifup</filename>. | ||
5626 | You must provide the full path as that can | ||
5627 | change if you are using multiple clones of the | ||
5628 | source repository. | ||
5629 | <note> | ||
5630 | On some distributions, you also need to | ||
5631 | comment out "Defaults requiretty" in | ||
5632 | <filename>/etc/sudoers</filename>. | ||
5633 | </note></para></listitem> | ||
5634 | <listitem><para>Manually configure a tap interface | ||
5635 | for your system.</para></listitem> | ||
5636 | <listitem><para>Run as root the script in | ||
5637 | <filename>scripts/runqemu-gen-tapdevs</filename>, | ||
5638 | which should generate a list of tap devices. | ||
5639 | This is the option typically chosen for | ||
5640 | Autobuilder-type environments. | ||
5641 | </para></listitem> | ||
5642 | </itemizedlist></para></listitem> | ||
5643 | <listitem><para><emphasis>Set the | ||
5644 | <filename>DISPLAY</filename> variable:</emphasis> | ||
5645 | You need to set this variable so that you have an X | ||
5646 | server available (e.g. start | ||
5647 | <filename>vncserver</filename> for a headless machine). | ||
5648 | </para></listitem> | ||
5649 | <listitem><para><emphasis>Be sure your host's firewall | ||
5650 | accepts incoming connections from | ||
5651 | 192.168.7.0/24:</emphasis> | ||
5652 | Some of the tests (in particular smart tests) start an | ||
5653 | HTTP server on a random high number port, which is | ||
5654 | used to serve files to the target. | ||
5655 | The smart module serves | ||
5656 | <filename>${DEPLOY_DIR}/rpm</filename> so it can run | ||
5657 | smart channel commands. That means your host's firewall | ||
5658 | must accept incoming connections from 192.168.7.0/24, | ||
5659 | which is the default IP range used for tap devices | ||
5660 | by <filename>runqemu</filename>.</para></listitem> | ||
5661 | </itemizedlist> | ||
5662 | </para> | ||
5663 | |||
5664 | <note> | ||
5665 | Regardless of how you initiate the tests, if you built your | ||
5666 | image using <filename>rm_work</filename>, | ||
5667 | most of the tests will fail with errors because they rely on | ||
5668 | <filename>${WORKDIR}/installed_pkgs.txt</filename>. | ||
5669 | </note> | ||
5670 | </section> | ||
5671 | |||
5672 | <section id='hardware-image-enabling-tests'> | ||
5673 | <title>Hardware</title> | ||
5674 | |||
5675 | <para> | ||
5676 | This section needs the information specific to enabling | ||
5677 | tests to run on actual hardware. | ||
5678 | Here are some developer notes: | ||
5679 | <itemizedlist> | ||
5680 | <listitem><para> | ||
5681 | Paul says this "If you have deployed the image yourself, | ||
5682 | you can manually boot it, you know the IP address | ||
5683 | it will show up under, and SSH is installed with no | ||
5684 | password, then you can now run tests on any real | ||
5685 | machine." | ||
5686 | </para></listitem> | ||
5687 | <listitem><para> | ||
5688 | <filename>TEST_TARGET</filename> variable needs to equal | ||
5689 | "simpleremote" | ||
5690 | </para></listitem> | ||
5691 | <listitem><para> | ||
5692 | Here are some notes from the patch - "The remote machine | ||
5693 | must be up with network and ssh and you need to set | ||
5694 | <filename>TEST_TARGET_IP</filename> with the IP address | ||
5695 | of the remote machine (it can still be a qemu instance that | ||
5696 | was manually started) | ||
5697 | </para></listitem> | ||
5698 | </itemizedlist> | ||
5699 | </para> | ||
5700 | </section> | ||
5662 | </section> | 5701 | </section> |
5663 | 5702 | ||
5664 | <section id="qemu-image-running-tests"> | 5703 | <section id="qemu-image-running-tests"> |
@@ -5678,6 +5717,18 @@ | |||
5678 | <literallayout class='monospaced'> | 5717 | <literallayout class='monospaced'> |
5679 | TEST_IMAGE = "1" | 5718 | TEST_IMAGE = "1" |
5680 | </literallayout> | 5719 | </literallayout> |
5720 | Next, also in the <filename>local.conf</filename>, set the | ||
5721 | <filename>TEST_TARGET</filename> variable to | ||
5722 | "simpleremote" if you want to run tests on real hardware or | ||
5723 | set it to "qemu" if you want to run tests using QEMU. | ||
5724 | file: | ||
5725 | <literallayout class='monospaced'> | ||
5726 | TEST_TARGET = "simpleremote" | ||
5727 | </literallayout> | ||
5728 | or | ||
5729 | <literallayout class='monospaced'> | ||
5730 | TEST_TARGET = "qemu" | ||
5731 | </literallayout> | ||
5681 | Next, build your image. | 5732 | Next, build your image. |
5682 | If the image successfully builds, the tests will be | 5733 | If the image successfully builds, the tests will be |
5683 | run: | 5734 | run: |