+ /* Add a custom trace packet header field */
+ ok(bt_ctf_trace_get_packet_header_type(NULL) == NULL,
+ "bt_ctf_trace_get_packet_header_type handles NULL correctly");
+ packet_header_type = bt_ctf_trace_get_packet_header_type(trace);
+ ok(packet_header_type,
+ "bt_ctf_trace_get_packet_header_type returns a packet header");
+ ok(bt_ctf_field_type_get_type_id(packet_header_type) == CTF_TYPE_STRUCT,
+ "bt_ctf_trace_get_packet_header_type returns a packet header of type struct");
+ ret_field_type = bt_ctf_field_type_structure_get_field_type_by_name(
+ packet_header_type, "magic");
+ ok(ret_field_type, "Default packet header type contains a \"magic\" field");
+ bt_ctf_field_type_put(ret_field_type);
+ ret_field_type = bt_ctf_field_type_structure_get_field_type_by_name(
+ packet_header_type, "uuid");
+ ok(ret_field_type, "Default packet header type contains a \"uuid\" field");
+ bt_ctf_field_type_put(ret_field_type);
+ ret_field_type = bt_ctf_field_type_structure_get_field_type_by_name(
+ packet_header_type, "stream_id");
+ ok(ret_field_type, "Default packet header type contains a \"stream_id\" field");
+ bt_ctf_field_type_put(ret_field_type);
+
+ packet_header_field_type = bt_ctf_field_type_integer_create(22);
+ ok(!bt_ctf_field_type_structure_add_field(packet_header_type,
+ packet_header_field_type, "custom_trace_packet_header_field"),
+ "Added a custom trace packet header field successfully");
+
+ ok(bt_ctf_trace_set_packet_header_type(NULL, packet_header_type) < 0,
+ "bt_ctf_trace_set_packet_header_type handles a NULL trace correctly");
+ ok(bt_ctf_trace_set_packet_header_type(trace, NULL) < 0,
+ "bt_ctf_trace_set_packet_header_type handles a NULL packet_header_type correctly");
+ ok(!bt_ctf_trace_set_packet_header_type(trace, packet_header_type),
+ "Set a trace packet_header_type successfully");
+