Licensing information
[deliverable/lttng-ivc.git] / lttng_ivc / tests / ust_app_vs_ust_tools / test_ust_app_vs_ust_tools.py
index 5eb331fe75f9b453c6bfa04efa63533c36b1ea8d..2190c4dcddf8c556caba19edd7da75f0cb310cf0 100644 (file)
@@ -1,3 +1,23 @@
+# Copyright (c) 2017 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
 import pytest
 import os
 import shutil
@@ -15,6 +35,10 @@ FC: Fully Compatible
 BC: Feature of the smallest version number will works.
 TU: Tracing unavailable
 
+NOTE: tracing between 2.7 and 2.8 should work but a problem with
+_ustctl_basic_type prevent event registration. Hence consider in further test
+that the event registration is expected to fail.
+
 +------------------------------------------------------------------------------+
 |              LTTng UST control protocol compatibility matrix                 |
 |   (between applications and tools linked on LTTng UST and liblttng-ust-ctl)  |
@@ -37,44 +61,27 @@ Second tuple member: lttng-tool label
 Third tuple member: expected scenario
 """
 
+event_registration_error = "Error: UST app recv reg unsupported version"
+
 test_matrix_tracing_available = [
-    ("lttng-ust-2.7", "lttng-tools-2.7",   True),
-    ("lttng-ust-2.7", "lttng-tools-2.8",   True),
-    ("lttng-ust-2.7", "lttng-tools-2.9",   False),
-    ("lttng-ust-2.7", "lttng-tools-2.10",  False),
-    ("lttng-ust-2.8", "lttng-tools-2.7",   True),
-    ("lttng-ust-2.8", "lttng-tools-2.8",   True),
-    ("lttng-ust-2.8", "lttng-tools-2.9",   False),
-    ("lttng-ust-2.8", "lttng-tools-2.10",  False),
-    ("lttng-ust-2.9", "lttng-tools-2.7",   False),
-    ("lttng-ust-2.9", "lttng-tools-2.8",   False),
-    ("lttng-ust-2.9", "lttng-tools-2.9",   True),
-    ("lttng-ust-2.9", "lttng-tools-2.10",  True),
-    ("lttng-ust-2.10", "lttng-tools-2.7",  False),
-    ("lttng-ust-2.10", "lttng-tools-2.8",  False),
-    ("lttng-ust-2.10", "lttng-tools-2.9",  True),
-    ("lttng-ust-2.10", "lttng-tools-2.10", True),
+    ("lttng-ust-2.7", "lttng-tools-2.7",   "Success"),
+    ("lttng-ust-2.7", "lttng-tools-2.8",   "Unsupported version"),
+    ("lttng-ust-2.7", "lttng-tools-2.9",   "Unsupported"),
+    ("lttng-ust-2.7", "lttng-tools-2.10",  "Unsupported"),
+    ("lttng-ust-2.8", "lttng-tools-2.7",   "Unsupported version"),
+    ("lttng-ust-2.8", "lttng-tools-2.8",   "Success"),
+    ("lttng-ust-2.8", "lttng-tools-2.9",   "Unsupported"),
+    ("lttng-ust-2.8", "lttng-tools-2.10",  "Unsupported"),
+    ("lttng-ust-2.9", "lttng-tools-2.7",   "Unsupported"),
+    ("lttng-ust-2.9", "lttng-tools-2.8",   "Unsupported"),
+    ("lttng-ust-2.9", "lttng-tools-2.9",   "Success"),
+    ("lttng-ust-2.9", "lttng-tools-2.10",  "Success"),
+    ("lttng-ust-2.10", "lttng-tools-2.7",  "Unsupported"),
+    ("lttng-ust-2.10", "lttng-tools-2.8",  "Unsupported"),
+    ("lttng-ust-2.10", "lttng-tools-2.9",  "Success"),
+    ("lttng-ust-2.10", "lttng-tools-2.10", "Success"),
 ]
 
-# Only consider test case for which tracing is valid
-test_matrix_app_context = [
-    ("lttng-ust-2.7", "lttng-tools-2.7",  ""),
-    ("lttng-ust-2.7", "lttng-tools-2.8",  ""),
-    ("lttng-ust-2.7", "lttng-tools-2.9",  ""),
-    ("lttng-ust-2.7", "lttng-tools-2.10", ""),
-    ("lttng-ust-2.8", "lttng-tools-2.7",  ""),
-    ("lttng-ust-2.8", "lttng-tools-2.8",  ""),
-    ("lttng-ust-2.8", "lttng-tools-2.9",  ""),
-    ("lttng-ust-2.8", "lttng-tools-2.10", ""),
-    ("lttng-ust-2.9", "lttng-tools-2.7",  ""),
-    ("lttng-ust-2.9", "lttng-tools-2.8",  ""),
-    ("lttng-ust-2.9", "lttng-tools-2.9",  ""),
-    ("lttng-ust-2.9", "lttng-tools-2.10", ""),
-    ("lttng-ust-2.10", "lttng-tools-2.7", ""),
-    ("lttng-ust-2.10", "lttng-tools-2.8", ""),
-    ("lttng-ust-2.10", "lttng-tools-2.9", ""),
-    ("lttng-ust-2.10", "lttng-tools-2.10", ""),
-]
 
 """
 Statedump are supported starting at lttng-ust >= 2.9.
