aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/bad_client
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/bad_client')
-rw-r--r--test/core/bad_client/bad_client.c11
-rw-r--r--test/core/bad_client/tests/large_metadata.c18
-rw-r--r--test/core/bad_client/tests/simple_request.c4
3 files changed, 17 insertions, 16 deletions
diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.c
index 07fcd995d7..1ce3a49097 100644
--- a/test/core/bad_client/bad_client.c
+++ b/test/core/bad_client/bad_client.c
@@ -33,15 +33,18 @@
#include "test/core/bad_client/bad_client.h"
+#include <stdio.h>
+
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
-#include <stdio.h>
+
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/channel/http_server_filter.h"
#include "src/core/lib/iomgr/endpoint_pair.h"
+#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/support/murmur_hash.h"
#include "src/core/lib/support/string.h"
#include "src/core/lib/surface/completion_queue.h"
@@ -117,7 +120,7 @@ void grpc_run_bad_client_test(
grpc_resource_quota *resource_quota =
grpc_resource_quota_create("bad_client_test");
sfd = grpc_iomgr_create_endpoint_pair("fixture", resource_quota, 65536);
- grpc_resource_quota_internal_unref(&exec_ctx, resource_quota);
+ grpc_resource_quota_unref_internal(&exec_ctx, resource_quota);
/* Create server, completion events */
a.server = grpc_server_create(NULL, NULL);
@@ -181,7 +184,7 @@ void grpc_run_bad_client_test(
grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(
gpr_event_wait(&args.read_done, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)));
- grpc_slice_buffer_destroy(&args.incoming);
+ grpc_slice_buffer_destroy_internal(&exec_ctx, &args.incoming);
}
// Shutdown.
grpc_endpoint_shutdown(&exec_ctx, sfd.client);
@@ -194,7 +197,7 @@ void grpc_run_bad_client_test(
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(a.server);
grpc_completion_queue_destroy(a.cq);
- grpc_slice_buffer_destroy(&outgoing);
+ grpc_slice_buffer_destroy_internal(&exec_ctx, &outgoing);
grpc_exec_ctx_finish(&exec_ctx);
grpc_shutdown();
diff --git a/test/core/bad_client/tests/large_metadata.c b/test/core/bad_client/tests/large_metadata.c
index 9c804e78c1..f9255be1dc 100644
--- a/test/core/bad_client/tests/large_metadata.c
+++ b/test/core/bad_client/tests/large_metadata.c
@@ -126,8 +126,8 @@ static void server_verifier(grpc_server *server, grpc_completion_queue *cq,
CQ_EXPECT_COMPLETION(cqv, tag(101), 1);
cq_verify(cqv);
- GPR_ASSERT(0 == strcmp(call_details.host, "localhost"));
- GPR_ASSERT(0 == strcmp(call_details.method, "/foo/bar"));
+ GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.host, "localhost"));
+ GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo/bar"));
grpc_metadata_array_destroy(&request_metadata_recv);
grpc_call_details_destroy(&call_details);
@@ -153,16 +153,14 @@ static void server_verifier_sends_too_much_metadata(grpc_server *server,
CQ_EXPECT_COMPLETION(cqv, tag(101), 1);
cq_verify(cqv);
- GPR_ASSERT(0 == strcmp(call_details.host, "localhost"));
- GPR_ASSERT(0 == strcmp(call_details.method, "/foo/bar"));
+ GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.host, "localhost"));
+ GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo/bar"));
const size_t metadata_value_size = 16 * 1024;
grpc_metadata meta;
- meta.key = "key";
- meta.value = gpr_malloc(metadata_value_size + 1);
- memset((char *)meta.value, 'a', metadata_value_size);
- ((char *)meta.value)[metadata_value_size] = 0;
- meta.value_length = metadata_value_size;
+ meta.key = grpc_slice_from_static_string("key");
+ meta.value = grpc_slice_malloc(metadata_value_size);
+ memset(GRPC_SLICE_START_PTR(meta.value), 'a', metadata_value_size);
grpc_op op;
memset(&op, 0, sizeof(op));
@@ -176,7 +174,7 @@ static void server_verifier_sends_too_much_metadata(grpc_server *server,
CQ_EXPECT_COMPLETION(cqv, tag(102), 0); // Operation fails.
cq_verify(cqv);
- gpr_free((char *)meta.value);
+ grpc_slice_unref(meta.value);
grpc_metadata_array_destroy(&request_metadata_recv);
grpc_call_details_destroy(&call_details);
grpc_call_destroy(s);
diff --git a/test/core/bad_client/tests/simple_request.c b/test/core/bad_client/tests/simple_request.c
index c08aa40a0a..db31ba6fb3 100644
--- a/test/core/bad_client/tests/simple_request.c
+++ b/test/core/bad_client/tests/simple_request.c
@@ -117,8 +117,8 @@ static void verifier(grpc_server *server, grpc_completion_queue *cq,
CQ_EXPECT_COMPLETION(cqv, tag(101), 1);
cq_verify(cqv);
- GPR_ASSERT(0 == strcmp(call_details.host, "localhost"));
- GPR_ASSERT(0 == strcmp(call_details.method, "/foo/bar"));
+ GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.host, "localhost"));
+ GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo/bar"));
grpc_metadata_array_destroy(&request_metadata_recv);
grpc_call_details_destroy(&call_details);