[diffoscope] 01/01: tests: comparators: test_rlib: fixes llvm >= 5.0 test case

Juliana Oliveira R jwnx-guest at moszumanska.debian.org
Mon Dec 25 21:09:38 CET 2017


This is an automated email from the git hooks/post-receive script.

jwnx-guest pushed a commit to branch jwnx_fix_llvm
in repository diffoscope.

commit 169e4088acdcd010aa9acd0034dd7a1540c7d63f
Author: Juliana Oliveira Rodrigues <juliana.orod at gmail.com>
Date:   Sat Dec 23 00:06:02 2017 -0200

    tests: comparators: test_rlib: fixes llvm >= 5.0 test case
    
    Due to LLVM changes in version 5.0, our expected diff wasn't matching
    LLVMs output. /test_item3_deflate_llvm_bitcode/ had its expectations
    updated.
    
    Closes: #877727
    
    Signed-off-by: Juliana Oliveira Rodrigues <juliana.orod at gmail.com>
---
 tests/comparators/test_rlib.py           | 17 +++++++++++++--
 tests/data/rlib_llvm_dis_expected_diff_5 | 36 ++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/tests/comparators/test_rlib.py b/tests/comparators/test_rlib.py
index 16987b4..c1097f0 100644
--- a/tests/comparators/test_rlib.py
+++ b/tests/comparators/test_rlib.py
@@ -22,6 +22,7 @@ import pytest
 import subprocess
 
 from diffoscope.comparators.ar import ArFile
+from distutils.version import LooseVersion as vcls
 
 from ..utils import diff_ignore_line_numbers
 from ..utils.data import load_fixture, get_data
@@ -51,6 +52,18 @@ def test_no_differences(rlib1):
 def differences(rlib1, rlib2):
     return rlib1.compare(rlib2).details
 
+ at pytest.fixture
+def rlib_dis_expected_diff():
+    actual_ver = llvm_version()
+
+    if (vcls(str(actual_ver)) >= vcls("3.8")):
+        diff_file = 'rlib_llvm_dis_expected_diff'
+
+    if (vcls(str(actual_ver)) >= vcls("5.0")):
+        diff_file = 'rlib_llvm_dis_expected_diff_5'
+
+    return get_data(diff_file)
+
 
 @skip_unless_tools_exist('nm')
 def test_num_items(differences):
@@ -83,10 +96,10 @@ def test_item2_rust_metadata_bin(differences):
 
 @skip_unless_tools_exist('llvm-dis')
 @skip_unless_tool_is_at_least('llvm-config', llvm_version, '3.8')
-def test_item3_deflate_llvm_bitcode(differences):
+def test_item3_deflate_llvm_bitcode(differences, rlib_dis_expected_diff):
     assert differences[3].source1 == 'alloc_system-d16b8f0e.0.bytecode.deflate'
     assert differences[3].source2 == 'alloc_system-d16b8f0e.0.bytecode.deflate'
-    expected_diff = get_data('rlib_llvm_dis_expected_diff')
+    expected_diff = rlib_dis_expected_diff
     actual_diff = differences[3].details[0].details[1].unified_diff
     assert diff_ignore_line_numbers(actual_diff) == diff_ignore_line_numbers(expected_diff)
 
diff --git a/tests/data/rlib_llvm_dis_expected_diff_5 b/tests/data/rlib_llvm_dis_expected_diff_5
new file mode 100644
index 0000000..769dc90
--- /dev/null
+++ b/tests/data/rlib_llvm_dis_expected_diff_5
@@ -0,0 +1,36 @@
+@@ -41,32 +41,32 @@
+ entry-block:
+   %out.i.i = alloca i8*, align 8
+   %4 = icmp ult i64 %3, 17
+   br i1 %4, label %then-block-195-.i, label %_ZN12alloc_system3imp8allocate17h8ba7625cc4a820e8E.exit.i
+ 
+ then-block-195-.i:                                ; preds = %entry-block
+   %5 = tail call i8* @realloc(i8* %0, i64 %2) #2
+-  br label %_ZN12alloc_system3imp10reallocate17h4a0811c9ec086854E.exit
++  br label %_ZN12alloc_system3imp10reallocate1l44a0811c9ec086854E.exit
+ 
+ _ZN12alloc_system3imp8allocate17h8ba7625cc4a820e8E.exit.i: ; preds = %entry-block
+   %6 = bitcast i8** %out.i.i to i8*
+   call void @llvm.lifetime.start.p0i8(i64 8, i8* %6) #2
+   store i8* null, i8** %out.i.i, align 8
+   %7 = call i32 @posix_memalign(i8** nonnull %out.i.i, i64 %3, i64 %2) #2
+   %8 = icmp eq i32 %7, 0
+   %9 = load i8*, i8** %out.i.i, align 8
+   %sret_slot.0.i.i = select i1 %8, i8* %9, i8* null
+   call void @llvm.lifetime.end.p0i8(i64 8, i8* %6) #2
+   %10 = icmp ule i64 %2, %1
+   %11 = select i1 %10, i64 %2, i64 %1
+   call void @llvm.memmove.p0i8.p0i8.i64(i8* %sret_slot.0.i.i, i8* %0, i64 %11, i32 1, i1 false) #2
+   call void @free(i8* %0) #2
+-  br label %_ZN12alloc_system3imp10reallocate17h4a0811c9ec086854E.exit
++  br label %_ZN12alloc_system3imp10reallocate1l44a0811c9ec086854E.exit
+ 
+-_ZN12alloc_system3imp10reallocate17h4a0811c9ec086854E.exit: ; preds = %_ZN12alloc_system3imp8allocate17h8ba7625cc4a820e8E.exit.i, %then-block-195-.i
++_ZN12alloc_system3imp10reallocate1l44a0811c9ec086854E.exit: ; preds = %_ZN12alloc_system3imp8allocate17h8ba7625cc4a820e8E.exit.i, %then-block-195-.i
+   %sret_slot.0.i = phi i8* [ %5, %then-block-195-.i ], [ %sret_slot.0.i.i, %_ZN12alloc_system3imp8allocate17h8ba7625cc4a820e8E.exit.i ]
+   ret i8* %sret_slot.0.i
+ }
+ 
+ ; Function Attrs: nounwind readnone uwtable
+ define i64 @__rust_reallocate_inplace(i8* nocapture readnone, i64, i64, i64) unnamed_addr #1 {
+ entry-block:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list