Generate trace for intersect mode test
authorJulien Desfossez <jdesfossez@efficios.com>
Fri, 22 Apr 2016 21:35:19 +0000 (17:35 -0400)
committerAntoine Busque <abusque@efficios.com>
Fri, 29 Apr 2016 20:12:11 +0000 (16:12 -0400)
This is a basic trace generated to test the intersect mode. The first
three events are in the same stream, the last one is in a different
stream with no overlapping. This trace parsed with babeltrace outputs 4
events by default and 0 with babeltrace --stream-intersection.

Please adapt the test to work with the --disable-intersect-mode.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
tests/integration/expected/disable_intersect.txt [new file with mode: 0644]
tests/integration/expected/no_intersection.txt [new file with mode: 0644]
tests/integration/test_intersect.py [new file with mode: 0644]

diff --git a/tests/integration/expected/disable_intersect.txt b/tests/integration/expected/disable_intersect.txt
new file mode 100644 (file)
index 0000000..aa1dacf
--- /dev/null
@@ -0,0 +1,5 @@
+Timerange: [1970-01-01 00:00:01.005000000, 1970-01-01 00:00:01.010000000]
+Soft IRQ                                             Duration (us)                                        Raise latency (us)
+                       count          min          avg          max        stdev  |  count          min          avg          max        stdev       
+----------------------------------------------------------------------------------|------------------------------------------------------------
+1:  <TIMER_SOFTIRQ>        1     3000.000     3000.000     3000.000            ?  |      1     1000.000     1000.000     1000.000            ?
\ No newline at end of file
diff --git a/tests/integration/expected/no_intersection.txt b/tests/integration/expected/no_intersection.txt
new file mode 100644 (file)
index 0000000..a7182c3
--- /dev/null
@@ -0,0 +1 @@
+Error: Trace has no intersection. Use --disable-intersect-mode to override
\ No newline at end of file
diff --git a/tests/integration/test_intersect.py b/tests/integration/test_intersect.py
new file mode 100644 (file)
index 0000000..2e11bc0
--- /dev/null
@@ -0,0 +1,53 @@
+# The MIT License (MIT)
+#
+# Copyright (C) 2016 - Julien Desfossez <jdesfossez@efficios.com>
+#                      Antoine Busque <abusque@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.
+
+from .analysis_test import AnalysisTest
+
+
+class IntersectTest(AnalysisTest):
+    def write_trace(self):
+        # Write these events in the default stream.
+        self.trace_writer.write_softirq_raise(1005, 3, 1)
+        self.trace_writer.write_softirq_entry(1006, 3, 1)
+        self.trace_writer.write_softirq_exit(1009, 3, 1)
+
+        # Override the default stream, so all new events are written
+        # in a different stream, no overlapping timestamps between streams.
+        self.trace_writer.create_stream()
+        self.trace_writer.write_softirq_exit(1010, 2, 7)
+        self.trace_writer.flush()
+
+    def test_no_intersection(self):
+        test_name = 'no_intersection'
+        expected = self.get_expected_output(test_name)
+        result = self.get_cmd_output('lttng-irqstats')
+
+        self._assertMultiLineEqual(result, expected, test_name)
+
+    def test_disable_intersect(self):
+        test_name = 'disable_intersect'
+        expected = self.get_expected_output(test_name)
+        result = self.get_cmd_output('lttng-irqstats',
+                                     options='--disable-intersect-mode')
+
+        self._assertMultiLineEqual(result, expected, test_name)
This page took 0.024421 seconds and 5 git commands to generate.