5e06fd629ced45eaa75d9d73a9434accd0a2a7c5
[deliverable/lttng-ivc.git] / lttng_ivc / tests / ust_soname_vs_tools / test_ust_so_name_vs_tools.py
1 import pytest
2 import subprocess
3
4 import lttng_ivc.utils.ProjectFactory as ProjectFactory
5 import lttng_ivc.settings as Settings
6
7 """
8 TODO: Document how the tests is donne and what it tests
9
10 At configure time
11 At build time
12 At run time
13
14 Always include a documentation matrix:
15 FC: Fully Compatible
16 BC: Backward Compatible
17 I: 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
30 In this scenario:
31
32 FC and BC must pass configure, build and run time
33 I must fail at configure, build and run time.
34
35 """
36
37 """
38 First tuple member: lttng-ust label
39 Second tuple member: lttng-tool label
40 Third tuple member: Success.
41 True -> expect success
42 False -> expect failure
43 """
44
45 test_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
64 runtime_matrix_label = []
65 if not Settings.test_only:
66 runtime_matrix_label = test_matrix_label
67 else:
68 for tup in test_matrix_label:
69 ust_label, tools_label = tup[0], tup[1]
70 if (ust_label in Settings.test_only or tools_label in
71 Settings.test_only):
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)
76 def test_soname_configure(tmpdir, ust_label, tools_label, base_tools_ust_dep, should_pass):
77 ust = ProjectFactory.get_fresh(ust_label, str(tmpdir.mkdir("lttng-ust")))
78 tools = ProjectFactory.get_fresh(tools_label, str(tmpdir.mkdir("lttng-tools")))
79
80 ust.autobuild()
81
82 tools.dependencies['custom-ust'] = ust
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)
99 def test_soname_build(tmpdir, ust_label, tools_label, base_tools_ust_dep, should_pass):
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")))
105
106 ust.autobuild()
107 ust_configure_mockup.autobuild()
108
109 # Fool configure
110 tools.dependencies['custom-ust'] = ust_configure_mockup
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.032649 seconds and 4 git commands to generate.