Fix: out-of-tree build
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 9 Jun 2017 21:24:27 +0000 (17:24 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 9 Jun 2017 21:50:37 +0000 (17:50 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
configure.ac
tests/lib/writer/Makefile.am
tests/lib/writer/test_ctf_writer_empty_packet.py [deleted file]
tests/lib/writer/test_ctf_writer_empty_packet.py.in [new file with mode: 0644]
tests/lib/writer/test_ctf_writer_no_packet_context.py [deleted file]
tests/lib/writer/test_ctf_writer_no_packet_context.py.in [new file with mode: 0644]

index 68efa882e5d10891818b595e6240181b6feeb849..bf0c7e10ae7d4929f789790bc8482d4b3c59304c 100644 (file)
@@ -541,6 +541,8 @@ AC_CONFIG_FILES([tests/cli/test_trace_read], [chmod +x tests/cli/test_trace_read
 AC_CONFIG_FILES([tests/cli/intersection/test_intersection], [chmod +x tests/cli/intersection/test_intersection])
 AC_CONFIG_FILES([tests/cli/intersection/bt_python_helper.py])
 AC_CONFIG_FILES([tests/lib/writer/bt_python_helper.py])
+AC_CONFIG_FILES([tests/lib/writer/test_ctf_writer_empty_packet.py])
+AC_CONFIG_FILES([tests/lib/writer/test_ctf_writer_no_packet_context.py])
 AC_CONFIG_FILES([tests/cli/test_packet_seq_num], [chmod +x tests/cli/test_packet_seq_num])
 
 AS_IF([test "x$enable_python" = "xyes"], [
index 073148796a23f97fd2bd48a0a4687145a433d613..3d3a320ac0a6e5b7a18296173bea8fb5644114b2 100644 (file)
@@ -1,16 +1,2 @@
 check_SCRIPTS = test_ctf_writer_no_packet_context.py \
        test_ctf_writer_empty_packet.py
-
-all-local:
-       @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
-               for script in $(check_SCRIPTS); do \
-                       cp -f $(srcdir)/$$script $(builddir); \
-               done; \
-       fi
-
-clean-local:
-       @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
-               for script in $(check_SCRIPTS); do \
-                       rm -f $(builddir)/$$script; \
-               done; \
-       fi
diff --git a/tests/lib/writer/test_ctf_writer_empty_packet.py b/tests/lib/writer/test_ctf_writer_empty_packet.py
deleted file mode 100755 (executable)
index c5b6acb..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-#!/usr/bin/env python3
-#
-# The MIT License (MIT)
-#
-# Copyright (C) 2017 - Jérémie Galarneau <jeremie.galarneau@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 bt_python_helper
-import tempfile
-import babeltrace.writer as btw
-import babeltrace.reader as btr
-import shutil
-import uuid
-
-TEST_COUNT = 4
-EXPECTED_EVENT_COUNT = 10
-trace_path = tempfile.mkdtemp()
-
-
-def print_test_result(test_number, result, description):
-        result_string = 'ok' if result else 'not ok'
-        result_string += ' {} - {}'.format(test_number, description)
-        print(result_string)
-
-def create_trace(path):
-        trace = btw.Writer(path)
-        clock = btw.Clock('test_clock')
-        trace.add_clock(clock)
-
-        integer_field_type = btw.IntegerFieldDeclaration(32)
-
-        event_class = btw.EventClass('simple_event')
-        event_class.add_field(integer_field_type, 'int_field')
-
-        stream_class = btw.StreamClass('empty_packet_stream')
-        stream_class.add_event_class(event_class)
-        stream_class.clock = clock
-
-        stream = trace.create_stream(stream_class)
-
-        for i in range(EXPECTED_EVENT_COUNT):
-                event = btw.Event(event_class)
-                event.payload('int_field').value = i
-                stream.append_event(event)
-        stream.flush()
-        print_test_result(1, True,
-                          'Flush a packet containing {} events'.format(EXPECTED_EVENT_COUNT))
-
-        # The CTF writer will not be able to populate the packet context's
-        # timestamp_begin and timestamp_end fields if it is asked to flush
-        # without any queued events.
-        try:
-            stream.flush()
-            empty_flush_succeeded = True
-        except ValueError:
-            empty_flush_succeeded = False
-
-        print_test_result(2, not empty_flush_succeeded,
-                          'Flushing an empty packet without explicitly setting packet time bounds should fail')
-        packet_context = stream.packet_context
-        packet_context.field('timestamp_begin').value = 1
-        packet_context.field('timestamp_end').value = 123456
-        try:
-            stream.flush()
-            empty_flush_succeeded = True
-        except ValueError:
-            empty_flush_succeeded = False
-
-        print_test_result(3, empty_flush_succeeded,
-                          'Flushing an empty packet after explicitly setting packet time bounds should succeed')
-
-
-# TAP plan
-print('1..{}'.format(TEST_COUNT))
-print('# Creating trace at {}'.format(trace_path))
-create_trace(trace_path)
-
-traces = btr.TraceCollection()
-trace_handle = traces.add_trace(trace_path, 'ctf')
-if trace_handle is None:
-        print('Failed to open trace at {}'.format(trace_path))
-
-event_count = 0
-for event in traces.events:
-        event_count += 1
-
-print_test_result(4, EXPECTED_EVENT_COUNT == event_count,
-                  'Trace was found to contain {} events, expected {}'.format(
-                   event_count, EXPECTED_EVENT_COUNT))
-
-shutil.rmtree(trace_path)
diff --git a/tests/lib/writer/test_ctf_writer_empty_packet.py.in b/tests/lib/writer/test_ctf_writer_empty_packet.py.in
new file mode 100644 (file)
index 0000000..c5b6acb
--- /dev/null
@@ -0,0 +1,108 @@
+#!/usr/bin/env python3
+#
+# The MIT License (MIT)
+#
+# Copyright (C) 2017 - Jérémie Galarneau <jeremie.galarneau@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 bt_python_helper
+import tempfile
+import babeltrace.writer as btw
+import babeltrace.reader as btr
+import shutil
+import uuid
+
+TEST_COUNT = 4
+EXPECTED_EVENT_COUNT = 10
+trace_path = tempfile.mkdtemp()
+
+
+def print_test_result(test_number, result, description):
+        result_string = 'ok' if result else 'not ok'
+        result_string += ' {} - {}'.format(test_number, description)
+        print(result_string)
+
+def create_trace(path):
+        trace = btw.Writer(path)
+        clock = btw.Clock('test_clock')
+        trace.add_clock(clock)
+
+        integer_field_type = btw.IntegerFieldDeclaration(32)
+
+        event_class = btw.EventClass('simple_event')
+        event_class.add_field(integer_field_type, 'int_field')
+
+        stream_class = btw.StreamClass('empty_packet_stream')
+        stream_class.add_event_class(event_class)
+        stream_class.clock = clock
+
+        stream = trace.create_stream(stream_class)
+
+        for i in range(EXPECTED_EVENT_COUNT):
+                event = btw.Event(event_class)
+                event.payload('int_field').value = i
+                stream.append_event(event)
+        stream.flush()
+        print_test_result(1, True,
+                          'Flush a packet containing {} events'.format(EXPECTED_EVENT_COUNT))
+
+        # The CTF writer will not be able to populate the packet context's
+        # timestamp_begin and timestamp_end fields if it is asked to flush
+        # without any queued events.
+        try:
+            stream.flush()
+            empty_flush_succeeded = True
+        except ValueError:
+            empty_flush_succeeded = False
+
+        print_test_result(2, not empty_flush_succeeded,
+                          'Flushing an empty packet without explicitly setting packet time bounds should fail')
+        packet_context = stream.packet_context
+        packet_context.field('timestamp_begin').value = 1
+        packet_context.field('timestamp_end').value = 123456
+        try:
+            stream.flush()
+            empty_flush_succeeded = True
+        except ValueError:
+            empty_flush_succeeded = False
+
+        print_test_result(3, empty_flush_succeeded,
+                          'Flushing an empty packet after explicitly setting packet time bounds should succeed')
+
+
+# TAP plan
+print('1..{}'.format(TEST_COUNT))
+print('# Creating trace at {}'.format(trace_path))
+create_trace(trace_path)
+
+traces = btr.TraceCollection()
+trace_handle = traces.add_trace(trace_path, 'ctf')
+if trace_handle is None:
+        print('Failed to open trace at {}'.format(trace_path))
+
+event_count = 0
+for event in traces.events:
+        event_count += 1
+
+print_test_result(4, EXPECTED_EVENT_COUNT == event_count,
+                  'Trace was found to contain {} events, expected {}'.format(
+                   event_count, EXPECTED_EVENT_COUNT))
+
+shutil.rmtree(trace_path)
diff --git a/tests/lib/writer/test_ctf_writer_no_packet_context.py b/tests/lib/writer/test_ctf_writer_no_packet_context.py
deleted file mode 100755 (executable)
index 8d9a7a7..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/usr/bin/env python3
-#
-# The MIT License (MIT)
-#
-# Copyright (C) 2017 - Jérémie Galarneau <jeremie.galarneau@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 bt_python_helper
-import tempfile
-import babeltrace.writer as btw
-import babeltrace.reader as btr
-import shutil
-import uuid
-
-TEST_COUNT = 4
-EXPECTED_EVENT_COUNT = 10
-trace_path = tempfile.mkdtemp()
-
-
-def print_test_result(test_number, result, description):
-        result_string = 'ok' if result else 'not ok'
-        result_string += ' {} - {}'.format(test_number, description)
-        print(result_string)
-
-def create_trace(path):
-        trace = btw.Writer(path)
-        clock = btw.Clock('test_clock')
-        trace.add_clock(clock)
-
-        integer_field_type = btw.IntegerFieldDeclaration(32)
-
-        event_class = btw.EventClass('simple_event')
-        event_class.add_field(integer_field_type, 'int_field')
-
-        stream_class = btw.StreamClass('test_stream')
-        stream_class.add_event_class(event_class)
-        stream_class.clock = clock
-
-        stream_class.packet_context_type = None
-        print_test_result(1, stream_class.packet_context_type is None,
-                          'Set stream class packet context type to None')
-
-        stream = trace.create_stream(stream_class)
-
-        for i in range(EXPECTED_EVENT_COUNT):
-                event = btw.Event(event_class)
-                event.payload('int_field').value = i
-                stream.append_event(event)
-        stream.flush()
-        print_test_result(2, True,
-                          'Flush a packet')
-
-        # It is not valid for a stream to contain more than one packet
-        # if it does not have content_size/packet_size info in its packet
-        # context
-        event = btw.Event(event_class)
-        event.payload('int_field').value = 42
-        stream.append_event(event)
-        try:
-            stream.flush()
-            second_flush_succeeded = True
-        except ValueError:
-            second_flush_succeeded = False
-
-        print_test_result(3, not second_flush_succeeded,
-                          'Flushing a second packet in a stream without a defined packet context fails')
-
-
-# TAP plan
-print('1..{}'.format(TEST_COUNT))
-print('# Creating trace at {}'.format(trace_path))
-create_trace(trace_path)
-
-traces = btr.TraceCollection()
-trace_handle = traces.add_trace(trace_path, 'ctf')
-if trace_handle is None:
-        print('Failed to open trace at {}'.format(trace_path))
-
-event_count = 0
-for event in traces.events:
-        event_count += 1
-
-print_test_result(4, EXPECTED_EVENT_COUNT == event_count,
-                  'Trace was found to contain {} events, expected {}'.format(
-                   event_count, EXPECTED_EVENT_COUNT))
-
-shutil.rmtree(trace_path)
diff --git a/tests/lib/writer/test_ctf_writer_no_packet_context.py.in b/tests/lib/writer/test_ctf_writer_no_packet_context.py.in
new file mode 100644 (file)
index 0000000..8d9a7a7
--- /dev/null
@@ -0,0 +1,104 @@
+#!/usr/bin/env python3
+#
+# The MIT License (MIT)
+#
+# Copyright (C) 2017 - Jérémie Galarneau <jeremie.galarneau@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 bt_python_helper
+import tempfile
+import babeltrace.writer as btw
+import babeltrace.reader as btr
+import shutil
+import uuid
+
+TEST_COUNT = 4
+EXPECTED_EVENT_COUNT = 10
+trace_path = tempfile.mkdtemp()
+
+
+def print_test_result(test_number, result, description):
+        result_string = 'ok' if result else 'not ok'
+        result_string += ' {} - {}'.format(test_number, description)
+        print(result_string)
+
+def create_trace(path):
+        trace = btw.Writer(path)
+        clock = btw.Clock('test_clock')
+        trace.add_clock(clock)
+
+        integer_field_type = btw.IntegerFieldDeclaration(32)
+
+        event_class = btw.EventClass('simple_event')
+        event_class.add_field(integer_field_type, 'int_field')
+
+        stream_class = btw.StreamClass('test_stream')
+        stream_class.add_event_class(event_class)
+        stream_class.clock = clock
+
+        stream_class.packet_context_type = None
+        print_test_result(1, stream_class.packet_context_type is None,
+                          'Set stream class packet context type to None')
+
+        stream = trace.create_stream(stream_class)
+
+        for i in range(EXPECTED_EVENT_COUNT):
+                event = btw.Event(event_class)
+                event.payload('int_field').value = i
+                stream.append_event(event)
+        stream.flush()
+        print_test_result(2, True,
+                          'Flush a packet')
+
+        # It is not valid for a stream to contain more than one packet
+        # if it does not have content_size/packet_size info in its packet
+        # context
+        event = btw.Event(event_class)
+        event.payload('int_field').value = 42
+        stream.append_event(event)
+        try:
+            stream.flush()
+            second_flush_succeeded = True
+        except ValueError:
+            second_flush_succeeded = False
+
+        print_test_result(3, not second_flush_succeeded,
+                          'Flushing a second packet in a stream without a defined packet context fails')
+
+
+# TAP plan
+print('1..{}'.format(TEST_COUNT))
+print('# Creating trace at {}'.format(trace_path))
+create_trace(trace_path)
+
+traces = btr.TraceCollection()
+trace_handle = traces.add_trace(trace_path, 'ctf')
+if trace_handle is None:
+        print('Failed to open trace at {}'.format(trace_path))
+
+event_count = 0
+for event in traces.events:
+        event_count += 1
+
+print_test_result(4, EXPECTED_EVENT_COUNT == event_count,
+                  'Trace was found to contain {} events, expected {}'.format(
+                   event_count, EXPECTED_EVENT_COUNT))
+
+shutil.rmtree(trace_path)
This page took 0.029842 seconds and 4 git commands to generate.