From 5c565c458535db2728ba850272f0d9ad4e92d748 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Tue, 30 May 2017 18:47:31 -0400 Subject: [PATCH] tests/lib: do not call bt_ctf_trace_set_native_byte_order() if not needed MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It's not mandatory anymore to call bt_ctf_trace_set_native_byte_order() on a trace object before it's frozen. Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- tests/lib/test_bt_ctf_field_type_validation.c | 3 --- tests/lib/test_bt_notification_iterator.c | 3 --- tests/lib/test_ctf_ir_ref.c | 3 --- tests/lib/test_ctf_writer.c | 14 ++++++-------- tests/lib/test_ir_visit.c | 3 --- 5 files changed, 6 insertions(+), 20 deletions(-) diff --git a/tests/lib/test_bt_ctf_field_type_validation.c b/tests/lib/test_bt_ctf_field_type_validation.c index dd1ed7b6c..ab1f782fb 100644 --- a/tests/lib/test_bt_ctf_field_type_validation.c +++ b/tests/lib/test_bt_ctf_field_type_validation.c @@ -2070,9 +2070,6 @@ void test_pass(void) trace = bt_ctf_trace_create(); assert(trace); - ret = bt_ctf_trace_set_native_byte_order(trace, - BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); - assert(ret == 0); sc = bt_ctf_stream_class_create("nice_piece_of_stream_class"); assert(sc); ec = bt_ctf_event_class_create("oh_what_an_event_class"); diff --git a/tests/lib/test_bt_notification_iterator.c b/tests/lib/test_bt_notification_iterator.c index 5ee5915bb..6ba999526 100644 --- a/tests/lib/test_bt_notification_iterator.c +++ b/tests/lib/test_bt_notification_iterator.c @@ -409,9 +409,6 @@ void init_static_data(void) assert(empty_struct_ft); trace = bt_ctf_trace_create(); assert(trace); - ret = bt_ctf_trace_set_native_byte_order(trace, - BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); - assert(ret == 0); ret = bt_ctf_trace_set_packet_header_type(trace, empty_struct_ft); assert(ret == 0); src_empty_cc_prio_map = bt_clock_class_priority_map_create(); diff --git a/tests/lib/test_ctf_ir_ref.c b/tests/lib/test_ctf_ir_ref.c index 60a8b5533..bf277b833 100644 --- a/tests/lib/test_ctf_ir_ref.c +++ b/tests/lib/test_ctf_ir_ref.c @@ -374,9 +374,6 @@ static struct bt_ctf_trace *create_tc1(void) } set_trace_packet_header(tc1); - ret = bt_ctf_trace_set_native_byte_order(tc1, - BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); - assert(ret == 0); sc1 = create_sc1(); ok(sc1, "Create SC1"); if (!sc1) { diff --git a/tests/lib/test_ctf_writer.c b/tests/lib/test_ctf_writer.c index 62a5f06b3..9a5f2e65b 100644 --- a/tests/lib/test_ctf_writer.c +++ b/tests/lib/test_ctf_writer.c @@ -51,7 +51,7 @@ #define METADATA_LINE_SIZE 512 #define SEQUENCE_TEST_LENGTH 10 #define ARRAY_TEST_LENGTH 5 -#define PACKET_RESIZE_TEST_LENGTH 100000 +#define PACKET_RESIZE_TEST_LENGTH 5 #define DEFAULT_CLOCK_FREQ 1000000000 #define DEFAULT_CLOCK_PRECISION 1 @@ -61,7 +61,7 @@ #define DEFAULT_CLOCK_TIME 0 #define DEFAULT_CLOCK_VALUE 0 -#define NR_TESTS 632 +#define NR_TESTS 634 static int64_t current_time = 42; @@ -2586,9 +2586,6 @@ void test_create_writer_vs_non_writer_mode(void) /* Create non-writer trace, stream class, stream, and clock */ non_writer_trace = bt_ctf_trace_create(); assert(non_writer_trace); - ret = bt_ctf_trace_set_native_byte_order(non_writer_trace, - BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); - assert(!ret); non_writer_sc = bt_ctf_stream_class_create("nonwriter_sc"); assert(non_writer_sc); ret = bt_ctf_stream_class_set_event_header_type(non_writer_sc, @@ -2783,9 +2780,6 @@ void test_static_trace(void) trace = bt_ctf_trace_create(); assert(trace); - ret = bt_ctf_trace_set_native_byte_order(trace, - BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); - assert(ret == 0); stream_class = bt_ctf_stream_class_create(NULL); assert(stream_class); ret = bt_ctf_stream_class_set_packet_context_type(stream_class, NULL); @@ -2982,6 +2976,10 @@ int main(int argc, char **argv) ok(!bt_ctf_writer_get_trace(NULL), "bt_ctf_writer_get_trace correctly handles NULL"); trace = bt_ctf_writer_get_trace(writer); + ok(bt_ctf_trace_set_native_byte_order(trace, BT_CTF_BYTE_ORDER_NATIVE), + "Cannot set a trace's byte order to BT_CTF_BYTE_ORDER_NATIVE"); + ok(bt_ctf_trace_set_native_byte_order(trace, BT_CTF_BYTE_ORDER_NONE), + "Cannot set a trace's byte order to BT_CTF_BYTE_ORDER_NONE"); ok(trace, "bt_ctf_writer_get_trace returns a bt_ctf_trace object"); ok(bt_ctf_trace_set_native_byte_order(trace, BT_CTF_BYTE_ORDER_BIG_ENDIAN) == 0, diff --git a/tests/lib/test_ir_visit.c b/tests/lib/test_ir_visit.c index 758efc2ff..2886dc940 100644 --- a/tests/lib/test_ir_visit.c +++ b/tests/lib/test_ir_visit.c @@ -174,9 +174,6 @@ struct bt_ctf_trace *init_trace(void) set_trace_packet_header(trace); set_stream_class_field_types(sc1); set_stream_class_field_types(sc2); - ret = bt_ctf_trace_set_native_byte_order(trace, - BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); - assert(ret == 0); ret = bt_ctf_stream_class_add_event_class(sc1, ec1); if (ret) { goto error; -- 2.34.1