#define DEFAULT_CLOCK_TIME 0
#define DEFAULT_CLOCK_VALUE 0
-#define NR_TESTS 607
+#define NR_TESTS 614
static int64_t current_time = 42;
bt_put(clock_class);
}
+static
+void test_trace_uuid(void)
+{
+ struct bt_ctf_trace *trace;
+ const unsigned char uuid[] = {
+ 0x35, 0x92, 0x63, 0xab, 0xb4, 0xbe, 0x40, 0xb4,
+ 0xb2, 0x60, 0xd3, 0xf1, 0x3b, 0xb0, 0xd8, 0x59,
+ };
+ const unsigned char *ret_uuid;
+
+ trace = bt_ctf_trace_create();
+ assert(trace);
+ ok(!bt_ctf_trace_get_uuid(NULL),
+ "bt_ctf_trace_get_uuid() handles NULL");
+ ok(!bt_ctf_trace_get_uuid(trace),
+ "bt_ctf_trace_get_uuid() returns NULL initially");
+ ok(bt_ctf_trace_set_uuid(NULL, uuid),
+ "bt_ctf_trace_set_uuid() handles NULL (trace)");
+ ok(bt_ctf_trace_set_uuid(trace, NULL),
+ "bt_ctf_trace_set_uuid() handles NULL (UUID)");
+ ok(bt_ctf_trace_set_uuid(trace, uuid) == 0,
+ "bt_ctf_trace_set_uuid() succeeds with a valid UUID");
+ ret_uuid = bt_ctf_trace_get_uuid(trace);
+ ok(ret_uuid, "bt_ctf_trace_get_uuid() returns a UUID");
+ ok(memcmp(uuid, ret_uuid, 16) == 0,
+ "bt_ctf_trace_get_uuid() returns the expected UUID");
+
+ bt_put(trace);
+}
+
int main(int argc, char **argv)
{
char trace_path[] = "/tmp/ctfwriter_XXXXXX";
"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,
"Set a trace's byte order to big endian");
- ok(bt_ctf_trace_get_byte_order(trace) == BT_CTF_BYTE_ORDER_BIG_ENDIAN,
- "bt_ctf_trace_get_byte_order returns a correct endianness");
+ ok(bt_ctf_trace_get_native_byte_order(trace) == BT_CTF_BYTE_ORDER_BIG_ENDIAN,
+ "bt_ctf_trace_get_native_byte_order returns a correct endianness");
/* Add environment context to the trace */
ret = gethostname(hostname, sizeof(hostname));
test_static_trace();
+ test_trace_uuid();
+
metadata_string = bt_ctf_writer_get_metadata_string(writer);
ok(metadata_string, "Get metadata string");