Licensing information
[deliverable/lttng-ivc.git] / lttng_ivc / tests / ust_soname_vs_tools / test_ust_so_name_vs_tools.py
1 # Copyright (c) 2017 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
2 #
3 # Permission is hereby granted, free of charge, to any person obtaining a copy
4 # of this software and associated documentation files (the "Software"), to deal
5 # in the Software without restriction, including without limitation the rights
6 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 # copies of the Software, and to permit persons to whom the Software is
8 # furnished to do so, subject to the following conditions:
9 #
10 # The above copyright notice and this permission notice shall be included in all
11 # copies or substantial portions of the Software.
12 #
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 # SOFTWARE.
20
21 import pytest
22 import subprocess
23
24 import lttng_ivc.utils.ProjectFactory as ProjectFactory
25 import lttng_ivc.settings as Settings
26
27 """
28 TODO: Document how the tests is done and what it tests
29
30 At configure time
31 At build time
32 At run time
33
34 Always include a documentation matrix:
35 FC: Fully Compatible
36 BC: Backward Compatible
37 I: Incompatible
38
39 +------------------------------------------------------------------+
40 | LTTng UST control library vs LTTng Tools |
41 +-----------------------------------------+-----+-----+-----+------+
42 | LTTng UST Control(soname) / LTTng Tools | 2.7 | 2.8 | 2.9 | 2.10 |
43 +-----------------------------------------+-----+-----+-----+------+
44 | 2.7 (2.0.0) | FC | I | I | I |
45 | 2.8 (2.0.0) | BC | FC | I | I |
46 | 2.9 (2.0.0) | BC | BC | FC | I |
47 | 2.10 (4.0.0) | I | I | I | FC |
48 +-----------------------------------------+-----+-----+-----+------+
49
50 In this scenario:
51
52 FC and BC must pass configure, build and run time
53 I must fail at configure, build and run time.
54
55 """
56
57 """
58 First tuple member: lttng-ust label
59 Second tuple member: lttng-tool label
60 Third tuple member: Success.
61 True -> expect success
62 False -> expect failure
63 """
64
65 test_matrix_label = [
66 ("lttng-ust-2.7", "lttng-tools-2.7", "lttng-ust-2.7", True),
67 ("lttng-ust-2.7", "lttng-tools-2.8", "lttng-ust-2.8", False),
68 ("lttng-ust-2.7", "lttng-tools-2.9", "lttng-ust-2.9", False),
69 ("lttng-ust-2.7", "lttng-tools-2.10", "lttng-ust-2.10", False),
70 ("lttng-ust-2.8", "lttng-tools-2.7", "lttng-ust-2.7", True),
71 ("lttng-ust-2.8", "lttng-tools-2.8", "lttng-ust-2.8", True),
72 ("lttng-ust-2.8", "lttng-tools-2.9", "lttng-ust-2.9", False),
73 ("lttng-ust-2.8", "lttng-tools-2.10", "lttng-ust-2.10", False),
74 ("lttng-ust-2.9", "lttng-tools-2.7", "lttng-ust-2.7", True),
75 ("lttng-ust-2.9", "lttng-tools-2.8", "lttng-ust-2.8", True),
76 ("lttng-ust-2.9", "lttng-tools-2.9", "lttng-ust-2.9", True),
77 ("lttng-ust-2.9", "lttng-tools-2.10", "lttng-ust-2.10", False),
78 ("lttng-ust-2.10", "lttng-tools-2.7", "lttng-ust-2.7", False),
79 ("lttng-ust-2.10", "lttng-tools-2.8", "lttng-ust-2.8", False),
80 ("lttng-ust-2.10", "lttng-tools-2.9", "lttng-ust-2.9", False),
81 ("lttng-ust-2.10", "lttng-tools-2.10", "lttng-ust-2.10", True),
82 ]
83
84 runtime_matrix_label = []
85 if not Settings.test_only:
86 runtime_matrix_label = test_matrix_label
87 else:
88 for tup in test_matrix_label:
89 ust_label, tools_label = tup[0], tup[1]
90 if (ust_label in Settings.test_only or tools_label in
91 Settings.test_only):
92 runtime_matrix_label.append(tup)
93
94
95 @pytest.mark.parametrize("ust_label,tools_label,base_tools_ust_dep,should_pass", runtime_matrix_label)
96 def test_soname_configure(tmpdir, ust_label, tools_label, base_tools_ust_dep, should_pass):
97 ust = ProjectFactory.get_fresh(ust_label, str(tmpdir.mkdir("lttng-ust")))
98 tools = ProjectFactory.get_fresh(tools_label, str(tmpdir.mkdir("lttng-tools")))
99
100 ust.autobuild()
101
102 tools.dependencies['custom-ust'] = ust
103 # TODO: Propose fixes to upstream regarding the check
104 if not should_pass:
105 # Making sure we get a error here
106 pytest.xfail("passing configure but should fail See todo")
107 with pytest.raises(subprocess.CalledProcessError) as error:
108 tools.configure()
109 print(error)
110 else:
111 # An exception is thrown on errors
112 # TODO MAYBE: wrap around a try and perform error printing + save
113 # stdout stderr etc. Or move all this handling inside the function and
114 # reraise the error (bubble up)
115 tools.configure()
116
117
118 @pytest.mark.parametrize("ust_label,tools_label,base_tools_ust_dep,should_pass", runtime_matrix_label)
119 def test_soname_build(tmpdir, ust_label, tools_label, base_tools_ust_dep, should_pass):
120 ust = ProjectFactory.get_fresh(ust_label, str(tmpdir.mkdir("lttng-ust")))
121 tools = ProjectFactory.get_fresh(tools_label,
122 str(tmpdir.mkdir("lttng-tools")))
123 ust_configure_mockup = ProjectFactory.get_fresh(ust_label,
124 str(tmpdir.mkdir("lttng-ust-base")))
125
126 ust.autobuild()
127 ust_configure_mockup.autobuild()
128
129 # Fool configure
130 tools.dependencies['custom-ust'] = ust_configure_mockup
131 tools.configure()
132
133 # Use ust under test
134 tools.special_env_variables["CPPFLAGS"] = ust.get_cppflags()
135 tools.special_env_variables["LDFLAGS"] = ust.get_ldflags()
136 tools.special_env_variables["LD_LIBRARY_PATH"] = ust.get_ld_library_path()
137
138 if not should_pass:
139 # Making sure we get a error here
140 with pytest.raises(subprocess.CalledProcessError) as error:
141 tools.build()
142 print(error)
143 else:
144 # An exception is thrown on errors
145 tools.build()
This page took 0.033131 seconds and 5 git commands to generate.