From: Dave Marchevsky Date: Mon, 20 Dec 2021 22:47:11 +0000 (-0500) Subject: docker: Bump default LLVM used for tests to 11 X-Git-Tag: v0.24.0~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c238bc2b08ca435ccb1ddef788c65c2286d07570;p=platform%2Fupstream%2Fbcc.git docker: Bump default LLVM used for tests to 11 This is another prep commit for running docker tests on both 18.04 and 20.04 versions of ubuntu. 20.04 doesn't have some LLVM 8 libs that the docker build expects, so bump to 11. Bumping to 11 causes test_disassembler to fail because it expects a map w/ a certain format with FD 3, and the LLVM bump causes the map to be FD 4. The purpose of the test is to ensure that the format of the diassembled map is correct, not that it has a specific FD, so make some small changes to the test so that it doesn't care what the FD number is. --- diff --git a/Dockerfile.tests b/Dockerfile.tests index 3b082364..c43b22cf 100644 --- a/Dockerfile.tests +++ b/Dockerfile.tests @@ -1,7 +1,7 @@ ARG UBUNTU_VERSION="18.04" FROM ubuntu:${UBUNTU_VERSION} -ARG LLVM_VERSION="8" +ARG LLVM_VERSION="11" ENV LLVM_VERSION=$LLVM_VERSION ARG UBUNTU_SHORTNAME="bionic" diff --git a/tests/python/test_disassembler.py b/tests/python/test_disassembler.py index bf324d2b..794309a9 100755 --- a/tests/python/test_disassembler.py +++ b/tests/python/test_disassembler.py @@ -151,7 +151,25 @@ class TestDisassembler(TestCase): 1: (95) exit""", b.disassemble_func("test_func")) - self.assertEqual( + def _assert_equal_ignore_fd_id(s1, s2): + # In first line of string like + # Layout of BPF map test_map (type HASH, FD 3, ID 0): + # Ignore everything from FD to end-of-line + # Compare rest of string normally + s1_lines = s1.split('\n') + s2_lines = s2.split('\n') + s1_first_cut = s1_lines[0] + s1_first_cut = s1_first_cut[0:s1_first_cut.index("FD")] + s2_first_cut = s2_lines[0] + s2_first_cut = s2_first_cut[0:s2_first_cut.index("FD")] + + self.assertEqual(s1_first_cut, s2_first_cut) + + s1_rest = '\n'.join(s1_lines[1:]) + s2_rest = '\n'.join(s2_lines[1:]) + self.assertEqual(s1_rest, s2_rest) + + _assert_equal_ignore_fd_id( """Layout of BPF map test_map (type HASH, FD 3, ID 0): struct { int a;