Base framework and liblttng-ust-ctl test
[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 project_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 project_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 project_settings.test_only or tools_label in
71 project_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(ust_label, str(tmpdir.mkdir("lttng-ust")))
78 tools = ProjectFactory.get(tools_label, str(tmpdir.mkdir("lttng-tools")))
79
80 ust.autobuild()
81
82 tools.dependencies.append(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(ust_label, str(tmpdir.mkdir("lttng-ust")))
101 tools = ProjectFactory.get(tools_label, str(tmpdir.mkdir("lttng-tools")))
102 ust_configure_mockup = ProjectFactory.get(ust_label, str(tmpdir.mkdir("lttng-ust-base")))
103
104 ust.autobuild()
105 ust_configure_mockup.autobuild()
106
107 # Fool configure
108 tools.dependencies.append(ust_configure_mockup)
109 tools.configure()
110
111 # Use ust under test
112 tools.special_env_variables["CPPFLAGS"] = ust.get_cppflags()
113 tools.special_env_variables["LDFLAGS"] = ust.get_ldflags()
114 tools.special_env_variables["LD_LIBRARY_PATH"] = ust.get_ld_library_path()
115
116 if not should_pass:
117 # Making sure we get a error here
118 with pytest.raises(subprocess.CalledProcessError) as error:
119 tools.build()
120 print(error)
121 else:
122 # An exception is thrown on errors
123 tools.build()
This page took 0.033952 seconds and 5 git commands to generate.