-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ext/dba/tests: sort expected test output #14962
Conversation
Iterating through a database with firstkey() and nextkey() is guaranteed to retrieve all rows, but apparently not in any particular order. This is causing a test failure for at least one user, so we steal the sort() approach from GDBM to ensure that the output is predictable.
The actual output is now sorted for consistency, so we need to update the expected output as well. As a nice side effect, some differences in the expected outputs for the various engines have been eliminated. Closes phpGH-14786
Windows won't (only QDBM and LMDB are tested on CI, currently). I haven't checked other OSs. |
This test uses a routine from ext/dba that now sorts its (actual) output, so we have to sort the expected output here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack for pgsql
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, we probably should backport this
After doing some more digging, it looks like GDBM isn't the only engine where the iteration order with firstkey() and nextkey() might change unexpectedly.
Thanks, I added one more commit to clarify the comment. |
* ext/dba/tests/setup/setup_dba_tests.inc: sort test output Iterating through a database with firstkey() and nextkey() is guaranteed to retrieve all rows, but apparently not in any particular order. This is causing a test failure for at least one user, so we steal the sort() approach from GDBM to ensure that the output is predictable. * ext/dba/tests/dba_*.phpt: sort expected test output The actual output is now sorted for consistency, so we need to update the expected output as well. As a nice side effect, some differences in the expected outputs for the various engines have been eliminated. Closes phpGH-14786 * ext/pgsql/tests/80_bug14383.phpt: sort expected test output This test uses a routine from ext/dba that now sorts its (actual) output, so we have to sort the expected output here as well. * ext/dba/tests/setup/setup_dba_tests.inc: update comment After doing some more digging, it looks like GDBM isn't the only engine where the iteration order with firstkey() and nextkey() might change unexpectedly.
Alpine hit the sorting issue too: #16902 (comment) |
Yeah probably should |
OK. I'll get to it, I'll make a PR soon and if that passes CI merge it. |
Alpine CI regularly fails because of the sorting order of these tests. See php#14962 (comment)
Alpine CI regularly fails because of the sorting order of these tests. See #14962 (comment) Closes GH-16950.
* PHP-8.2: Backport GH-14962 to stable versions
* PHP-8.3: Backport GH-14962 to stable versions
* PHP-8.4: Backport GH-14962 to stable versions
Fixes #14786 by sorting the fetched rows before
echo
ing them, and updating the expected output to reflect the sort order.I don't have dbm, ndbm, or Oracle db < 4 to test so hopefully the CI does.