* [PATCH 1/2] kconfig: add merge_into_defconfig_named to set CONFIG_NAME
@ 2026-02-16 8:39 Ahmad Fatoum
2026-02-16 8:39 ` [PATCH 2/2] test: report used Labgrid environment and build dir Ahmad Fatoum
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2026-02-16 8:39 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum, Claude Opus 4.6
Generated defconfigs that merge fragments into a base config inherit
CONFIG_NAME from the base, which is wrong for testing: pytest uses
CONFIG_NAME to locate the matching Labgrid environment YAML.
Add merge_into_defconfig_named, which appends the correct CONFIG_NAME
to .config before running olddefconfig, and switch all callers over.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Makefile | 4 ++--
arch/arm/Makefile | 4 ++--
arch/mips/Makefile | 6 +++---
arch/riscv/Makefile | 4 ++--
arch/sandbox/Makefile | 10 +++++-----
scripts/Makefile.defconf | 13 +++++++++++++
6 files changed, 27 insertions(+), 14 deletions(-)
diff --git a/Makefile b/Makefile
index 4296c97ef02d..7f31e79439fd 100644
--- a/Makefile
+++ b/Makefile
@@ -618,9 +618,9 @@ export KBUILD_DEFCONFIG CC_VERSION_TEXT
endif
%_efiloader_defconfig: FORCE
- $(call merge_into_defconfig,$*_defconfig,efi-loader)
+ $(call merge_into_defconfig_named,$*_defconfig,efi-loader,$@)
%_efi_defconfig: FORCE
- $(call merge_into_defconfig,$*_defconfig,efi-loader efi-payload)
+ $(call merge_into_defconfig_named,$*_defconfig,efi-loader efi-payload,$@)
config: outputmakefile scripts_basic FORCE
$(Q)$(MAKE) $(build)=scripts/kconfig KCONFIG_DEFCONFIG_LIST= $@
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index b38f694339a4..3455b2a79f75 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -4,9 +4,9 @@ KBUILD_DEFCONFIG := multi_v8_defconfig
generated_configs += am335x_mlo_sdmmc_defconfig am335x_mlo_rawflash_defconfig
am335x_mlo_sdmmc_defconfig:
- $(call merge_into_defconfig,am335x_mlo_defconfig,nomtd)
+ $(call merge_into_defconfig_named,am335x_mlo_defconfig,nomtd,$@)
am335x_mlo_rawflash_defconfig:
- $(call merge_into_defconfig,am335x_mlo_defconfig,nomci)
+ $(call merge_into_defconfig_named,am335x_mlo_defconfig,nomci,$@)
# Generic rule applying the fragment is in top-level Makefile
generated_configs += $(patsubst %_defconfig,%_efiloader_defconfig, \
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 67d355e0ad81..8001bb54bed5 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -4,11 +4,11 @@ KBUILD_DEFCONFIG := qemu-malta_defconfig
generated_configs += $(patsubst %, qemu-malta%_defconfig, el 64 64el)
qemu-maltael_defconfig:
- $(call merge_into_defconfig,qemu-malta_defconfig,le)
+ $(call merge_into_defconfig_named,qemu-malta_defconfig,le,$@)
qemu-malta64_defconfig:
- $(call merge_into_defconfig,qemu-malta_defconfig,mips64)
+ $(call merge_into_defconfig_named,qemu-malta_defconfig,mips64,$@)
qemu-malta64el_defconfig:
- $(call merge_into_defconfig,qemu-malta_defconfig,mips64 le)
+ $(call merge_into_defconfig_named,qemu-malta_defconfig,mips64 le,$@)
#
# Select the object file format to substitute into the linker script.
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index c7682d4bd003..d22a0368a33c 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -5,9 +5,9 @@ KBUILD_DEFCONFIG := rv64i_defconfig
generated_configs += virt32_mmu_defconfig rv64i_mmu_defconfig
virt32_mmu_defconfig:
- $(call merge_into_defconfig,virt32_defconfig,enable_mmu)
+ $(call merge_into_defconfig_named,virt32_defconfig,enable_mmu,$@)
rv64i_mmu_defconfig:
- $(call merge_into_defconfig,rv64i_defconfig,enable_mmu)
+ $(call merge_into_defconfig_named,rv64i_defconfig,enable_mmu,$@)
KBUILD_CPPFLAGS += -fno-strict-aliasing
diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
index 1b1774cc4b0a..27c3a591e2d9 100644
--- a/arch/sandbox/Makefile
+++ b/arch/sandbox/Makefile
@@ -5,15 +5,15 @@ KBUILD_DEFCONFIG := sandbox_defconfig
generated_configs += headless_defconfig noshell_defconfig lockdown_defconfig \
simpleconsole_defconfig libfuzzer_defconfig
headless_defconfig:
- $(call merge_into_defconfig,sandbox_defconfig,headless)
+ $(call merge_into_defconfig_named,sandbox_defconfig,headless,$@)
noshell_defconfig:
- $(call merge_into_defconfig,sandbox_defconfig,noshell)
+ $(call merge_into_defconfig_named,sandbox_defconfig,noshell,$@)
lockdown_defconfig:
- $(call merge_into_defconfig,sandbox_defconfig,headless noshell)
+ $(call merge_into_defconfig_named,sandbox_defconfig,headless noshell,$@)
simpleconsole_defconfig:
- $(call merge_into_defconfig,sandbox_defconfig,simpleconsole)
+ $(call merge_into_defconfig_named,sandbox_defconfig,simpleconsole,$@)
libfuzzer_defconfig:
- $(call merge_into_defconfig,sandbox_defconfig,libfuzzer)
+ $(call merge_into_defconfig_named,sandbox_defconfig,libfuzzer,$@)
KBUILD_CPPFLAGS += -D__SANDBOX__ -fno-strict-aliasing -fvisibility=hidden
diff --git a/scripts/Makefile.defconf b/scripts/Makefile.defconf
index 93c848bb5a12..75a39cf333a5 100644
--- a/scripts/Makefile.defconf
+++ b/scripts/Makefile.defconf
@@ -35,3 +35,16 @@ define merge_into_defconfig_override
))
+$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
endef
+
+
+# Creates 'merged defconfigs' and sets CONFIG_NAME to the config name
+# ---------------------------------------------------------------------------
+# Usage:
+# $(call merge_into_defconfig_named,base_config,config_fragment1 config_fragment2 ...,config_name)
+#
+# Input config fragments without '.config' suffix
+define merge_into_defconfig_named
+ $(call merge_into_defconfig_override,$1,$2)
+ $(Q)echo 'CONFIG_NAME="$3"' >> $(objtree)/.config
+ +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
+endef
--
2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 2/2] test: report used Labgrid environment and build dir
2026-02-16 8:39 [PATCH 1/2] kconfig: add merge_into_defconfig_named to set CONFIG_NAME Ahmad Fatoum
@ 2026-02-16 8:39 ` Ahmad Fatoum
0 siblings, 0 replies; 2+ messages in thread
From: Ahmad Fatoum @ 2026-02-16 8:39 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
We have custom logic for populating LG_ENV and LG_BUILDDIR if they
are not set. Let's print out this information at start to help avoid
surprises.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
conftest.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/conftest.py b/conftest.py
index 40c93d2f0473..8c76f8ddf3cf 100644
--- a/conftest.py
+++ b/conftest.py
@@ -76,6 +76,9 @@ def guess_lg_env():
return None
+lg_env = lg_builddir = None
+
+
def pytest_configure(config):
if 'LG_BUILDDIR' not in os.environ:
if 'KBUILD_OUTPUT' in os.environ:
@@ -88,6 +91,10 @@ def pytest_configure(config):
if os.environ['LG_BUILDDIR'] is not None:
os.environ['LG_BUILDDIR'] = os.path.realpath(os.environ['LG_BUILDDIR'])
+ global lg_env
+ global lg_builddir
+
+ lg_builddir = os.environ['LG_BUILDDIR']
lg_env = config.option.lg_env
if lg_env is None:
lg_env = os.environ.get('LG_ENV')
@@ -96,6 +103,15 @@ def pytest_configure(config):
os.environ['LG_ENV'] = lg_env
+def pytest_report_header(config):
+ report = []
+ if lg_builddir is not None:
+ report += [f"Build diectory: {lg_builddir}"]
+ if lg_env is not None:
+ report += [f"Labgrid Environment: {lg_env}"]
+ return "\n".join(report)
+
+
def pytest_addoption(parser):
def assignment(arg):
return arg.split('=', 1)
--
2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-16 8:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-16 8:39 [PATCH 1/2] kconfig: add merge_into_defconfig_named to set CONFIG_NAME Ahmad Fatoum
2026-02-16 8:39 ` [PATCH 2/2] test: report used Labgrid environment and build dir Ahmad Fatoum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox