When you create a trace object with bt_ctf_trace_create(), its native
byte order is set to BT_CTF_BYTE_ORDER_NATIVE, which essentially means
"unset". Before freezing the trace (which only happens in
bt_ctf_trace_add_stream_class()), make sure that the trace's native byte
order is a real byte order, not still BT_CTF_BYTE_ORDER_NATIVE (unset).
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
goto end;
}
+ /*
+ * At the end of this function we freeze the trace, so its
+ * native byte order must NOT be BT_CTF_BYTE_ORDER_NATIVE.
+ */
+ if (trace->native_byte_order == BT_CTF_BYTE_ORDER_NATIVE) {
+ ret = -1;
+ goto end;
+ }
+
current_parent_trace = bt_ctf_stream_class_get_trace(stream_class);
if (current_parent_trace) {
/* Stream class is already associated to a trace, abort. */
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");
goto error;
}
+ 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) {
#include <babeltrace/ctf-ir/visitor.h>
#include <stdlib.h>
#include <string.h>
+#include <assert.h>
#define NR_TESTS 13
goto end;
}
+ 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;