u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>,
	Brandon Maier <brandon.maier@collins.com>
Subject: [PATCH 1/9] buildman: Add a lower-level test for KconfigScanner
Date: Fri,  8 Nov 2024 08:23:42 -0700	[thread overview]
Message-ID: <20241108152350.3686274-2-sjg@chromium.org> (raw)
In-Reply-To: <20241108152350.3686274-1-sjg@chromium.org>

This code is tested by test_scan_defconfigs() but it is useful to have
some specific tests for the KconfigScanner's operation in U-Boot. Add
a test which checks that the values are obtained correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/buildman/func_test.py | 51 +++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py
index 0ac9fc7e44f..db3c9d63ec4 100644
--- a/tools/buildman/func_test.py
+++ b/tools/buildman/func_test.py
@@ -1067,3 +1067,54 @@ endif
             result = self._RunControl('--print-arch', 'board0')
         self.assertEqual('arm\n', stdout.getvalue())
         self.assertEqual('', stderr.getvalue())
+
+    def test_kconfig_scanner(self):
+        """Test using the kconfig scanner to determine important values
+
+        Note that there is already a test_scan_defconfigs() which checks the
+        higher-level scan_defconfigs() function. This test checks just the
+        scanner itself
+        """
+        src = self._git_dir
+        scanner = boards.KconfigScanner(src)
+
+        # First do a simple sanity check
+        norm = os.path.join(src, 'board0_defconfig')
+        tools.write_file(norm, 'CONFIG_TARGET_BOARD0=y', False)
+        res = scanner.scan(norm, True)
+        self.assertEqual(({
+            'arch': 'arm',
+            'cpu': 'armv7',
+            'soc': '-',
+            'vendor': 'Tester',
+            'board': 'ARM Board 0',
+            'config': 'config0',
+            'target': 'board0'}, []), res)
+
+        # Check that the SoC cannot be changed and the filename does not affect
+        # the resulting board
+        tools.write_file(norm, '''CONFIG_TARGET_BOARD2=y
+CONFIG_SOC="fred"
+''', False)
+        res = scanner.scan(norm, True)
+        self.assertEqual(({
+            'arch': 'powerpc',
+            'cpu': 'ppc',
+            'soc': 'mpc85xx',
+            'vendor': 'Tester',
+            'board': 'PowerPC board 1',
+            'config': 'config2',
+            'target': 'board0'}, []), res)
+
+        # Check handling of missing information
+        tools.write_file(norm, '', False)
+        res = scanner.scan(norm, True)
+        self.assertEqual(({
+            'arch': '-',
+            'cpu': '-',
+            'soc': '-',
+            'vendor': '-',
+            'board': '-',
+            'config': '-',
+            'target': 'board0'},
+            ['WARNING: board0_defconfig: No TARGET_BOARD0 enabled']), res)
-- 
2.34.1


  reply	other threads:[~2024-11-08 15:24 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-08 15:23 [PATCH 0/9] buildman: Add initial support for config fragments Simon Glass
2024-11-08 15:23 ` Simon Glass [this message]
2024-11-08 15:23 ` [PATCH 2/9] buildman: Set up the tout library Simon Glass
2024-11-08 15:23 ` [PATCH 3/9] buildman: Support #include files in defconfigs Simon Glass
2024-11-13  2:40   ` Tom Rini
2024-11-13 14:39     ` Simon Glass
2024-11-13 21:53       ` Tom Rini
2024-11-15 14:26         ` Simon Glass
2024-11-15 16:12           ` Tom Rini
2024-11-08 15:23 ` [PATCH 4/9] buildman: Correct the indentation in the setting-up section Simon Glass
2024-11-08 15:23 ` [PATCH 5/9] buildman: Document the toolchain-prefix section Simon Glass
2024-11-08 15:23 ` [PATCH 6/9] buildman: Correct logic for adding a toolchain Simon Glass
2024-11-08 15:23 ` [PATCH 7/9] buildman: Support a tilde to represent the home directory Simon Glass
2024-11-08 15:23 ` [PATCH 8/9] buildman: Propose a format for extra boards Simon Glass
2024-11-09 22:55   ` Heinrich Schuchardt
2024-11-13  2:40   ` Tom Rini
2024-11-13 16:03     ` Simon Glass
2024-11-13 22:20       ` Tom Rini
2024-11-15 13:37         ` Simon Glass
2024-11-15 14:44           ` Tom Rini
2024-11-17 19:48             ` Simon Glass
2024-11-17 20:52               ` Tom Rini
2024-11-08 15:23 ` [PATCH 9/9] RFC: Show building with #include in defconfig Simon Glass
2024-11-19 22:12 ` (subset) [PATCH 0/9] buildman: Add initial support for config fragments Tom Rini

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=20241108152350.3686274-2-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=brandon.maier@collins.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).