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