All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 7/9] recipetests: buildrecipe: Test suite for recipe tests
Date: Fri, 26 Feb 2016 16:40:49 +0200	[thread overview]
Message-ID: <1456497651-23161-7-git-send-email-daniel.alexandrux.istrate@intel.com> (raw)
In-Reply-To: <1456497651-23161-1-git-send-email-daniel.alexandrux.istrate@intel.com>

Includes tests for:
1. test build recipe for all major architectures
2. test rebuild recipe from sstate 1 (with sstate)
3. test_rebuild_recipe_from_sstate_2 (without sstate)
4. test cleaning operations on recipe
5. test force major tasks on recipe

fix for [YOCTO #6370]

Signed-off-by: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
---
 meta/lib/oeqa/recipetests/buildrecipe.py | 62 ++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 meta/lib/oeqa/recipetests/buildrecipe.py

diff --git a/meta/lib/oeqa/recipetests/buildrecipe.py b/meta/lib/oeqa/recipetests/buildrecipe.py
new file mode 100644
index 0000000..c303b29
--- /dev/null
+++ b/meta/lib/oeqa/recipetests/buildrecipe.py
@@ -0,0 +1,62 @@
+from oeqa.recipetests.base import RecipeTests
+from oeqa.selftest.base import get_available_machines
+from oeqa.utils.commands import bitbake, get_tasks_for_recipe
+import logging
+
+
+class BuildRecipeTests(RecipeTests):
+
+    log = logging.getLogger('test-recipe.build-recipe')
+
+    def test_build_recipe_for_all_major_architectures(self):
+        """ Build the recipe with all major architectures(qemux86, qemux86-64, qemuarm, qemuppc, qemumips) """
+
+        machines = get_available_machines()
+        qemu_machines = [m for m in machines if 'qemu' in m]
+
+        # Build the recipe for all major architectures
+        for m in qemu_machines:
+            self.log.info('Building recipe "%s" for architecture "%s"' % (self.testrecipe, m))
+            self.write_config('MACHINE = "%s"' % m)
+            bitbake(self.testrecipe)
+
+    def test_rebuild_recipe_from_sstate_1(self):
+        """ Rebuild the recipe from sstate with sstate file for the recipe """
+        bitbake(self.testrecipe)
+        bitbake('-c clean %s' % self.testrecipe)
+        bitbake(self.testrecipe)
+
+    def test_rebuild_recipe_from_sstate_2(self):
+        """ Rebuild the recipe from sstate without sstate file for the recipe """
+        bitbake(self.testrecipe)
+        bitbake('-c cleansstate %s' % self.testrecipe)
+        bitbake(self.testrecipe)
+
+    def test_cleaning_operations_on_recipe(self):
+        """ Perform cleaning operations on the recipe(cleansstate, clean, cleanall) """
+
+        clean_tasks = ['cleansstate', 'clean', 'cleanall']
+
+        for task in clean_tasks:
+            bitbake(self.testrecipe)
+            self.log.info('Performing %s for recipe %s' % (task, self.testrecipe))
+            bitbake('-c %s %s' % (task, self.testrecipe))
+
+    def test_force_major_tasks_on_recipe(self):
+        """ Force all major tasks on the recipe (bitbake -C <task> <recipe>) """
+        major_tasks = ['unpack', 'patch', 'configure', 'compile', 'install', 'populate_sysroot', 'package',
+                       'package_write_rpm', 'package_write_deb', 'package_write_ipk']
+
+        feature = 'PACKAGE_CLASSES = "package_rpm package_deb package_ipk"\n'
+        self.write_config(feature)
+
+        available_tasks = get_tasks_for_recipe(self.testrecipe)
+
+        for task in major_tasks:
+            # Check if task is available for recipe
+            if task not in available_tasks:
+                self.log.warning('Task %s not available for recipe %s' % (task, self.testrecipe))
+                continue
+            # Force task on recipe
+            self.log.info('Forcing task %s' % task)
+            bitbake('-C %s %s' % (task, self.testrecipe))
-- 
2.1.0



  parent reply	other threads:[~2016-02-26 14:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-26 14:40 [PATCH 1/9] selftest: Moved method from oe-selftest to oeqa/runner.py Daniel Istrate
2016-02-26 14:40 ` [PATCH 2/9] selftest: Moved coverage functionality " Daniel Istrate
2016-02-26 14:40 ` [PATCH 3/9] selftest: Moved list_classes, list_modules, run methods to runner.py Daniel Istrate
2016-02-26 14:40 ` [PATCH 4/9] oeqa/utils/commands: Added 3 new methods for recipes Daniel Istrate
2016-02-26 14:40 ` [PATCH 5/9] scripts: test-recipe Tool for running tests on recipes Daniel Istrate
2016-02-26 14:40 ` [PATCH 6/9] recipetests: base - Base Class for Test Recipes Daniel Istrate
2016-02-26 14:40 ` Daniel Istrate [this message]
2016-02-26 14:40 ` [PATCH 8/9] oeqa/utils/commands: Added method - get_all_bbappends Daniel Istrate
2016-02-26 14:40 ` [PATCH 9/9] recipetests: buildrecipe: Test combinations of bbappend Daniel Istrate

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1456497651-23161-7-git-send-email-daniel.alexandrux.istrate@intel.com \
    --to=daniel.alexandrux.istrate@intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.