Skip to contentSkip to conversation

oeqa: Test multiconfig parsing

PATCH New Joshua Watt 1 participant 1 message Sep 23, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 oeqa: Test multiconfig parsing

Add a test to verify that when multiconfig conf files changed, recipes are correctly reparsed.

[YOCTO #13541]

---
 .../multiconfig/multiconfig-test-parse.bb     | 11 +++++
 meta/lib/oeqa/selftest/case.py                | 17 ++++---
 meta/lib/oeqa/selftest/cases/multiconfig.py   | 45 ++++++++++++++-----
 3 files changed, 58 insertions(+), 15 deletions(-)
 create mode 100644 meta-selftest/recipes-test/multiconfig/multiconfig-test-parse.bb
meta-selftest/recipes-test/multiconfig/multiconfig-test-parse.bb new file +11 -0
new file mode 100644
index 00000000000..6236697453f
@@ -0,0 +1,11 @@
+SUMMARY = "Test Multiconfig Parsing"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+do_showvar() {
+    bbplain "MCTESTVAR=${MCTESTVAR}"
+}
+addtask do_showvar
+
meta/lib/oeqa/selftest/case.py +12 -5
index d207a0af0c0..ac3308d8a44 100644
@@ -193,13 +193,20 @@ to ensure accurate results.")
         self.logger.debug("Adding path '%s' to be cleaned up when test is over" % path)
         self._track_for_cleanup.append(path)
 
-    def write_config(self, data):
-        """Write to <builddir>/conf/selftest.inc"""
+    def write_config(self, data, multiconfig=None):
+        """Write to config file"""
+        if multiconfig:
+            multiconfigdir = "%s/conf/multiconfig" % self.builddir
+            os.makedirs(multiconfigdir, exist_ok=True)
+            dest_path = '%s/%s.conf' % (multiconfigdir, multiconfig)
+            self.track_for_cleanup(dest_path)
+        else:
+            dest_path = self.testinc_path
 
-        self.logger.debug("Writing to: %s\n%s\n" % (self.testinc_path, data))
-        ftools.write_file(self.testinc_path, data)
+        self.logger.debug("Writing to: %s\n%s\n" % (dest_path, data))
+        ftools.write_file(dest_path, data)
 
-        if self.tc.custommachine and 'MACHINE' in data:
+        if not multiconfig and self.tc.custommachine and 'MACHINE' in data:
             machine = get_bb_var('MACHINE')
             self.logger.warning('MACHINE overridden: %s' % machine)
 
meta/lib/oeqa/selftest/cases/multiconfig.py +35 -10

71 lines not on this page · raw message

Signature · 1 line
2.21.0