Skip to contentSkip to conversation

selftest/devtool: make 'git status' list all files separately

PATCH In review Gyorgy Sarvari 2 participants 2 messages Sep 16, 2025

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 selftest/devtool: make 'git status' list all files separately

By default, when running "git status", and git finds an untracked folder with some files in it, it lists only the folder, without the file content. In case the folder is already tracked, then the new/modified files inside the folder are displayed separately.

Some tests rely on listing all the files separately to be able to determine the outcome of the test. As an example, test_devtool_git_submodules creates a patch that's stored in the meta layer. It verifies from git status that the patch is present in the layer. However, when using the default "git status" behavior, to be able to see the file listed, its parent folder must be tracked by git already, otherwise only the folder is listed.

Specifically vulkan-samples recipe is used for one devtools test, which verifies patch creation in the layer, however an update[1] to the recipe removed all the patches and the folder that stored them (as they became unneeded), which in turn broke this test, because the test coulnd't find the newly created filename in git status output, because it was stored in the folder that became untracked after the recipe update.

To avoid this problem, add "--untracked-files=all" argument to the git status request, which displays all untracked files, regardless of their parent folder's tracking-status.

[1]: https://lists.openembedded.org/g/openembedded-core/message/223296

---

v2: Commit message updated, no code change.
v1: https://lists.openembedded.org/g/openembedded-core/message/223346

 meta/lib/oeqa/selftest/cases/devtool.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oeqa/selftest/cases/devtool.py +1 -1
index 19a205912b..a59d9e123a 100644
@@ -122,7 +122,7 @@ class DevtoolTestCase(OESelftestTestCase):
 
     def _check_repo_status(self, repo_dir, expected_status):
         """Check the worktree status of a repository"""
-        result = runCmd('git status . --porcelain',
+        result = runCmd('git status . --porcelain  --untracked-files=all',
                         cwd=repo_dir)
         for line in result.output.splitlines():
             for ind, (f_status, fn_re) in enumerate(expected_status):
#1 lore raw
Quoted 17 lines · Gyorgy Sarvari via lists.openembedded.org

By default, when running "git status", and git finds an untracked folder with some files in it, it lists only the folder, without the file content. In case the folder is already tracked, then the new/modified files inside the folder are displayed separately.

Some tests rely on listing all the files separately to be able to determine the outcome of the test. As an example, test_devtool_git_submodules creates a patch that's stored in the meta layer. It verifies from git status that the patch is present in the layer. However, when using the default "git status" behavior, to be able to see the file listed, its parent folder must be tracked by git already, otherwise only the folder is listed.

Specifically vulkan-samples recipe is used for one devtools test, which verifies patch creation in the layer, however an update[1] to the recipe removed all the patches and the folder that stored them (as they became unneeded), which in turn broke this test, because the test coulnd't find the newly created filename in git status output, because it was stored in the folder that became untracked after the recipe update.

Quoted 7 lines

To avoid this problem, add "--untracked-files=all" argument to the git status request, which displays all untracked files, regardless of their parent folder's tracking-status.

[1]: https://lists.openembedded.org/g/openembedded-core/message/223296

---

Hi Gyorgy,

Thanks for your patch.

It looks like this is breaking some selftest. I used v1 of the patch, but I believe the code is the same.

2025-09-16 12:37:31,459 - oe-selftest - INFO - devtool.DevtoolUpdateTests.test_devtool_finish_modify_git_subdir (subunit.RemotedTestCase)
2025-09-16 12:37:31,460 - oe-selftest - INFO -  ... FAIL
...
2025-09-16 12:37:31,460 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/meta/lib/oeqa/selftest/cases/devtool.py", line 1657, in test_devtool_finish_modify_git_subdir
    self._check_repo_status(os.path.dirname(recipefile), expected_status)
  File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/meta/lib/oeqa/selftest/cases/devtool.py", line 135, in _check_repo_status
    self.fail('Unexpected modified file in line: %s' % line)
  File "/usr/lib/python3.11/unittest/case.py", line 703, in fail
    raise self.failureException(msg)

AssertionError: Unexpected modified file in line: ?? meta/recipes-support/dos2unix/dos2unix/0001-Add-a-comment.patch

https://autobuilder.yoctoproject.org/valkyrie/#/builders/35/builds/2337

Can you have a look at this, please?

Thanks,
Mathieu

Signature · 3 lines
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com