aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2017-05-03 13:09:25 -0700
committerGravatar GitHub <noreply@github.com>2017-05-03 13:09:25 -0700
commit98e8d59ece3cd24cec29c2d6b4928bf0409c13e3 (patch)
tree7df414addc721daaeb805f1d8adcf23b620fe718 /test
parente325f7717b799a99dbde78da4ae53ccd8a6130ec (diff)
parent13ded3fc66a463497982597b75064d246b01df79 (diff)
Merge pull request #10953 from markdroth/cq_verifier_improvement
Improve cq_verifier error message when success does not match.
Diffstat (limited to 'test')
-rw-r--r--test/core/end2end/cq_verifier.c45
1 files changed, 27 insertions, 18 deletions
diff --git a/test/core/end2end/cq_verifier.c b/test/core/end2end/cq_verifier.c
index 9b0106ec84..5eea5d43fe 100644
--- a/test/core/end2end/cq_verifier.c
+++ b/test/core/end2end/cq_verifier.c
@@ -189,23 +189,6 @@ int byte_buffer_eq_string(grpc_byte_buffer *bb, const char *str) {
return res;
}
-static void verify_matches(expectation *e, grpc_event *ev) {
- GPR_ASSERT(e->type == ev->type);
- switch (e->type) {
- case GRPC_QUEUE_SHUTDOWN:
- gpr_log(GPR_ERROR, "premature queue shutdown");
- abort();
- break;
- case GRPC_OP_COMPLETE:
- GPR_ASSERT(e->success == ev->success);
- break;
- case GRPC_QUEUE_TIMEOUT:
- gpr_log(GPR_ERROR, "not implemented");
- abort();
- break;
- }
-}
-
static void expectation_to_strvec(gpr_strvec *buf, expectation *e) {
char *tmp;
@@ -214,7 +197,7 @@ static void expectation_to_strvec(gpr_strvec *buf, expectation *e) {
switch (e->type) {
case GRPC_OP_COMPLETE:
- gpr_asprintf(&tmp, "GRPC_OP_COMPLETE result=%d %s:%d", e->success,
+ gpr_asprintf(&tmp, "GRPC_OP_COMPLETE success=%d %s:%d", e->success,
e->file, e->line);
gpr_strvec_add(buf, tmp);
break;
@@ -248,6 +231,32 @@ static void fail_no_event_received(cq_verifier *v) {
abort();
}
+static void verify_matches(expectation *e, grpc_event *ev) {
+ GPR_ASSERT(e->type == ev->type);
+ switch (e->type) {
+ case GRPC_OP_COMPLETE:
+ if (e->success != ev->success) {
+ gpr_strvec expected;
+ gpr_strvec_init(&expected);
+ expectation_to_strvec(&expected, e);
+ char *s = gpr_strvec_flatten(&expected, NULL);
+ gpr_strvec_destroy(&expected);
+ gpr_log(GPR_ERROR, "actual success does not match expected: %s", s);
+ gpr_free(s);
+ abort();
+ }
+ break;
+ case GRPC_QUEUE_SHUTDOWN:
+ gpr_log(GPR_ERROR, "premature queue shutdown");
+ abort();
+ break;
+ case GRPC_QUEUE_TIMEOUT:
+ gpr_log(GPR_ERROR, "not implemented");
+ abort();
+ break;
+ }
+}
+
void cq_verify(cq_verifier *v) {
const gpr_timespec deadline = grpc_timeout_seconds_to_deadline(10);
while (v->first_expectation != NULL) {