test.py 1011 B

1234567891011121314151617181920212223242526272829
  1. import os
  2. import os.path
  3. import re
  4. import subprocess
  5. import yatest.common
  6. def test_libc():
  7. mrjob_dir = yatest.common.binary_path('yt/yql/tools/mrjob')
  8. mrjob_path = os.path.join(mrjob_dir, 'mrjob')
  9. tools_path = os.path.dirname(yatest.common.cxx_compiler_path())
  10. nm_path = os.path.join(tools_path, 'llvm-nm')
  11. readelf_path = os.path.join(tools_path, 'readelf')
  12. if os.path.isfile(nm_path):
  13. result = subprocess.check_output([nm_path, mrjob_path])
  14. elif os.path.isfile(readelf_path):
  15. result = subprocess.check_output([readelf_path, '-a', mrjob_path])
  16. else:
  17. assert False, 'neither llvm-nm nor readelf found, checked paths: %s' % str((readelf_path, nm_path))
  18. glibc_tag_count = 0
  19. for line in result.decode().split('\n'):
  20. glibc_tag = re.search(r'GLIBC_[0-9\.]+', line)
  21. if glibc_tag:
  22. glibc_tag_count += 1
  23. parts = glibc_tag.group().split('.')
  24. assert len(parts) > 1
  25. assert int(parts[1]) <= 11