Commit | Line | Data |
---|---|---|
8149cb8e JR |
1 | import pytest |
2 | import os | |
3 | ||
4 | import lttng_ivc.utils.ProjectFactory as ProjectFactory | |
5 | import lttng_ivc.utils.utils as utils | |
6 | import lttng_ivc.utils.runtime as Run | |
7 | import lttng_ivc.settings as Settings | |
8 | ||
9 | """ | |
10 | Backward compatibility testing for lttng-ctl | |
11 | """ | |
12 | ||
13 | """ | |
14 | First tuple member: lttng-tools label from which the client (lttng bin) is sourced | |
15 | Second tuple member: lttng-tools label for runtime sessiond and lttng-ctl | |
16 | Third tuple member: expected scenario | |
17 | """ | |
18 | ||
19 | test_matrix_basic_listing = [ | |
20 | ("lttng-tools-2.7", "lttng-tools-2.7", "Success"), | |
21 | ("lttng-tools-2.7", "lttng-tools-2.8", "Success"), | |
22 | ("lttng-tools-2.7", "lttng-tools-2.9", "Success"), | |
23 | ("lttng-tools-2.7", "lttng-tools-2.10", "Success"), | |
24 | ("lttng-tools-2.8", "lttng-tools-2.7", "Missing symbol"), | |
25 | ("lttng-tools-2.8", "lttng-tools-2.8", "Success"), | |
26 | ("lttng-tools-2.8", "lttng-tools-2.9", "Success"), | |
27 | ("lttng-tools-2.8", "lttng-tools-2.10", "Success"), | |
28 | ("lttng-tools-2.9", "lttng-tools-2.7", "Missing symbol"), | |
29 | ("lttng-tools-2.9", "lttng-tools-2.8", "Missing symbol"), | |
30 | ("lttng-tools-2.9", "lttng-tools-2.9", "Success"), | |
31 | ("lttng-tools-2.9", "lttng-tools-2.10", "Success"), | |
32 | ("lttng-tools-2.10", "lttng-tools-2.7", "Missing symbol"), | |
33 | ("lttng-tools-2.10", "lttng-tools-2.8", "Missing symbol"), | |
34 | ("lttng-tools-2.10", "lttng-tools-2.9", "Missing symbol"), | |
35 | ("lttng-tools-2.10", "lttng-tools-2.10", "Success"), | |
36 | ] | |
37 | ||
38 | runtime_matrix_basic_listing = [] | |
39 | ||
40 | if not Settings.test_only: | |
41 | runtime_matrix_basic_listing = test_matrix_basic_listing | |
42 | else: | |
43 | for tup in test_matrix_basic_listing: | |
44 | if (tup[0] in Settings.test_only or tup[1] in | |
45 | Settings.test_only): | |
46 | runtime_matrix_basic_listing.append(tup) | |
47 | ||
48 | @pytest.mark.parametrize("client_label,tools_label,outcome", runtime_matrix_basic_listing) | |
49 | def test_tools_liblttng_ctl_vs_sessiond_basic_listing(tmpdir, client_label, tools_label, outcome): | |
50 | ||
51 | # Prepare environment | |
52 | client = ProjectFactory.get_precook(client_label) | |
53 | tools = ProjectFactory.get_precook(tools_label) | |
54 | ||
55 | tools_runtime_path = os.path.join(str(tmpdir), "tools") | |
56 | ||
57 | lttng_client = os.path.join(client.installation_path, "bin/lttng") | |
58 | ||
59 | with Run.get_runtime(tools_runtime_path) as runtime_tools: | |
60 | runtime_tools.add_project(tools) | |
61 | ||
62 | sessiond = utils.sessiond_spawn(runtime_tools) | |
63 | ||
64 | cp, out, err = runtime_tools.run('{} create trace'.format(lttng_client), check_return=False) | |
65 | if outcome == "Missing symbol": | |
66 | assert(cp.returncode != 0) | |
67 | assert(utils.file_contains(err, "Missing symbol")) | |
68 | return | |
69 | ||
70 | assert(cp.returncode == 0) | |
71 | ||
72 | runtime_tools.run('lttng enable-event -u tp:tptest') | |
73 | runtime_tools.run('lttng start') | |
74 | ||
75 | # Stop tracing | |
76 | runtime_tools.run('lttng stop') | |
77 | runtime_tools.run('lttng destroy -a') | |
78 | cp = runtime_tools.subprocess_terminate(sessiond) | |
79 | if cp.returncode != 0: | |
80 | pytest.fail("Sessiond return code") |