Typo
[deliverable/lttng-ivc.git] / lttng_ivc / tests / ust_soname_vs_tools / test_ust_so_name_vs_tools.py
CommitLineData
de9b991b
JR
1import pytest
2import subprocess
3
4import lttng_ivc.utils.ProjectFactory as ProjectFactory
fe7b987e 5import lttng_ivc.settings as Settings
de9b991b
JR
6
7"""
80586d0d 8TODO: Document how the tests is done and what it tests
de9b991b
JR
9
10At configure time
11At build time
12At run time
13
14Always include a documentation matrix:
15FC: Fully Compatible
16BC: Backward Compatible
17I: Incompatible
18
19+------------------------------------------------------------------+
20| LTTng UST control library vs LTTng Tools |
21+-----------------------------------------+-----+-----+-----+------+
22| LTTng UST Control(soname) / LTTng Tools | 2.7 | 2.8 | 2.9 | 2.10 |
23+-----------------------------------------+-----+-----+-----+------+
24| 2.7 (2.0.0) | FC | I | I | I |
25| 2.8 (2.0.0) | BC | FC | I | I |
26| 2.9 (2.0.0) | BC | BC | FC | I |
27| 2.10 (4.0.0) | I | I | I | FC |
28+-----------------------------------------+-----+-----+-----+------+
29
30In this scenario:
31
32FC and BC must pass configure, build and run time
33I must fail at configure, build and run time.
34
35"""
36
37"""
38First tuple member: lttng-ust label
39Second tuple member: lttng-tool label
40Third tuple member: Success.
41 True -> expect success
42 False -> expect failure
43"""
44
45test_matrix_label = [
46 ("lttng-ust-2.7", "lttng-tools-2.7", "lttng-ust-2.7", True),
47 ("lttng-ust-2.7", "lttng-tools-2.8", "lttng-ust-2.8", False),
48 ("lttng-ust-2.7", "lttng-tools-2.9", "lttng-ust-2.9", False),
49 ("lttng-ust-2.7", "lttng-tools-2.10", "lttng-ust-2.10", False),
50 ("lttng-ust-2.8", "lttng-tools-2.7", "lttng-ust-2.7", True),
51 ("lttng-ust-2.8", "lttng-tools-2.8", "lttng-ust-2.8", True),
52 ("lttng-ust-2.8", "lttng-tools-2.9", "lttng-ust-2.9", False),
53 ("lttng-ust-2.8", "lttng-tools-2.10", "lttng-ust-2.10", False),
54 ("lttng-ust-2.9", "lttng-tools-2.7", "lttng-ust-2.7", True),
55 ("lttng-ust-2.9", "lttng-tools-2.8", "lttng-ust-2.8", True),
56 ("lttng-ust-2.9", "lttng-tools-2.9", "lttng-ust-2.9", True),
57 ("lttng-ust-2.9", "lttng-tools-2.10", "lttng-ust-2.10", False),
58 ("lttng-ust-2.10", "lttng-tools-2.7", "lttng-ust-2.7", False),
59 ("lttng-ust-2.10", "lttng-tools-2.8", "lttng-ust-2.8", False),
60 ("lttng-ust-2.10", "lttng-tools-2.9", "lttng-ust-2.9", False),
61 ("lttng-ust-2.10", "lttng-tools-2.10", "lttng-ust-2.10", True),
62]
63
64runtime_matrix_label = []
fe7b987e 65if not Settings.test_only:
de9b991b
JR
66 runtime_matrix_label = test_matrix_label
67else:
68 for tup in test_matrix_label:
69 ust_label, tools_label = tup[0], tup[1]
fe7b987e
JR
70 if (ust_label in Settings.test_only or tools_label in
71 Settings.test_only):
de9b991b
JR
72 runtime_matrix_label.append(tup)
73
74
75@pytest.mark.parametrize("ust_label,tools_label,base_tools_ust_dep,should_pass", runtime_matrix_label)
76def test_soname_configure(tmpdir, ust_label, tools_label, base_tools_ust_dep, should_pass):
97d494b0
JR
77 ust = ProjectFactory.get_fresh(ust_label, str(tmpdir.mkdir("lttng-ust")))
78 tools = ProjectFactory.get_fresh(tools_label, str(tmpdir.mkdir("lttng-tools")))
de9b991b
JR
79
80 ust.autobuild()
81
fe7b987e 82 tools.dependencies['custom-ust'] = ust
de9b991b
JR
83 # TODO: Propose fixes to upstream regarding the check
84 if not should_pass:
85 # Making sure we get a error here
86 pytest.xfail("passing configure but should fail See todo")
87 with pytest.raises(subprocess.CalledProcessError) as error:
88 tools.configure()
89 print(error)
90 else:
91 # An exception is thrown on errors
92 # TODO MAYBE: wrap around a try and perform error printing + save
93 # stdout stderr etc. Or move all this handling inside the function and
94 # reraise the error (bubble up)
95 tools.configure()
96
97
98@pytest.mark.parametrize("ust_label,tools_label,base_tools_ust_dep,should_pass", runtime_matrix_label)
99def test_soname_build(tmpdir, ust_label, tools_label, base_tools_ust_dep, should_pass):
fe7b987e
JR
100 ust = ProjectFactory.get_fresh(ust_label, str(tmpdir.mkdir("lttng-ust")))
101 tools = ProjectFactory.get_fresh(tools_label,
102 str(tmpdir.mkdir("lttng-tools")))
103 ust_configure_mockup = ProjectFactory.get_fresh(ust_label,
104 str(tmpdir.mkdir("lttng-ust-base")))
de9b991b
JR
105
106 ust.autobuild()
107 ust_configure_mockup.autobuild()
108
109 # Fool configure
fe7b987e 110 tools.dependencies['custom-ust'] = ust_configure_mockup
de9b991b
JR
111 tools.configure()
112
113 # Use ust under test
114 tools.special_env_variables["CPPFLAGS"] = ust.get_cppflags()
115 tools.special_env_variables["LDFLAGS"] = ust.get_ldflags()
116 tools.special_env_variables["LD_LIBRARY_PATH"] = ust.get_ld_library_path()
117
118 if not should_pass:
119 # Making sure we get a error here
120 with pytest.raises(subprocess.CalledProcessError) as error:
121 tools.build()
122 print(error)
123 else:
124 # An exception is thrown on errors
125 tools.build()
This page took 0.029134 seconds and 5 git commands to generate.