-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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/dba_gdbm.phpt: test failure due to key ordering #14786
Comments
This might actually something that changed in the GDBM driver/lib? As I don't see why it would change randomly, I had consistent behaviour when I was actively refactoring this a while back |
It's possible but my first guess would be that it's on x86. The same version with the same build flags passes for me on amd64. |
The iteration order is apparently based on gdbm's internal hashes and FWIW gdbm's own test suite sorts the output, see e.g. https://git.savannah.gnu.org/cgit/gdbm.git/tree/tests/create00.at The |
Right, then adding a sort and referencing the upstream test makes sense. |
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/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 GH-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.
* 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.
Description
Original report: https://bugs.gentoo.org/935379
The diff for this failed tests contains e.g.
The corresponding test code is,
So to me it looks like the insert order is not guaranteed to be the iteration order according to
dba_firstkey()
anddba_nextkey()
. Since there are only six keys, I guess we could sort the output (in a locale-independent way) before printing it?PHP Version
PHP-8.2.20
Operating System
Gentoo Linux
The text was updated successfully, but these errors were encountered: