[Python-Dev] incorrect regression tests
Neal Norwitz
neal@metaslash.com
Mon, 17 Feb 2003 10:02:15 -0500
I found 7 regression tests which weren't being executed by regrtest.
I checked in fixes for 6 of them. test_zipimport was the other test,
but there was a problem. More on that below.
To be run, tests must do one of following:
1) have a def test_main() which runs the tests
2) run the tests as a side-effect of import
I'm wondering if regrtest.py should grow an option to print a list of
all the tests which don't define test_main? When adding a new test,
it will be easy to verify the test is, in fact, being run. Perhaps
also a list of known tests which don't have a test_main and are
expected to run on import? (I think there's over 100.)
When test_zipimport is run by regrtest, there is memory corruption:
[neal@epoch 2.3]$ ./python -E -tt ./Lib/test/regrtest.py test_zipimport
test_zipimport
Debug memory block at address p=0x40280508:
74 bytes originally requested
The 4 pad bytes at p-4 are FORBIDDENBYTE, as expected.
The 4 pad bytes at tail=0x40280552 are not all FORBIDDENBYTE (0xfb):
at tail+0: 0x00 *** OUCH
at tail+1: 0xfb
at tail+2: 0xfb
at tail+3: 0xfb
The block was made by call #51959 to debug malloc/realloc.
Data at p: 64 65 66 20 67 65 74 5f ... 69 6c 65 5f 5f 0a 00 0a
Fatal Python error: bad trailing pad byte
Aborted (core dumped)
I didn't check in the test or investigate the cause.
Below is a patch to the test so it will run under regrtest.
Neal
--
Index: test_zipimport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_zipimport.py,v
retrieving revision 1.5
diff -w -u -r1.5 test_zipimport.py
--- test_zipimport.py 9 Jan 2003 22:27:10 -0000 1.5
+++ test_zipimport.py 17 Feb 2003 14:58:45 -0000
@@ -186,6 +186,9 @@
compression = ZIP_DEFLATED
-if __name__ == "__main__":
+def test_main():
test_support.run_unittest(UncompressedZipImportTestCase)
test_support.run_unittest(CompressedZipImportTestCase)
+
+if __name__ == "__main__":
+ test_main()