Skip to contentSkip to conversation

Skip cleanup test if not built out of tree

PATCH In review Tobias Deiminger 4 participants 5 messages Jan 8, 2024 – Jan 19, 2024

lore
Share & tools
lore
#0 lore raw

cover Skip cleanup test if not built out of tree

This patch avoids false positives in cases where tests are invoked with test.py --build-dir=./ .

See tbot issue 107 [1] for motivation and prior discussion.

Previously it resulted in:
E AssertionError: leftovers: net/mdio-uclass.c, net/bootp.c, [...]

Now it results in:
SKIPPED [2] test/py/tests/test_cleanup_build.py:23: Leftover detection requires out of tree build.

[1] https://github.com/Rahix/tbot/issues/107#issuecomment-1880192186

Tobias Deiminger (1):
test: Skip cleanup test if not built out of tree

 test/py/tests/test_cleanup_build.py | 5 +++++
 1 file changed, 5 insertions(+)

base-commit: 93d91e9485d902a1836a22e72d1a545b587adf36

Signature · 1 line
2.30.2
#1 lore raw

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

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.

---
 test/py/tests/test_cleanup_build.py | 5 +++++
 1 file changed, 5 insertions(+)
test/py/tests/test_cleanup_build.py +5 -0
index 5206ff73ec..aca90cb110 100644
@@ -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,
Signature · 1 line
2.30.2
Reviewed-by Harald Seiler on v1 1/1
#2 lore raw

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

Quoted 11 lines · Tobias Deiminger

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.

Quoted 20 lines

---
 test/py/tests/test_cleanup_build.py | 5 +++++

 1 file changed, 5 insertions(+)
test/py/tests/test_cleanup_build.py +0 -0
index 5206ff73ec..aca90cb110 100644
@@ -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,

#3 lore raw

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

In reply to Tobias Deiminger
Quoted 4 lines · Tobias Deiminger

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

Quoted 8 lines

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.

Applied to u-boot/master, thanks!

Signature · 1 line
Tom
#4 lore raw
In reply to Tobias Deiminger
Quoted 5 lines · Tobias Deiminger

This patch avoids false positives in cases where tests are invoked with test.py --build-dir=./ .

See tbot issue 107 [1] for motivation and prior discussion.

Quoted 8 lines

Previously it resulted in:
E AssertionError: leftovers: net/mdio-uclass.c, net/bootp.c, [...]

Now it results in:
SKIPPED [2] test/py/tests/test_cleanup_build.py:23: Leftover detection requires out of tree build.

[1] https://github.com/Rahix/tbot/issues/107#issuecomment-1880192186

If I may suggest, there's no need for a cover letter for a single patch.
If you want to include some notes in the patch submission, which aren't
supposed to be part of the commit summary, you can do that in the patch itself.

Quoted 8 lines

Tobias Deiminger (1):
test: Skip cleanup test if not built out of tree

 test/py/tests/test_cleanup_build.py | 5 +++++
 1 file changed, 5 insertions(+)

base-commit: 93d91e9485d902a1836a22e72d1a545b587adf36