cq_verifier.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #ifndef GRPC_TEST_CORE_END2END_CQ_VERIFIER_H
20 #define GRPC_TEST_CORE_END2END_CQ_VERIFIER_H
21 
22 #include <stdbool.h>
23 
24 #include <grpc/grpc.h>
25 
27 
28 /* A cq_verifier can verify that expected events arrive in a timely fashion
29  on a single completion queue */
30 
31 typedef struct cq_verifier cq_verifier;
32 
33 /* construct/destroy a cq_verifier */
36 
37 /* ensure all expected events (and only those events) are present on the
38  bound completion queue within \a timeout_sec */
39 void cq_verify(cq_verifier* v, int timeout_sec = 10);
40 
41 /* ensure that the completion queue is empty */
43 
44 /* ensure that the completion queue is empty, waiting up to \a timeout secs. */
46 
47 /* Various expectation matchers
48  Any functions taking ... expect a NULL terminated list of key/value pairs
49  (each pair using two parameter slots) of metadata that MUST be present in
50  the event. */
51 void cq_expect_completion(cq_verifier* v, const char* file, int line, void* tag,
52  bool success);
53 /* If the \a tag is seen, \a seen is set to true. */
54 void cq_maybe_expect_completion(cq_verifier* v, const char* file, int line,
55  void* tag, bool success, bool* seen);
56 void cq_expect_completion_any_status(cq_verifier* v, const char* file, int line,
57  void* tag);
58 #define CQ_EXPECT_COMPLETION(v, tag, success) \
59  cq_expect_completion(v, __FILE__, __LINE__, tag, success)
60 #define CQ_MAYBE_EXPECT_COMPLETION(v, tag, success, seen) \
61  cq_maybe_expect_completion(v, __FILE__, __LINE__, tag, success, seen)
62 #define CQ_EXPECT_COMPLETION_ANY_STATUS(v, tag) \
63  cq_expect_completion_any_status(v, __FILE__, __LINE__, tag)
64 
66 int byte_buffer_eq_string(grpc_byte_buffer* bb, const char* str);
68  const char* value);
71 
72 #endif /* GRPC_TEST_CORE_END2END_CQ_VERIFIER_H */
xds_interop_client.str
str
Definition: xds_interop_client.py:487
cq_verify_empty_timeout
void cq_verify_empty_timeout(cq_verifier *v, int timeout_sec)
Definition: cq_verifier.cc:286
grpc_metadata_array
Definition: grpc_types.h:579
file
Definition: bloaty/third_party/zlib/examples/gzappend.c:170
cq_verify
void cq_verify(cq_verifier *v, int timeout_sec=10)
Definition: cq_verifier.cc:268
byte_buffer_eq_string
int byte_buffer_eq_string(grpc_byte_buffer *bb, const char *str)
Definition: cq_verifier.cc:186
cq_maybe_expect_completion
void cq_maybe_expect_completion(cq_verifier *v, const char *file, int line, void *tag, bool success, bool *seen)
Definition: cq_verifier.cc:304
array
Definition: undname.c:101
tag
static void * tag(intptr_t t)
Definition: bad_client.cc:318
setup.v
v
Definition: third_party/bloaty/third_party/capstone/bindings/python/setup.py:42
grpc_completion_queue
Definition: completion_queue.cc:347
cq_verifier_create
cq_verifier * cq_verifier_create(grpc_completion_queue *cq)
Definition: cq_verifier.cc:86
grpc.h
contains_metadata
int contains_metadata(grpc_metadata_array *array, const char *key, const char *value)
Definition: cq_verifier.cc:109
grpc_byte_buffer
Definition: grpc_types.h:43
contains_metadata_slices
int contains_metadata_slices(grpc_metadata_array *array, grpc_slice key, grpc_slice value)
Definition: cq_verifier.cc:125
xds_manager.timeout_sec
timeout_sec
Definition: xds_manager.py:58
grpc_slice
Definition: include/grpc/impl/codegen/slice.h:65
cq_verifier
Definition: cq_verifier.cc:76
b
uint64_t b
Definition: abseil-cpp/absl/container/internal/layout_test.cc:53
byte_buffer_eq_slice
int byte_buffer_eq_slice(grpc_byte_buffer *bb, grpc_slice b)
Definition: cq_verifier.cc:168
test_config.h
value
const char * value
Definition: hpack_parser_table.cc:165
cq_expect_completion
void cq_expect_completion(cq_verifier *v, const char *file, int line, void *tag, bool success)
Definition: cq_verifier.cc:317
key
const char * key
Definition: hpack_parser_table.cc:164
cq_verifier_destroy
void cq_verifier_destroy(cq_verifier *v)
Definition: cq_verifier.cc:92
regen-readme.line
line
Definition: regen-readme.py:30
cq_expect_completion_any_status
void cq_expect_completion_any_status(cq_verifier *v, const char *file, int line, void *tag)
Definition: cq_verifier.cc:322
cq_verify_empty
void cq_verify_empty(cq_verifier *v)
Definition: cq_verifier.cc:302
seen
bool * seen
Definition: async_end2end_test.cc:198
cq
static grpc_completion_queue * cq
Definition: test/core/fling/client.cc:37


grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:06