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
This PR fixes intermittent failures in PHPParserUnitTests by isolating the SQLite database used by each test process.
Root Cause
The test suite registers individual test cases using doctest_discover_tests(), allowing CTest to execute them concurrently.
All test processes were using the same SQLite database:
/tmp/.codelite/phpsymbols.db
Since each test clears and repopulates the database, concurrent execution could result in:
One process deleting data created by another.
SQLite lock contention (SQLITE_BUSY).
Non-deterministic assertion failures due to missing symbols.
This matches the inconsistent failures reported across different build environments.
Changes
Replace the shared database filename with a process-unique database filename using wxGetProcessId().
Ensure each test process operates on its own isolated SQLite database.
Add cleanup to close the database connection and remove the temporary database after the tests complete.
Result
Tests no longer share mutable state during parallel execution, eliminating race conditions while preserving the existing parser behavior. The change only affects the test infrastructure and does not modify the parser implementation or production code.
Thanks @Jarod42 for the suggestion! I updated the implementation to use an in-memory SQLite database (":memory:") instead of a process-specific temporary file.
To support this, I also updated PHPLookupTable::Open() to handle the ":memory:" database path by bypassing filesystem-specific checks and directory creation. The unit tests now use lookup.Open(":memory:"), and the temporary file creation/cleanup logic has been removed.
Can you check if the tests marked as #if 1 // FAILED/doctest::may_fail() (as "test_phpdoc_var_in_class") now pass with that fix?
Thanks to activate them if they are fixed now.
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.
#4017 issue
This PR fixes intermittent failures in
PHPParserUnitTestsby isolating the SQLite database used by each test process.Root Cause
The test suite registers individual test cases using
doctest_discover_tests(), allowing CTest to execute them concurrently.All test processes were using the same SQLite database:
Since each test clears and repopulates the database, concurrent execution could result in:
SQLITE_BUSY).This matches the inconsistent failures reported across different build environments.
Changes
wxGetProcessId().Result
Tests no longer share mutable state during parallel execution, eliminating race conditions while preserving the existing parser behavior. The change only affects the test infrastructure and does not modify the parser implementation or production code.