You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix race in test_lookup_path[config-cppcheck.cfg] - #9074
test_lookup_path[config-cppcheck.cfg] writes cppcheck.cfg next to the shared cppcheck executable and removes it after the run. Since test/cli runs with -n auto, tests running in parallel can see that file. In https://github.com/cppcheck-opensource/cppcheck/actions/runs/45492568404/job/138794456108helloworld_test.py::test_addon_absolute_path found the file, but it was removed before it could be opened, so it failed with could not load cppcheck.cfg - could not open file.
test_lookup_path[config-cppcheck.cfg] fails on both Windows release jobs (windows-2022 and windows-2025). The failure looks deterministic, not flaky:
expected: looking for '<tmpdir>/bin/cppcheck.cfg'
actual: looking for 'D:/a/cppcheck/cppcheck/cppcheck.cfg'
no configuration found
The test starts the original cppcheck.exe instead of the copy in <tmpdir>/bin. I think this is because on Windows, subprocess.Popen with a bare cppcheck goes through CreateProcess. It searches the parent process's own directories (including its current directory, D:\a\cppcheck\cppcheck, which contains cppcheck.exe) before any PATH, and it doesn't use the env/cwd passed to the child. So adding <tmpdir>/bin to the front of PATH has no effect there.
A possible fix: pass the full path of the copied executable as cppcheck_exe (at least on Windows) instead of relying on the PATH lookup.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test_lookup_path[config-cppcheck.cfg]writescppcheck.cfgnext to the shared cppcheck executable and removes it after the run. Sincetest/cliruns with-n auto, tests running in parallel can see that file. In https://github.com/cppcheck-opensource/cppcheck/actions/runs/45492568404/job/138794456108helloworld_test.py::test_addon_absolute_pathfound the file, but it was removed before it could be opened, so it failed withcould not load cppcheck.cfg - could not open file.