summaryrefslogtreecommitdiffstats
path: root/yt/yql/tools/mrjob/test/test.py
blob: 41d53874612af9ec6cfdc6dd58119b153aa7d48e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import os
import os.path
import re
import subprocess

import yatest.common


def test_libc():
    mrjob_dir = yatest.common.binary_path('yt/yql/tools/mrjob')
    mrjob_path = os.path.join(mrjob_dir, 'mrjob')
    tools_path = os.path.dirname(yatest.common.cxx_compiler_path())
    nm_path = os.path.join(tools_path, 'llvm-nm')
    readelf_path = os.path.join(tools_path, 'readelf')
    if os.path.isfile(nm_path):
        result = subprocess.check_output([nm_path, mrjob_path])
    elif os.path.isfile(readelf_path):
        result = subprocess.check_output([readelf_path, '-a', mrjob_path])
    else:
        assert False, 'neither llvm-nm nor readelf found, checked paths: %s' % str((readelf_path, nm_path))

    glibc_tag_count = 0
    for line in result.decode().split('\n'):
        glibc_tag = re.search(r'GLIBC_[0-9\.]+', line)
        if glibc_tag:
            glibc_tag_count += 1
            parts = glibc_tag.group().split('.')
            assert len(parts) > 1
            assert int(parts[1]) <= 11