Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Update test_abi_compliance.py to check ABI-Dumper app usability
Browse files Browse the repository at this point in the history
  • Loading branch information
xlz-jbleclere committed Jan 24, 2022
1 parent e0c47fc commit d40a03d
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion tests/test_abi_compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import pytest
from shutil import copy
from os.path import join, isdir, basename, splitext
from subprocess import run, CalledProcessError, PIPE

from tests.conftest import perform_once

Expand All @@ -22,7 +23,6 @@ def _run(*command, **kwargs):
Returns:
subprocess.CompletedProcess
"""
from subprocess import run, CalledProcessError, PIPE
result = run(*command, stdout=PIPE, stderr=PIPE,
universal_newlines=True, **kwargs)
try:
Expand All @@ -43,6 +43,21 @@ def make(path, target=None):
cwd=path)


def check_dump_abi():
"""
Check ABI Dumper app is installed.
Returns:
True: ABI Dumper app is available
False: ABI Dumper app is not available
"""
try:
res = _run(['abi-dumper', '-v'])
res.check_returncode()
return True
except (FileNotFoundError, CalledProcessError):
return False


def dump_abi(dump_file, so_file, include, version, name):
"""
Dump library ABI.
Expand Down Expand Up @@ -124,10 +139,14 @@ def test_abi_compliance(tmpdir, accelize_drm):
"""
perform_once(__name__ + '.test_abi_compliance')



if not accelize_drm.pytest_build_environment:
pytest.skip('This test is only performed on build environment.')
elif not accelize_drm.pytest_build_type == 'debug':
pytest.xfail('This test needs libraries compiled in debug mode.')
elif not check_dump_abi():
pytest.xfail('This test cannot be performed because ABI-Dumper app is not usable.')

# Initialize test
from concurrent.futures import ThreadPoolExecutor, as_completed
Expand Down

0 comments on commit d40a03d

Please sign in to comment.