summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/selftest.py
blob: af080dcf0349199a371a4ff52c9abc76f4de72a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#
# SPDX-License-Identifier: MIT
#

import importlib
from oeqa.utils.commands import runCmd
import oeqa.selftest
from oeqa.selftest.case import OESelftestTestCase

class ExternalLayer(OESelftestTestCase):

    def test_list_imported(self):
        """
        Summary: Checks functionality to import tests from other layers.
        Expected: 1. File "external-layer.py" must be in
        oeqa.selftest.__path__
                  2. test_unconditional_pas method must exists
                     in ImportedTests class
        Product: oe-core
        Author: Mariano Lopez <mariano.lopez@intel.com>
        """

        test_file = "external-layer.py"
        test_module = "oeqa.selftest.cases.external-layer"
        method_name = "test_unconditional_pass"

        # Check if "external-layer.py" is in oeqa path
        found_file = search_test_file(test_file)
        self.assertTrue(found_file, msg="Can't find %s in the oeqa path" % test_file)

        # Import oeqa.selftest.external-layer module and search for
        # test_unconditional_pass method of ImportedTests class
        found_method = search_method(test_module, method_name)
        self.assertTrue(method_name, msg="Can't find %s method" % method_name)

def search_test_file(file_name):
    for layer_path in oeqa.selftest.__path__:
        for _, _, files in os.walk(layer_path):
            for f in files:
                if f == file_name:
                    return True
    return False

def search_method(module, method):
    modlib = importlib.import_module(module)
    for var in vars(modlib):
        klass = vars(modlib)[var]
        if isinstance(klass, type(OESelftestTestCase)) and issubclass(klass, OESelftestTestCase):
            for m in dir(klass):
                if m == method:
                    return True
    return False
started Toaster and then to initiate your build using the <filename>bitbake</filename> command from the shell. Toaster must be started before the build or it will not collect build data.</para> <para>Toaster has the following capabilities in Analysis Mode: <itemizedlist> <listitem><para> See what was built (recipes and packages) and what packages were installed into your final image. </para></listitem> <listitem><para> Browse the directory structure of your image. </para></listitem> <listitem><para> See the value of all variables in your build configuration, and which files set each value. </para></listitem> <listitem><para> Examine error, warning and trace messages to aid in debugging. </para></listitem> <listitem><para> See information about the BitBake tasks executed and reused during your build, including those that used shared state. </para></listitem> <listitem><para> See dependency relationships between recipes, packages and tasks </para></listitem> <listitem><para> See performance information such as build time, task time, CPU usage, and disk I/O. </para></listitem> </itemizedlist> </para></listitem> <listitem><para><emphasis>Build Mode:</emphasis> In Build Mode, Toaster handles the build configuration, scheduling and execution. In this mode, all your interaction with the build system happens through the web interface. You do not have direct access to the <filename>bitbake</filename> command.</para> <para>Using this mode, you configure and start your builds within Toaster's GUI. Each project can be configured for a specific version of the build system. As shipped, Toaster supports Yocto Project Releases 1.7 and beyond.</para> <para>Toaster has all the same capabilities in Build Mode as it does in Analysis Mode plus the following: <itemizedlist> <listitem><para> Browse layers listed in the various <link linkend='layer-source'>layer sources</link> that are available in your project (e.g. the OpenEmbedded Metadata Index at <ulink url='http://layers.openembedded.org/layerindex/'></ulink>). </para></listitem> <listitem><para> Import your own layers for building. </para></listitem> <listitem><para> Add and remove layers from your configuration. </para></listitem> <listitem><para> Set configuration variables. </para></listitem> <listitem><para> Select a target or multiple targets to build. </para></listitem> <listitem><para> Start your builds. </para></listitem> </itemizedlist> </para></listitem> </itemizedlist> </para> </section> <section id='toaster-installation-options'> <title>Installation Options</title> <para> You can set Toaster up to run as a local instance or as a shared hosted service. Regardless of how you set up Toaster, both Analysis and Build Modes are available. </para> <para> When Toaster is set up as a local instance, all the components reside on a single build host. Fundamentally, a local instance of Toaster is suited for a single user developing on a single build host. </para> <para> <imagedata fileref="figures/simple-configuration.png" align="center" width="6in" depth="1.5in" /> </para> <para> Toaster as a hosted service is suited for multiple users developing across several build hosts. When Toaster is set up as a hosted service, its components can be spread across several machines: </para> <para> <imagedata fileref="figures/hosted-service.png" align="center" width="6in" depth="3.5in" /> </para> </section> <!--THIS EXTRA INFORMATION PROBABLY WILL GO AWAY For additional information on installing and running Toaster, see the "<ulink url='https://wiki.yoctoproject.org/wiki/Toaster#Installation_and_Running'>Installation and Running</ulink>" section of the "Toaster" wiki page. For complete information on the API and its search operation URI, parameters, and responses, see the <ulink url='https://wiki.yoctoproject.org/wiki/REST_API_Contracts'>REST API Contracts</ulink> Wiki page. </para> --> </chapter>