@@ -97,7 +104,7 @@ test_matrix_starglobing_enabler = [
 
 runtime_matrix_tracing_available = []
 runtime_matrix_regen_statedump = []
-runtime_rix_starglobing_enabler = []
+runtime_matrix_starglobing_enabler = []
 
 if not Settings.test_only:
     runtime_matrix_tracing_available = test_matrix_tracing_available
@@ -118,12 +125,8 @@ else:
             runtime_matrix_starglobing_enabler.append(tup)
 
 
-@pytest.mark.parametrize("ust_label,tools_label, should_trace", runtime_matrix_tracing_available)
-def test_ust_app_tracing_available(tmpdir, ust_label, tools_label, should_trace):
-
-    if ((ust_label == "lttng-ust-2.7" and tools_label == "lttng-tools-2.8") or
-            (ust_label == "lttng-ust-2.8" and tools_label == "lttng-tools-2.7")):
-        pytest.xfail("Failing but should work, problem regarding the size of fields structure")
+@pytest.mark.parametrize("ust_label,tools_label,outcome", runtime_matrix_tracing_available)
+def test_ust_app_tracing_available(tmpdir, ust_label, tools_label, outcome):
 
     nb_events = 100
 
@@ -163,22 +166,23 @@ def test_ust_app_tracing_available(tmpdir, ust_label, tools_label, should_trace)
         runtime_app.run(cmd, cwd=app_path)
 
         # Stop tracing
+        runtime_tools.run('lttng stop')
         runtime_tools.run('lttng destroy -a')
         cp = runtime_tools.subprocess_terminate(sessiond)
         if cp.returncode != 0:
             pytest.fail("Sessiond return code")
 
-        try:
-            # Read trace with babeltrace and check for event count via number of line
-            cmd = 'babeltrace {}'.format(trace_path)
+
+        cmd = 'babeltrace {}'.format(trace_path)
+        if outcome == "Success":
             cp_process, cp_out, cp_err = runtime_tools.run(cmd)
             assert(utils.line_count(cp_out) == nb_events)
-        except subprocess.CalledProcessError as e:
-            # Check if we expected a problem here
-            if should_trace:
-                # Something happened
-                raise e
-
+        else:
+            with pytest.raises(subprocess.CalledProcessError):
+                cp_process, cp_out, cp_err = runtime_tools.run(cmd)
+            if outcome == "Unsupported version":
+                assert(utils.file_contains(runtime_tools.get_subprocess_stderr_path(sessiond),
+                                           [event_registration_error]))
 
 @pytest.mark.parametrize("ust_label,tools_label, success", runtime_matrix_regen_statedump)
 def test_ust_app_regen_statedump(tmpdir, ust_label, tools_label, success):
@@ -238,6 +242,7 @@ def test_ust_app_regen_statedump(tmpdir, ust_label, tools_label, success):
         utils.create_empty_file(app_sync_end)
 
         # Stop tracing
+        runtime_tools.run('lttng stop')
         runtime_tools.run('lttng destroy -a')
         cp = runtime_tools.subprocess_terminate(sessiond)
         if cp.returncode != 0:
@@ -306,6 +311,7 @@ def test_ust_app_starglobing_enabler(tmpdir, ust_label, tools_label, scenario):
         runtime_app.run(cmd, cwd=app_path)
 
         # Stop tracing
+        runtime_tools.run('lttng stop')
         runtime_tools.run('lttng destroy -a')
         cp = runtime_tools.subprocess_terminate(sessiond)
         if cp.returncode != 0:
This page took 0.027484 seconds and 5 git commands to generate.