All of lore.kernel.org
 help / color / mirror / Atom feed
From: Romain Naour <romain.naour@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 7/7] support/testing: check if the defconfig provided for testing is valid
Date: Mon,  6 Apr 2020 01:04:14 +0200	[thread overview]
Message-ID: <20200405230414.416403-7-romain.naour@gmail.com> (raw)
In-Reply-To: <20200405230414.416403-1-romain.naour@gmail.com>

Currently, the build continue even if some symbols disapear from
the generated dot config file (.config).

This patch add a new check in order to stop the test if one
of the provided symbol is missing. This must be treated as error.

For example, if a symbol disapear due to new dependency constraints.

Inspired by is_toolchain_usable() function from genrandconfig:
https://git.busybox.net/buildroot/tree/utils/genrandconfig?h=2020.02#n164

Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
 support/testing/infra/builder.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/support/testing/infra/builder.py b/support/testing/infra/builder.py
index 88f01d15c0..922a707220 100644
--- a/support/testing/infra/builder.py
+++ b/support/testing/infra/builder.py
@@ -12,6 +12,23 @@ class Builder(object):
         self.builddir = builddir
         self.logfile = infra.open_log_file(builddir, "build", logtofile)
 
+    def is_defconfig_valid(self, configfile, defconfig):
+        """Check if the .config is contains all lines present in the defconfig."""
+        with open(configfile) as configf:
+            configlines = configf.readlines()
+
+        defconfiglines = defconfig.split("\n")
+
+        # Check that all the defconfig lines are still present
+        for defconfigline in defconfiglines:
+            if defconfigline + "\n" not in configlines:
+                self.logfile.write("WARN: defconfig can't be used\n")
+                self.logfile.write("      Missing: %s\n" % defconfigline.strip())
+                self.logfile.flush()
+                return False
+
+        return True
+
     def configure(self, make_extra_opts=[], make_extra_env={}):
         """Configure the build.
 
@@ -47,6 +64,9 @@ class Builder(object):
         if ret != 0:
             raise SystemError("Cannot olddefconfig")
 
+        if not self.is_defconfig_valid(config_file, self.config):
+            raise SystemError("The defconfig is not valid")
+
     def build(self, make_extra_opts=[], make_extra_env={}):
         """Perform the build.
 
-- 
2.25.1

  parent reply	other threads:[~2020-04-05 23:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-05 23:04 [Buildroot] [PATCH 1/7] support/testing: test_syslinux: fix flake8 errors Romain Naour
2020-04-05 23:04 ` [Buildroot] [PATCH 2/7] support/testing: test_syslinux: remove BR2_TOOLCHAIN_EXTERNAL_LOCALE Romain Naour
2020-04-05 23:04 ` [Buildroot] [PATCH 3/7] support/testing: test_glxinfo: " Romain Naour
2020-04-05 23:04 ` [Buildroot] [PATCH 4/7] support/testing: test_tmux: remove BR2_GENERATE_LOCALE Romain Naour
2020-04-05 23:04 ` [Buildroot] [PATCH 5/7] support/testing: test_lxc: use ARM arm external toolchain Romain Naour
2020-04-05 23:04 ` [Buildroot] [PATCH 6/7] support/testing: don't use TestPythonPackageBase.config and linaro toolchain Romain Naour
2020-04-06 20:19   ` Thomas Petazzoni
2020-04-05 23:04 ` Romain Naour [this message]
2020-04-06 20:17 ` [Buildroot] [PATCH 1/7] support/testing: test_syslinux: fix flake8 errors Thomas Petazzoni

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=20200405230414.416403-7-romain.naour@gmail.com \
    --to=romain.naour@gmail.com \
    --cc=buildroot@busybox.net \
    /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.