Commit 1d7bea16 authored by Mattia Rizzolo's avatar Mattia Rizzolo

tests: skip rlib tests if the "nm" tool is missing

Closes: #837742
parent 07b75284
......@@ -25,7 +25,7 @@ from diffoscope.comparators.ar import ArFile
from diffoscope.comparators.utils import diff_ignore_line_numbers
from utils import skip_unless_tools_exist, skip_unless_tool_is_older_than, \
data, load_fixture, assert_non_existing
skip_unless_tools_exist, data, load_fixture, assert_non_existing
rlib1 = load_fixture(data('test1.rlib'))
rlib2 = load_fixture(data('test2.rlib'))
......@@ -44,21 +44,25 @@ def test_no_differences(rlib1):
def differences(rlib1, rlib2):
return rlib1.compare(rlib2).details
@skip_unless_tools_exist('nm')
def test_num_items(differences):
assert len(differences) == 4
@skip_unless_tools_exist('nm')
def test_item0_armap(differences):
assert differences[0].source1 == 'nm -s {}'
assert differences[0].source2 == 'nm -s {}'
expected_diff = open(data('rlib_armap_expected_diff')).read()
assert differences[0].unified_diff == expected_diff
@skip_unless_tools_exist('nm')
def test_item1_elf(differences):
assert differences[1].source1 == 'alloc_system-d16b8f0e.0.o'
assert differences[1].source2 == 'alloc_system-d16b8f0e.0.o'
expected_diff = open(data('rlib_elf_expected_diff')).read()
assert differences[1].details[0].unified_diff == expected_diff
@skip_unless_tools_exist('nm')
def test_item2_rust_metadata_bin(differences):
assert differences[2].source1 == 'rust.metadata.bin'
assert differences[2].source2 == 'rust.metadata.bin'
......@@ -72,5 +76,6 @@ def test_item3_deflate_llvm_bitcode(differences):
actual_diff = differences[3].details[0].details[1].unified_diff
assert diff_ignore_line_numbers(actual_diff) == diff_ignore_line_numbers(expected_diff)
@skip_unless_tools_exist('nm')
def test_compare_non_existing(monkeypatch, rlib1):
assert_non_existing(monkeypatch, rlib1)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment