Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(31623)

Delta Between Two Patch Sets: Lib/test/test_sysconfig.py

Issue 22980: C extension naming doesn't take bitness into account
Left Patch Set: Created 4 years, 9 months ago
Right Patch Set: Created 4 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « configure.ac ('k') | Misc/NEWS » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 import unittest 1 import unittest
2 import sys 2 import sys
3 import os 3 import os
4 import subprocess 4 import subprocess
5 import shutil 5 import shutil
6 from copy import copy 6 from copy import copy
7 7
8 from test.support import (run_unittest, TESTFN, unlink, check_warnings, 8 from test.support import (run_unittest, TESTFN, unlink, check_warnings,
9 captured_stdout, skip_unless_symlink) 9 captured_stdout, skip_unless_symlink)
10 10
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 sysconfig.get_config_var('EXT_SUFFIX')) 383 sysconfig.get_config_var('EXT_SUFFIX'))
384 384
385 @unittest.skipIf(sysconfig.get_config_var('EXT_SUFFIX') is None, 385 @unittest.skipIf(sysconfig.get_config_var('EXT_SUFFIX') is None,
386 'EXT_SUFFIX required for this test') 386 'EXT_SUFFIX required for this test')
387 def test_SO_in_vars(self): 387 def test_SO_in_vars(self):
388 vars = sysconfig.get_config_vars() 388 vars = sysconfig.get_config_vars()
389 self.assertIsNotNone(vars['SO']) 389 self.assertIsNotNone(vars['SO'])
390 self.assertEqual(vars['SO'], vars['EXT_SUFFIX']) 390 self.assertEqual(vars['SO'], vars['EXT_SUFFIX'])
391 391
392 @unittest.skipUnless(sys.platform == 'linux', 'Linux-specific test') 392 @unittest.skipUnless(sys.platform == 'linux', 'Linux-specific test')
393 def test_bitness_in_ext_suffix(self): 393 def test_triplet_in_ext_suffix(self):
394 import ctypes, platform, re
395 machine = platform.machine()
394 suffix = sysconfig.get_config_var('EXT_SUFFIX') 396 suffix = sysconfig.get_config_var('EXT_SUFFIX')
395 bitness = '-32b' if sys.maxsize < 2**32 else '-64b' 397 if re.match('(aarch64|arm|mips|ppc|powerpc|s390|sparc)', machine):
396 self.assertTrue(suffix.endswith(bitness + '.so'), suffix) 398 self.assertTrue('linux' in suffix, suffix)
399 if re.match('(i[3-6]86|x86_64)$', 'x86_64'):
400 if ctypes.sizeof(ctypes.c_char_p()) == 4:
401 self.assertTrue(suffix.endswith('i386-linux-gnu.so') \
402 or suffix.endswith('x86_64-linux-gnux32.so'),
403 suffix)
404 else: # 8 byte pointer size
405 self.assertTrue(suffix.endswith('x86_64-linux-gnu.so'), suffix)
397 406
398 407
399 class MakefileTests(unittest.TestCase): 408 class MakefileTests(unittest.TestCase):
400 409
401 @unittest.skipIf(sys.platform.startswith('win'), 410 @unittest.skipIf(sys.platform.startswith('win'),
402 'Test is not Windows compatible') 411 'Test is not Windows compatible')
403 def test_get_makefile_filename(self): 412 def test_get_makefile_filename(self):
404 makefile = sysconfig.get_makefile_filename() 413 makefile = sysconfig.get_makefile_filename()
405 self.assertTrue(os.path.isfile(makefile), makefile) 414 self.assertTrue(os.path.isfile(makefile), makefile)
406 415
(...skipping 13 matching lines...) Expand all
420 'var4': '$/invalid', 429 'var4': '$/invalid',
421 'var5': 'dollar$5', 430 'var5': 'dollar$5',
422 }) 431 })
423 432
424 433
425 def test_main(): 434 def test_main():
426 run_unittest(TestSysConfig, MakefileTests) 435 run_unittest(TestSysConfig, MakefileTests)
427 436
428 if __name__ == "__main__": 437 if __name__ == "__main__":
429 test_main() 438 test_main()
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+