[OE-core] [PATCH 6/9] recipetests: base - Base Class for Test Recipes
Daniel Istrate
daniel.alexandrux.istrate at intel.com
Fri Feb 26 14:40:48 UTC 2016
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 at 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
More information about the Openembedded-core
mailing list