[PATCH 1/1] test: Skip cleanup test if not built out of tree

Tobias Deiminger tdmg at linutronix.de
Mon Jan 8 22:11:00 CET 2024


42c0e5bb054d ("test: Find leftovers after clean/mrproper") assumes out
of tree builds. test_clean and test_mrproper fail if the assumption
isn't met.

However there are valid scenarios where tests run with in source builds
(i.e., test.py --build-dir=.).

Automatically skip cleanup tests in such scenarios to prevent false
positives.

Signed-off-by: Tobias Deiminger <tdmg at linutronix.de>
---
 test/py/tests/test_cleanup_build.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/test/py/tests/test_cleanup_build.py b/test/py/tests/test_cleanup_build.py
index 5206ff73ec..aca90cb110 100644
--- a/test/py/tests/test_cleanup_build.py
+++ b/test/py/tests/test_cleanup_build.py
@@ -17,6 +17,11 @@ import pytest
 @pytest.fixture
 def tmp_copy_of_builddir(u_boot_config, tmp_path):
     """For each test, provide a temporary copy of the initial build directory."""
+    if os.path.realpath(u_boot_config.source_dir) == os.path.realpath(
+        u_boot_config.build_dir
+    ):
+        pytest.skip("Leftover detection requires out of tree build.")
+        return None
     shutil.copytree(
         u_boot_config.build_dir,
         tmp_path,
-- 
2.30.2



More information about the U-Boot mailing list