clang-format

pull/4453/head
Craig Tiller 9 years ago
parent 83399c99e5
commit 6cb69172c1
  1. 4
      test/core/bad_client/bad_client.c
  2. 6
      test/core/bad_client/bad_client.h
  3. 3
      test/core/bad_client/tests/badreq.c
  4. 3
      test/core/bad_client/tests/connection_prefix.c
  5. 3
      test/core/bad_client/tests/headers.c
  6. 3
      test/core/bad_client/tests/initial_settings_frame.c
  7. 93
      test/core/bad_client/tests/server_registered_method.c
  8. 6
      test/core/bad_client/tests/simple_request.c
  9. 3
      test/core/bad_client/tests/unknown_frame.c

@ -111,7 +111,9 @@ void grpc_run_bad_client_test(grpc_bad_client_server_side_validator validator,
gpr_event_init(&a.done_write);
a.validator = validator;
grpc_server_register_completion_queue(a.server, a.cq, NULL);
a.registered_method = grpc_server_register_method(a.server, GRPC_BAD_CLIENT_REGISTERED_METHOD, GRPC_BAD_CLIENT_REGISTERED_HOST);
a.registered_method =
grpc_server_register_method(a.server, GRPC_BAD_CLIENT_REGISTERED_METHOD,
GRPC_BAD_CLIENT_REGISTERED_HOST);
grpc_server_start(a.server);
transport = grpc_create_chttp2_transport(&exec_ctx, NULL, sfd.server, 0);
server_setup_transport(&a, transport);

@ -40,9 +40,9 @@
#define GRPC_BAD_CLIENT_REGISTERED_METHOD "/registered/bar"
#define GRPC_BAD_CLIENT_REGISTERED_HOST "localhost"
typedef void (*grpc_bad_client_server_side_validator)(
grpc_server *server, grpc_completion_queue *cq,
void *registered_method);
typedef void (*grpc_bad_client_server_side_validator)(grpc_server *server,
grpc_completion_queue *cq,
void *registered_method);
#define GRPC_BAD_CLIENT_DISCONNECT 1

@ -42,7 +42,8 @@
"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" \
"\x00\x00\x00\x04\x00\x00\x00\x00\x00" /* settings frame */
static void verifier(grpc_server *server, grpc_completion_queue *cq, void *registered_method) {
static void verifier(grpc_server *server, grpc_completion_queue *cq,
void *registered_method) {
while (grpc_server_has_open_connections(server)) {
GPR_ASSERT(grpc_completion_queue_next(cq,
GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20),

@ -34,7 +34,8 @@
#include "test/core/bad_client/bad_client.h"
#include "src/core/surface/server.h"
static void verifier(grpc_server *server, grpc_completion_queue *cq, void *registered_method) {
static void verifier(grpc_server *server, grpc_completion_queue *cq,
void *registered_method) {
while (grpc_server_has_open_connections(server)) {
GPR_ASSERT(grpc_completion_queue_next(cq,
GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20),

@ -38,7 +38,8 @@
"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" \
"\x00\x00\x00\x04\x00\x00\x00\x00\x00"
static void verifier(grpc_server *server, grpc_completion_queue *cq, void *registered_method) {
static void verifier(grpc_server *server, grpc_completion_queue *cq,
void *registered_method) {
while (grpc_server_has_open_connections(server)) {
GPR_ASSERT(grpc_completion_queue_next(cq,
GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20),

@ -37,7 +37,8 @@
#define PFX_STR "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
#define ONE_SETTING_HDR "\x00\x00\x06\x04\x00\x00\x00\x00\x00"
static void verifier(grpc_server *server, grpc_completion_queue *cq, void *registered_method) {
static void verifier(grpc_server *server, grpc_completion_queue *cq,
void *registered_method) {
while (grpc_server_has_open_connections(server)) {
GPR_ASSERT(grpc_completion_queue_next(cq,
GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20),

@ -38,22 +38,25 @@
#include "test/core/end2end/cq_verifier.h"
#include "src/core/surface/server.h"
#define PFX_STR \
"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" \
"\x00\x00\x00\x04\x00\x00\x00\x00\x00" /* settings frame */ \
"\x00\x00\xd0\x01\x04\x00\x00\x00\x01" \
"\x10\x05:path\x0f/registered/bar" \
"\x10\x07:scheme\x04http" \
"\x10\x07:method\x04POST" \
"\x10\x0a:authority\x09localhost" \
"\x10\x0c""content-type\x10""application/grpc" \
"\x10\x14grpc-accept-encoding\x15identity,deflate,gzip" \
"\x10\x02te\x08trailers" \
#define PFX_STR \
"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" \
"\x00\x00\x00\x04\x00\x00\x00\x00\x00" /* settings frame */ \
"\x00\x00\xd0\x01\x04\x00\x00\x00\x01" \
"\x10\x05:path\x0f/registered/bar" \
"\x10\x07:scheme\x04http" \
"\x10\x07:method\x04POST" \
"\x10\x0a:authority\x09localhost" \
"\x10\x0c" \
"content-type\x10" \
"application/grpc" \
"\x10\x14grpc-accept-encoding\x15identity,deflate,gzip" \
"\x10\x02te\x08trailers" \
"\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)"
static void *tag(gpr_intptr t) { return (void *)t; }
static void verifier_succeeds(grpc_server *server, grpc_completion_queue *cq, void *registered_method) {
static void verifier_succeeds(grpc_server *server, grpc_completion_queue *cq,
void *registered_method) {
grpc_call_error error;
grpc_call *s;
cq_verifier *cqv = cq_verifier_create(cq);
@ -63,8 +66,9 @@ static void verifier_succeeds(grpc_server *server, grpc_completion_queue *cq, vo
grpc_metadata_array_init(&request_metadata_recv);
error = grpc_server_request_registered_call(server, registered_method, &s, &deadline,
&request_metadata_recv, &payload, cq, cq, tag(101));
error = grpc_server_request_registered_call(server, registered_method, &s,
&deadline, &request_metadata_recv,
&payload, cq, cq, tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
@ -77,7 +81,8 @@ static void verifier_succeeds(grpc_server *server, grpc_completion_queue *cq, vo
cq_verifier_destroy(cqv);
}
static void verifier_fails(grpc_server *server, grpc_completion_queue *cq, void *registered_method) {
static void verifier_fails(grpc_server *server, grpc_completion_queue *cq,
void *registered_method) {
grpc_call_error error;
grpc_call *s;
cq_verifier *cqv = cq_verifier_create(cq);
@ -87,8 +92,9 @@ static void verifier_fails(grpc_server *server, grpc_completion_queue *cq, void
grpc_metadata_array_init(&request_metadata_recv);
error = grpc_server_request_registered_call(server, registered_method, &s, &deadline,
&request_metadata_recv, &payload, cq, cq, tag(101));
error = grpc_server_request_registered_call(server, registered_method, &s,
&deadline, &request_metadata_recv,
&payload, cq, cq, tag(101));
GPR_ASSERT(GRPC_CALL_OK == error);
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
@ -103,18 +109,47 @@ static void verifier_fails(grpc_server *server, grpc_completion_queue *cq, void
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
/* body generated with tools/codegen/core/gen_server_registered_method_bad_client_test_body.py */
GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, PFX_STR "\x00\x00\x00\x00\x00\x00\x00\x00\x01", GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, PFX_STR "\x00\x00\x01\x00\x00\x00\x00\x00\x01\x00", GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, PFX_STR "\x00\x00\x02\x00\x00\x00\x00\x00\x01\x00\x00", GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, PFX_STR "\x00\x00\x03\x00\x00\x00\x00\x00\x01\x00\x00\x00", GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, PFX_STR "\x00\x00\x04\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00", GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier_succeeds, PFX_STR "\x00\x00\x05\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, PFX_STR "\x00\x00\x05\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x01", GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier_succeeds, PFX_STR "\x00\x00\x06\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x01\x00", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, PFX_STR "\x00\x00\x05\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x02", GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, PFX_STR "\x00\x00\x06\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x02\x00", GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier_succeeds, PFX_STR "\x00\x00\x07\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x02\x00\x00", 0);
/* body generated with
* tools/codegen/core/gen_server_registered_method_bad_client_test_body.py */
GRPC_RUN_BAD_CLIENT_TEST(verifier_fails,
PFX_STR "\x00\x00\x00\x00\x00\x00\x00\x00\x01",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier_fails,
PFX_STR "\x00\x00\x01\x00\x00\x00\x00\x00\x01\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, PFX_STR
"\x00\x00\x02\x00\x00\x00\x00\x00\x01\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, PFX_STR
"\x00\x00\x03\x00\x00\x00\x00\x00\x01\x00\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(
verifier_fails,
PFX_STR "\x00\x00\x04\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(
verifier_succeeds,
PFX_STR "\x00\x00\x05\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00", 0);
GRPC_RUN_BAD_CLIENT_TEST(
verifier_fails,
PFX_STR "\x00\x00\x05\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x01",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(
verifier_succeeds,
PFX_STR "\x00\x00\x06\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x01\x00",
0);
GRPC_RUN_BAD_CLIENT_TEST(
verifier_fails,
PFX_STR "\x00\x00\x05\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x02",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(
verifier_fails,
PFX_STR "\x00\x00\x06\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x02\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(
verifier_succeeds, PFX_STR
"\x00\x00\x07\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x02\x00\x00",
0);
return 0;
}

@ -79,7 +79,8 @@
static void *tag(gpr_intptr t) { return (void *)t; }
static void verifier(grpc_server *server, grpc_completion_queue *cq, void *registered_method) {
static void verifier(grpc_server *server, grpc_completion_queue *cq,
void *registered_method) {
grpc_call_error error;
grpc_call *s;
grpc_call_details call_details;
@ -104,7 +105,8 @@ static void verifier(grpc_server *server, grpc_completion_queue *cq, void *regis
cq_verifier_destroy(cqv);
}
static void failure_verifier(grpc_server *server, grpc_completion_queue *cq, void *registered_method) {
static void failure_verifier(grpc_server *server, grpc_completion_queue *cq,
void *registered_method) {
while (grpc_server_has_open_connections(server)) {
GPR_ASSERT(grpc_completion_queue_next(cq,
GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20),

@ -38,7 +38,8 @@
"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" \
"\x00\x00\x00\x04\x00\x00\x00\x00\x00"
static void verifier(grpc_server *server, grpc_completion_queue *cq, void *registered_method) {
static void verifier(grpc_server *server, grpc_completion_queue *cq,
void *registered_method) {
while (grpc_server_has_open_connections(server)) {
GPR_ASSERT(grpc_completion_queue_next(cq,
GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20),

Loading…
Cancel
Save