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
test_dbm_gnu.test_reorganize() failed on x86-64 High Sierra 3.x #78082
Comments
http://buildbot.python.org/all/#/builders/145/builds/81 x86-64 High Sierra 3.x: ====================================================================== Traceback (most recent call last):
File "/Users/buildbot/buildarea/3.x.billenstein-sierra/build/Lib/test/test_dbm_gnu.py", line 77, in test_reorganize
self.assertTrue(size0 < size1)
AssertionError: False is not true The only change of this build is the commit cb97073: bpo-33630. But I hardly believe that it's related. |
http://buildbot.python.org/all/#/builders/145/builds/84 ====================================================================== Traceback (most recent call last):
File "/Users/buildbot/buildarea/3.x.billenstein-sierra/build/Lib/test/test_dbm_gnu.py", line 77, in test_reorganize
self.assertGreater(size1, size0)
AssertionError: 16777216 not greater than 16777216 |
16777216 = 2**24 = 16 MiB Looks too large for the size of an empty database. |
@matt Billenstein: Hi! Would you mind to have a look at this issue? It seems like test_dbm_gnu started to fail today. Did you upgrade the buildbot worker recently? |
For comparison, on Linux size0 = 12288 = 12 KiB. 3 decimal orders smaller. |
size0=16777216 (16 MiB). On my Fedora 28, size0=12288 (12 KiB). Even more strange: another test starts by removing the filename, just in case!? def test_error_conditions(self):
# Try to open a non-existent database.
unlink(filename)
... Maybe the setUp() method must fail if filename already exists? The buildbot runs tests in subprocesses: regrtest spawns child procsses which creates their own temporary empty current directory and TESTFN is related to the current directory. If the filename/database existed before test_reorganize(), it's likely a bug in test_dbm_gnu: but there is a single TestCase class with a tearDown() method which calls unlink(filename). -- Maybe x86-64 High Sierra 3.x has a different dbm library version which always creates an empty database with 16 MiB preallocated on disk!? |
Ok, I reproduced the issue on macOS High-Sierra and gdbm 1.15. Creating a DB creates a file of 16 MiB. macbook:master haypo$ brew info gdbm and macbook:master haypo$ ./python.exe
Python 3.8.0a0 (heads/master:22525de, Jun 19 2018, 13:56:57)
[Clang 9.1.0 (clang-902.0.39.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import dbm.gnu
>>> import os
>>> dbm.gnu.open("x", "c").close()
>>> os.path.getsize("x")
16777216 |
PR 7791 makes the test less useful. I suggest to replace 10000 with size0 or max(size0, 10000). |
Considering adding gdbm version to pythoninfo? It is possible to expose version info from gnu dbm. |
Did not increasing the size of the value fixed the test? |
Xiang: "Considering adding gdbm version to pythoninfo? It is possible to expose version info from gnu dbm." I wrote PR 7794. What do you think of this? |
Serhiy Storchaka: "Did not increasing the size of the value fixed the test?" Honestly, I don't understand the purpose of the test. Why does *Python* check such low level implementation detail, the exact file size used by gdbm? We are supposed to only test the API, no? If someone wants to change something else, I would suggest to remove test_reorganize(). |
How can we test an API if calling it doesn't have any effect? reorganize() can be a no-op method, and still pass the test. |
The buildbot is green again! |
Ok, the test have been fixed in 3.6, 3.7 and master. I added a private version number in master. If someone wants to add a public version number, please go ahead but open a new issue. |
Thanks Serhiy and Xiang for the reviews and to help to debug this bug. |
Oh, the test also fails on 2.7: x86-64 High Sierra 2.7 I backported the fix to 2.7: PR 7818. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: