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 6/9] recipetests: base - Base Class for Test Recipes
Date: Fri, 26 Feb 2016 16:40:48 +0200	[thread overview]
Message-ID: <1456497651-23161-6-git-send-email-daniel.alexandrux.istrate@intel.com> (raw)
In-Reply-To: <1456497651-23161-1-git-send-email-daniel.alexandrux.istrate@intel.com>

Test Recipes should inherit this class.
It sets up a custom tmp dir for the recipe under test.

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

diff --git a/meta/lib/oeqa/recipetests/base.py b/meta/lib/oeqa/recipetests/base.py
new file mode 100644
index 0000000..148c123
--- /dev/null
+++ b/meta/lib/oeqa/recipetests/base.py
@@ -0,0 +1,25 @@
+import os
+import shutil
+from oeqa.selftest.base import oeSelfTest
+import oeqa.utils.ftools as ftools
+
+
+class RecipeTests(oeSelfTest):
+
+    def __init__(self, methodName="runTest"):
+        super(RecipeTests, self).__init__(methodName)
+        self.testinc_path = os.path.join(self.builddir, 'conf/testrecipe.inc')
+        self.required_path = os.path.join(self.builddir, 'conf/required.inc')
+        self.testrecipe = os.getenv("TESTRECIPE")
+
+        # Use a clean TMPDIR for each run
+        tmpdir_name = self.builddir + '/tmp_' + self.testrecipe
+        shutil.rmtree(tmpdir_name, ignore_errors=True)
+
+        feature = 'TMPDIR = "%s"\n' % tmpdir_name
+        self.set_required_config(feature)
+
+    # write to <builddir>/conf/requred.inc
+    def set_required_config(self, data):
+        self.log.debug("Writing to: %s\n%s\n" % (self.required_path, data))
+        ftools.write_file(self.required_path, data)
-- 
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 ` Daniel Istrate [this message]
2016-02-26 14:40 ` [PATCH 7/9] recipetests: buildrecipe: Test suite for recipe tests Daniel Istrate
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-6-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.