From 714f176b65edb418a0df25878d1134992e987166 Mon Sep 17 00:00:00 2001 From: Snaipe Date: Fri, 15 Jan 2016 17:37:44 +0100 Subject: [PATCH] Added test name in birth messages and made the subtest name optional in phase messages --- src/core/runner.c | 2 +- src/protocol/criterion.pb.c | 9 +++++---- src/protocol/criterion.pb.h | 13 +++++++------ src/protocol/criterion.proto | 5 +++-- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/core/runner.c b/src/core/runner.c index 8141e5b..0d7319f 100644 --- a/src/core/runner.c +++ b/src/core/runner.c @@ -179,7 +179,7 @@ void run_test_child(struct criterion_test *test, } // Notify the runner that the test was born - criterion_protocol_msg msg = criterion_message(birth, .has_timestamp = false); + criterion_protocol_msg msg = criterion_message(birth, .name = (char *) test->name); criterion_message_set_id(msg); cr_send_to_runner(&msg); diff --git a/src/protocol/criterion.pb.c b/src/protocol/criterion.pb.c index f41a707..746a8fb 100644 --- a/src/protocol/criterion.pb.c +++ b/src/protocol/criterion.pb.c @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.3.5-dev at Mon Jan 11 19:14:39 2016. */ +/* Generated by nanopb-0.3.5-dev at Fri Jan 15 17:34:02 2016. */ #include "criterion.pb.h" @@ -10,14 +10,15 @@ const int32_t criterion_protocol_msg_version_default = 1; -const pb_field_t criterion_protocol_birth_fields[2] = { - PB_FIELD( 1, INT64 , OPTIONAL, STATIC , FIRST, criterion_protocol_birth, timestamp, timestamp, 0), +const pb_field_t criterion_protocol_birth_fields[3] = { + PB_FIELD( 1, STRING , REQUIRED, POINTER , FIRST, criterion_protocol_birth, name, name, 0), + PB_FIELD( 2, INT64 , OPTIONAL, STATIC , OTHER, criterion_protocol_birth, timestamp, name, 0), PB_LAST_FIELD }; const pb_field_t criterion_protocol_phase_fields[5] = { PB_FIELD( 1, UENUM , REQUIRED, STATIC , FIRST, criterion_protocol_phase, phase, phase, 0), - PB_FIELD( 2, STRING , REQUIRED, POINTER , OTHER, criterion_protocol_phase, name, phase, 0), + PB_FIELD( 2, STRING , OPTIONAL, POINTER , OTHER, criterion_protocol_phase, name, phase, 0), PB_FIELD( 3, INT64 , OPTIONAL, STATIC , OTHER, criterion_protocol_phase, timestamp, name, 0), PB_FIELD( 4, STRING , OPTIONAL, POINTER , OTHER, criterion_protocol_phase, message, timestamp, 0), PB_LAST_FIELD diff --git a/src/protocol/criterion.pb.h b/src/protocol/criterion.pb.h index c9b29f1..c4eb186 100644 --- a/src/protocol/criterion.pb.h +++ b/src/protocol/criterion.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.3.5-dev at Mon Jan 11 19:14:39 2016. */ +/* Generated by nanopb-0.3.5-dev at Fri Jan 15 17:34:02 2016. */ #ifndef PB_CRITERION_PB_H_INCLUDED #define PB_CRITERION_PB_H_INCLUDED @@ -48,6 +48,7 @@ typedef struct _criterion_protocol_assert { } criterion_protocol_assert; typedef struct _criterion_protocol_birth { + char *name; bool has_timestamp; int64_t timestamp; } criterion_protocol_birth; @@ -100,7 +101,7 @@ typedef struct _criterion_protocol_msg { extern const int32_t criterion_protocol_msg_version_default; /* Initializer values for message structs */ -#define criterion_protocol_birth_init_default {false, 0} +#define criterion_protocol_birth_init_default {NULL, false, 0} #define criterion_protocol_phase_init_default {(criterion_protocol_phase_kind)0, NULL, false, 0, NULL} #define criterion_protocol_death_init_default {(criterion_protocol_death_result_type)0, false, 0, false, 0} #define criterion_protocol_assert_init_default {NULL, 0, NULL, false, 0} @@ -108,7 +109,7 @@ extern const int32_t criterion_protocol_msg_version_default; #define criterion_protocol_ack_init_default {(criterion_protocol_ack_status)0, NULL} #define criterion_protocol_submessage_init_default {0, {criterion_protocol_birth_init_default}} #define criterion_protocol_msg_init_default {1, 0, {0}, criterion_protocol_submessage_init_default} -#define criterion_protocol_birth_init_zero {false, 0} +#define criterion_protocol_birth_init_zero {NULL, false, 0} #define criterion_protocol_phase_init_zero {(criterion_protocol_phase_kind)0, NULL, false, 0, NULL} #define criterion_protocol_death_init_zero {(criterion_protocol_death_result_type)0, false, 0, false, 0} #define criterion_protocol_assert_init_zero {NULL, 0, NULL, false, 0} @@ -124,7 +125,8 @@ extern const int32_t criterion_protocol_msg_version_default; #define criterion_protocol_assert_passed_tag 2 #define criterion_protocol_assert_file_tag 3 #define criterion_protocol_assert_line_tag 4 -#define criterion_protocol_birth_timestamp_tag 1 +#define criterion_protocol_birth_name_tag 1 +#define criterion_protocol_birth_timestamp_tag 2 #define criterion_protocol_death_result_tag 1 #define criterion_protocol_death_status_tag 2 #define criterion_protocol_death_timestamp_tag 3 @@ -146,7 +148,7 @@ extern const int32_t criterion_protocol_msg_version_default; #define criterion_protocol_msg_data_tag 16 /* Struct field encoding specification for nanopb */ -extern const pb_field_t criterion_protocol_birth_fields[2]; +extern const pb_field_t criterion_protocol_birth_fields[3]; extern const pb_field_t criterion_protocol_phase_fields[5]; extern const pb_field_t criterion_protocol_death_fields[4]; extern const pb_field_t criterion_protocol_assert_fields[5]; @@ -156,7 +158,6 @@ extern const pb_field_t criterion_protocol_submessage_fields[6]; extern const pb_field_t criterion_protocol_msg_fields[5]; /* Maximum encoded size of messages (where known) */ -#define criterion_protocol_birth_size 11 #define criterion_protocol_death_size 24 /* Message IDs (where set with "msgid" option) */ diff --git a/src/protocol/criterion.proto b/src/protocol/criterion.proto index 7a04d12..a2459a2 100644 --- a/src/protocol/criterion.proto +++ b/src/protocol/criterion.proto @@ -1,7 +1,8 @@ package criterion.protocol; message birth { - optional int64 timestamp = 1; + required string name = 1; + optional int64 timestamp = 2; } message phase { @@ -17,7 +18,7 @@ message phase { } required kind phase = 1; - required string name = 2; + optional string name = 2; optional int64 timestamp = 3; optional string message = 4; }