Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
9366684d
Commit
9366684d
authored
9 years ago
by
Craig Tiller
Browse files
Options
Downloads
Patches
Plain Diff
Expand corpus, add test
parent
b33d5cde
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/core/http/parser_test.c
+30
-0
30 additions, 0 deletions
test/core/http/parser_test.c
with
30 additions
and
0 deletions
test/core/http/parser_test.c
+
30
−
0
View file @
9366684d
...
@@ -178,6 +178,32 @@ static void test_fails(grpc_slice_split_mode split_mode, char *response) {
...
@@ -178,6 +178,32 @@ static void test_fails(grpc_slice_split_mode split_mode, char *response) {
gpr_free
(
slices
);
gpr_free
(
slices
);
}
}
static
const
uint8_t
failed_test1
[]
=
{
0x9e
,
0x48
,
0x54
,
0x54
,
0x50
,
0x2f
,
0x31
,
0x2e
,
0x30
,
0x4a
,
0x48
,
0x54
,
0x54
,
0x30
,
0x32
,
0x16
,
0xa
,
0x2f
,
0x48
,
0x20
,
0x31
,
0x2e
,
0x31
,
0x20
,
0x32
,
0x30
,
0x31
,
0x54
,
0x54
,
0xb9
,
0x32
,
0x31
,
0x2e
,
0x20
,
0x32
,
0x30
,
0x20
,
};
typedef
struct
{
const
char
*
name
;
const
uint8_t
*
data
;
size_t
length
;
}
failed_test
;
#define FAILED_TEST(name) {#name, name, sizeof(name)}
failed_test
failed_tests
[]
=
{
FAILED_TEST
(
failed_test1
),
};
static
void
test_doesnt_crash
(
failed_test
t
)
{
gpr_log
(
GPR_DEBUG
,
"Run previously failed test: %s"
,
t
.
name
);
grpc_http_parser
p
;
grpc_http_parser_init
(
&
p
);
gpr_slice
slice
=
gpr_slice_from_copied_buffer
((
const
char
*
)
t
.
data
,
t
.
length
);
grpc_http_parser_parse
(
&
p
,
slice
);
gpr_slice_unref
(
slice
);
grpc_http_parser_destroy
(
&
p
);
}
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
size_t
i
;
size_t
i
;
const
grpc_slice_split_mode
split_modes
[]
=
{
GRPC_SLICE_SPLIT_IDENTITY
,
const
grpc_slice_split_mode
split_modes
[]
=
{
GRPC_SLICE_SPLIT_IDENTITY
,
...
@@ -186,6 +212,10 @@ int main(int argc, char **argv) {
...
@@ -186,6 +212,10 @@ int main(int argc, char **argv) {
grpc_test_init
(
argc
,
argv
);
grpc_test_init
(
argc
,
argv
);
for
(
i
=
0
;
i
<
GPR_ARRAY_SIZE
(
failed_tests
);
i
++
)
{
test_doesnt_crash
(
failed_tests
[
i
]);
}
for
(
i
=
0
;
i
<
GPR_ARRAY_SIZE
(
split_modes
);
i
++
)
{
for
(
i
=
0
;
i
<
GPR_ARRAY_SIZE
(
split_modes
);
i
++
)
{
test_succeeds
(
split_modes
[
i
],
test_succeeds
(
split_modes
[
i
],
"HTTP/1.0 200 OK
\r\n
"
"HTTP/1.0 200 OK
\r\n
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment