aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/bad_client/tests
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-12-14 12:02:50 -0800
committerGravatar Craig Tiller <ctiller@google.com>2015-12-14 12:02:50 -0800
commit620e965c1b522173aaf2d12e9fcf9c8f5d8754be (patch)
tree18c3f9810487b1ec69a7f2a6b70c4963824b2d46 /test/core/bad_client/tests
parentf35f9257bf145ddf9c56bfaed8a4c3c86873e920 (diff)
clang-format after last weeks test-fest
Diffstat (limited to 'test/core/bad_client/tests')
-rw-r--r--test/core/bad_client/tests/badreq.c138
-rw-r--r--test/core/bad_client/tests/headers.c50
-rw-r--r--test/core/bad_client/tests/initial_settings_frame.c15
-rw-r--r--test/core/bad_client/tests/simple_request.c19
-rw-r--r--test/core/bad_client/tests/unknown_frame.c10
5 files changed, 122 insertions, 110 deletions
diff --git a/test/core/bad_client/tests/badreq.c b/test/core/bad_client/tests/badreq.c
index bc6acd788f..f0d7dac0f5 100644
--- a/test/core/bad_client/tests/badreq.c
+++ b/test/core/bad_client/tests/badreq.c
@@ -38,8 +38,8 @@
#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" \
+#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 */
static void verifier(grpc_server *server, grpc_completion_queue *cq) {
@@ -54,76 +54,86 @@ int main(int argc, char **argv) {
grpc_test_init(argc, argv);
/* invalid content type */
- GRPC_RUN_BAD_CLIENT_TEST(verifier,
- PFX_STR
- "\x00\x00\xc2\x01\x04\x00\x00\x00\x01"
- "\x10\x05:path\x08/foo/bar"
- "\x10\x07:scheme\x04http"
- "\x10\x07:method\x04POST"
- "\x10\x0a:authority\x09localhost"
- "\x10\x0c""content-type\x09text/html"
- "\x10\x14grpc-accept-encoding\x15identity,deflate,gzip"
- "\x10\x02te\x08trailers"
- "\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)",
- GRPC_BAD_CLIENT_DISCONNECT);
+ GRPC_RUN_BAD_CLIENT_TEST(
+ verifier, PFX_STR
+ "\x00\x00\xc2\x01\x04\x00\x00\x00\x01"
+ "\x10\x05:path\x08/foo/bar"
+ "\x10\x07:scheme\x04http"
+ "\x10\x07:method\x04POST"
+ "\x10\x0a:authority\x09localhost"
+ "\x10\x0c"
+ "content-type\x09text/html"
+ "\x10\x14grpc-accept-encoding\x15identity,deflate,gzip"
+ "\x10\x02te\x08trailers"
+ "\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)",
+ GRPC_BAD_CLIENT_DISCONNECT);
/* invalid te */
- GRPC_RUN_BAD_CLIENT_TEST(verifier,
- PFX_STR
- "\x00\x00\xcb\x01\x04\x00\x00\x00\x01"
- "\x10\x05:path\x08/foo/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\x0a""frobnicate"
- "\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)",
- GRPC_BAD_CLIENT_DISCONNECT);
+ GRPC_RUN_BAD_CLIENT_TEST(
+ verifier, PFX_STR
+ "\x00\x00\xcb\x01\x04\x00\x00\x00\x01"
+ "\x10\x05:path\x08/foo/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\x0a"
+ "frobnicate"
+ "\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)",
+ GRPC_BAD_CLIENT_DISCONNECT);
/* two path headers */
- GRPC_RUN_BAD_CLIENT_TEST(verifier,
- PFX_STR
- "\x00\x00\xd9\x01\x04\x00\x00\x00\x01"
- "\x10\x05:path\x08/foo/bar"
- "\x10\x05:path\x08/foo/bah"
- "\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)",
- GRPC_BAD_CLIENT_DISCONNECT);
+ GRPC_RUN_BAD_CLIENT_TEST(
+ verifier, PFX_STR
+ "\x00\x00\xd9\x01\x04\x00\x00\x00\x01"
+ "\x10\x05:path\x08/foo/bar"
+ "\x10\x05:path\x08/foo/bah"
+ "\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)",
+ GRPC_BAD_CLIENT_DISCONNECT);
/* bad accept-encoding algorithm */
- GRPC_RUN_BAD_CLIENT_TEST(verifier,
- PFX_STR
- "\x00\x00\xd2\x01\x04\x00\x00\x00\x01"
- "\x10\x05:path\x08/foo/bar"
- "\x10\x07:scheme\x04http"
- "\x10\x07:method\x04POST"
- "\x10\x0a:authority\x09localhost"
- "\x10\x0c""content-type\x10""application/grpc"
- "\x10\x14grpc-accept-encoding\x1enobody-knows-the-trouble-i-see"
- "\x10\x02te\x08trailers"
- "\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)",
- GRPC_BAD_CLIENT_DISCONNECT);
+ GRPC_RUN_BAD_CLIENT_TEST(
+ verifier, PFX_STR
+ "\x00\x00\xd2\x01\x04\x00\x00\x00\x01"
+ "\x10\x05:path\x08/foo/bar"
+ "\x10\x07:scheme\x04http"
+ "\x10\x07:method\x04POST"
+ "\x10\x0a:authority\x09localhost"
+ "\x10\x0c"
+ "content-type\x10"
+ "application/grpc"
+ "\x10\x14grpc-accept-encoding\x1enobody-knows-the-trouble-i-see"
+ "\x10\x02te\x08trailers"
+ "\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)",
+ GRPC_BAD_CLIENT_DISCONNECT);
/* bad grpc-encoding algorithm */
- GRPC_RUN_BAD_CLIENT_TEST(verifier,
- PFX_STR
- "\x00\x00\xf5\x01\x04\x00\x00\x00\x01"
- "\x10\x05:path\x08/foo/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\x0dgrpc-encoding\x1cyou-dont-know-how-to-do-this"
- "\x10\x02te\x08trailers"
- "\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)",
- GRPC_BAD_CLIENT_DISCONNECT);
+ GRPC_RUN_BAD_CLIENT_TEST(
+ verifier, PFX_STR
+ "\x00\x00\xf5\x01\x04\x00\x00\x00\x01"
+ "\x10\x05:path\x08/foo/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\x0dgrpc-encoding\x1cyou-dont-know-how-to-do-this"
+ "\x10\x02te\x08trailers"
+ "\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)",
+ GRPC_BAD_CLIENT_DISCONNECT);
return 0;
}
diff --git a/test/core/bad_client/tests/headers.c b/test/core/bad_client/tests/headers.c
index abd2826111..c404fd2d67 100644
--- a/test/core/bad_client/tests/headers.c
+++ b/test/core/bad_client/tests/headers.c
@@ -40,9 +40,9 @@
static void verifier(grpc_server *server, grpc_completion_queue *cq) {
while (grpc_server_has_open_connections(server)) {
- GPR_ASSERT(grpc_completion_queue_next(
- cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), NULL)
- .type == GRPC_QUEUE_TIMEOUT);
+ GPR_ASSERT(grpc_completion_queue_next(cq,
+ GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20),
+ NULL).type == GRPC_QUEUE_TIMEOUT);
}
}
@@ -126,24 +126,29 @@ int main(int argc, char **argv) {
0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x04\x01\x04\x00\x00\x00\x01"
- "\x7f\x7f\x01""a",
+ "\x7f\x7f\x01"
+ "a",
0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x04\x01\x04\x00\x00\x00\x01"
- "\x0f\x7f\x01""a",
+ "\x0f\x7f\x01"
+ "a",
0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x04\x01\x04\x00\x00\x00\x01"
- "\x1f\x7f\x01""a",
+ "\x1f\x7f\x01"
+ "a",
0);
/* test nvr, not indexed in static table */
GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x03\x01\x04\x00\x00\x00\x01"
- "\x01\x01""a",
+ "\x01\x01"
+ "a",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x03\x01\x04\x00\x00\x00\x01"
- "\x11\x01""a",
+ "\x11\x01"
+ "a",
GRPC_BAD_CLIENT_DISCONNECT);
/* illegal op code */
GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
@@ -228,14 +233,12 @@ int main(int argc, char **argv) {
GRPC_BAD_CLIENT_DISCONNECT);
/* dynamic table size update: set to default */
- GRPC_RUN_BAD_CLIENT_TEST(verifier,
- PFX_STR
+ GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x03\x01\x04\x00\x00\x00\x01"
"\x3f\xe1\x1f",
GRPC_BAD_CLIENT_DISCONNECT);
/* dynamic table size update: set too large */
- GRPC_RUN_BAD_CLIENT_TEST(verifier,
- PFX_STR
+ GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x03\x01\x04\x00\x00\x00\x01"
"\x3f\xf1\x1f",
0);
@@ -251,42 +254,35 @@ int main(int argc, char **argv) {
0);
/* non-ending header followed by continuation frame */
- GRPC_RUN_BAD_CLIENT_TEST(verifier,
- PFX_STR
+ GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x00\x01\x00\x00\x00\x00\x01"
"\x00\x00\x00\x09\x04\x00\x00\x00\x01",
GRPC_BAD_CLIENT_DISCONNECT);
/* non-ending header followed by non-continuation frame */
- GRPC_RUN_BAD_CLIENT_TEST(verifier,
- PFX_STR
+ GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x00\x01\x00\x00\x00\x00\x01"
"\x00\x00\x00\x00\x04\x00\x00\x00\x01",
0);
- /* non-ending header followed by a continuation frame for a different stream */
- GRPC_RUN_BAD_CLIENT_TEST(verifier,
- PFX_STR
+ /* non-ending header followed by a continuation frame for a different stream
+ */
+ GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x00\x01\x04\x00\x00\x00\x01"
"\x00\x00\x00\x01\x00\x00\x00\x00\x03"
"\x00\x00\x00\x09\x04\x00\x00\x00\x01",
0);
/* opening with a continuation frame */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
- PFX_STR
- "\x00\x00\x00\x09\x04\x00\x00\x00\x01",
- 0);
+ PFX_STR "\x00\x00\x00\x09\x04\x00\x00\x00\x01", 0);
/* three header frames */
- GRPC_RUN_BAD_CLIENT_TEST(verifier,
- PFX_STR
+ GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x00\x01\x04\x00\x00\x00\x01"
"\x00\x00\x00\x01\x04\x00\x00\x00\x01"
"\x00\x00\x00\x01\x04\x00\x00\x00\x01",
GRPC_BAD_CLIENT_DISCONNECT);
-
/* an invalid header found with fuzzing */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
- PFX_STR
- "\x00\x00\x00\x01\x39\x67\xed\x1d\x64",
+ PFX_STR "\x00\x00\x00\x01\x39\x67\xed\x1d\x64",
GRPC_BAD_CLIENT_DISCONNECT);
/* a badly encoded timeout value */
diff --git a/test/core/bad_client/tests/initial_settings_frame.c b/test/core/bad_client/tests/initial_settings_frame.c
index 5b17c08df2..cd8771e88e 100644
--- a/test/core/bad_client/tests/initial_settings_frame.c
+++ b/test/core/bad_client/tests/initial_settings_frame.c
@@ -97,24 +97,23 @@ int main(int argc, char **argv) {
PFX_STR ONE_SETTING_HDR "\x00\x05\x00\x00\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier,
- PFX_STR ONE_SETTING_HDR "\x00\x06\xff\xff\xff\xff",
+ PFX_STR ONE_SETTING_HDR "\x00\x06\xff\xff\xff\xff",
GRPC_BAD_CLIENT_DISCONNECT);
/* update intiial window size */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
- PFX_STR ONE_SETTING_HDR "\x00\x04\x00\x01\x00\x00",
+ PFX_STR ONE_SETTING_HDR "\x00\x04\x00\x01\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
/* ack with data */
- GRPC_RUN_BAD_CLIENT_TEST(verifier,
- PFX_STR
+ GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x00\x04\x00\x00\x00\x00\x00"
- "\x00\x00\x01\x04\x01\x00\x00\x00\x00", 0);
+ "\x00\x00\x01\x04\x01\x00\x00\x00\x00",
+ 0);
/* settings frame with invalid flags */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
- PFX_STR
- "\x00\x00\x00\x04\x10\x00\x00\x00\x00", 0);
+ PFX_STR "\x00\x00\x00\x04\x10\x00\x00\x00\x00", 0);
/* unknown settings should be ignored */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
- PFX_STR ONE_SETTING_HDR "\x00\x99\x00\x00\x00\x00",
+ PFX_STR ONE_SETTING_HDR "\x00\x99\x00\x00\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
return 0;
diff --git a/test/core/bad_client/tests/simple_request.c b/test/core/bad_client/tests/simple_request.c
index b3cd556421..125a9fa1f2 100644
--- a/test/core/bad_client/tests/simple_request.c
+++ b/test/core/bad_client/tests/simple_request.c
@@ -51,7 +51,8 @@
"\x10\x0c" \
"content-type\x10" \
"application/grpc" \
- "\x10\x14grpc-accept-encoding\x15""deflate,identity,gzip" \
+ "\x10\x14grpc-accept-encoding\x15" \
+ "deflate,identity,gzip" \
"\x10\x02te\x08trailers" \
"\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)"
@@ -65,12 +66,16 @@
"\x10\x07:scheme\x04http" \
"\x10\x07:method\x04POST" \
"\x10\x04host\x09localhost" \
- "\x10\x0c""content-type\x1e""application/grpc+this-is-valid" \
+ "\x10\x0c" \
+ "content-type\x1e" \
+ "application/grpc+this-is-valid" \
"\x10\x14grpc-accept-encoding\x15identity,deflate,gzip" \
"\x10\x02te\x08trailers" \
"\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)" \
- "\x10\x0cgrpc-timeout\x03""10S" \
- "\x10\x0cgrpc-timeout\x02""5S"
+ "\x10\x0cgrpc-timeout\x03" \
+ "10S" \
+ "\x10\x0cgrpc-timeout\x02" \
+ "5S"
static void *tag(gpr_intptr t) { return (void *)t; }
@@ -130,8 +135,10 @@ int main(int argc, char **argv) {
GRPC_RUN_BAD_CLIENT_TEST(failure_verifier,
PFX_STR "\x00\x00\x00\x08\x10\x00\x00\x00\x01", 0);
/* push a window update with bad data */
- GRPC_RUN_BAD_CLIENT_TEST(failure_verifier,
- PFX_STR "\x00\x00\x04\x08\x00\x00\x00\x00\x01" "\xff\xff\xff\xff", 0);
+ GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, PFX_STR
+ "\x00\x00\x04\x08\x00\x00\x00\x00\x01"
+ "\xff\xff\xff\xff",
+ 0);
/* push a short goaway */
GRPC_RUN_BAD_CLIENT_TEST(failure_verifier,
PFX_STR "\x00\x00\x04\x07\x00\x00\x00\x00\x00", 0);
diff --git a/test/core/bad_client/tests/unknown_frame.c b/test/core/bad_client/tests/unknown_frame.c
index 8ea81390c9..3f8658b337 100644
--- a/test/core/bad_client/tests/unknown_frame.c
+++ b/test/core/bad_client/tests/unknown_frame.c
@@ -40,9 +40,9 @@
static void verifier(grpc_server *server, grpc_completion_queue *cq) {
while (grpc_server_has_open_connections(server)) {
- GPR_ASSERT(grpc_completion_queue_next(
- cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), NULL)
- .type == GRPC_QUEUE_TIMEOUT);
+ GPR_ASSERT(grpc_completion_queue_next(cq,
+ GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20),
+ NULL).type == GRPC_QUEUE_TIMEOUT);
}
}
@@ -50,8 +50,8 @@ int main(int argc, char **argv) {
grpc_test_init(argc, argv);
/* test adding prioritization data */
- GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
- "\x00\x00\x00\x88\x00\x00\x00\x00\x01",
+ GRPC_RUN_BAD_CLIENT_TEST(verifier,
+ PFX_STR "\x00\x00\x00\x88\x00\x00\x00\x00\x01",
GRPC_BAD_CLIENT_DISCONNECT);
return 0;