Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
bd9a19e2
Commit
bd9a19e2
authored
Dec 23, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for
92a56d03
parent
92a56d03
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
0 deletions
+54
-0
tests/main.c
tests/main.c
+2
-0
tests/nghttp2_session_test.c
tests/nghttp2_session_test.c
+51
-0
tests/nghttp2_session_test.h
tests/nghttp2_session_test.h
+1
-0
No files found.
tests/main.c
View file @
bd9a19e2
...
@@ -290,6 +290,8 @@ int main(int argc _U_, char *argv[] _U_) {
...
@@ -290,6 +290,8 @@ int main(int argc _U_, char *argv[] _U_) {
!
CU_add_test
(
pSuite
,
"session_flooding"
,
test_nghttp2_session_flooding
)
||
!
CU_add_test
(
pSuite
,
"session_flooding"
,
test_nghttp2_session_flooding
)
||
!
CU_add_test
(
pSuite
,
"session_change_stream_priority"
,
!
CU_add_test
(
pSuite
,
"session_change_stream_priority"
,
test_nghttp2_session_change_stream_priority
)
||
test_nghttp2_session_change_stream_priority
)
||
!
CU_add_test
(
pSuite
,
"session_repeated_priority_change"
,
test_nghttp2_session_repeated_priority_change
)
||
!
CU_add_test
(
pSuite
,
"http_mandatory_headers"
,
!
CU_add_test
(
pSuite
,
"http_mandatory_headers"
,
test_nghttp2_http_mandatory_headers
)
||
test_nghttp2_http_mandatory_headers
)
||
!
CU_add_test
(
pSuite
,
"http_content_length"
,
!
CU_add_test
(
pSuite
,
"http_content_length"
,
...
...
tests/nghttp2_session_test.c
View file @
bd9a19e2
...
@@ -8642,6 +8642,57 @@ void test_nghttp2_session_create_idle_stream(void) {
...
@@ -8642,6 +8642,57 @@ void test_nghttp2_session_create_idle_stream(void) {
nghttp2_session_del
(
session
);
nghttp2_session_del
(
session
);
}
}
void
test_nghttp2_session_repeated_priority_change
(
void
)
{
nghttp2_session
*
session
;
nghttp2_session_callbacks
callbacks
;
nghttp2_frame
frame
;
nghttp2_priority_spec
pri_spec
;
int32_t
stream_id
,
last_stream_id
;
int32_t
max_streams
=
20
;
memset
(
&
callbacks
,
0
,
sizeof
(
callbacks
));
nghttp2_session_server_new
(
&
session
,
&
callbacks
,
NULL
);
session
->
local_settings
.
max_concurrent_streams
=
(
uint32_t
)
max_streams
;
/* 1 -> 0 */
nghttp2_priority_spec_init
(
&
pri_spec
,
0
,
16
,
0
);
nghttp2_frame_priority_init
(
&
frame
.
priority
,
1
,
&
pri_spec
);
CU_ASSERT
(
0
==
nghttp2_session_on_priority_received
(
session
,
&
frame
));
nghttp2_frame_priority_free
(
&
frame
.
priority
);
last_stream_id
=
max_streams
*
2
+
1
;
for
(
stream_id
=
3
;
stream_id
<
last_stream_id
;
stream_id
+=
2
)
{
/* 1 -> stream_id */
nghttp2_priority_spec_init
(
&
pri_spec
,
stream_id
,
16
,
0
);
nghttp2_frame_priority_init
(
&
frame
.
priority
,
1
,
&
pri_spec
);
CU_ASSERT
(
0
==
nghttp2_session_on_priority_received
(
session
,
&
frame
));
nghttp2_frame_priority_free
(
&
frame
.
priority
);
}
CU_ASSERT
(
20
==
session
->
num_idle_streams
);
CU_ASSERT
(
1
==
session
->
idle_stream_head
->
stream_id
);
/* 1 -> last_stream_id */
nghttp2_priority_spec_init
(
&
pri_spec
,
last_stream_id
,
16
,
0
);
nghttp2_frame_priority_init
(
&
frame
.
priority
,
1
,
&
pri_spec
);
CU_ASSERT
(
0
==
nghttp2_session_on_priority_received
(
session
,
&
frame
));
nghttp2_frame_priority_free
(
&
frame
.
priority
);
CU_ASSERT
(
20
==
session
->
num_idle_streams
);
CU_ASSERT
(
3
==
session
->
idle_stream_head
->
stream_id
);
nghttp2_session_del
(
session
);
}
static
void
check_nghttp2_http_recv_headers_fail
(
static
void
check_nghttp2_http_recv_headers_fail
(
nghttp2_session
*
session
,
nghttp2_hd_deflater
*
deflater
,
int32_t
stream_id
,
nghttp2_session
*
session
,
nghttp2_hd_deflater
*
deflater
,
int32_t
stream_id
,
int
stream_state
,
const
nghttp2_nv
*
nva
,
size_t
nvlen
)
{
int
stream_state
,
const
nghttp2_nv
*
nva
,
size_t
nvlen
)
{
...
...
tests/nghttp2_session_test.h
View file @
bd9a19e2
...
@@ -138,6 +138,7 @@ void test_nghttp2_session_detach_item_from_closed_stream(void);
...
@@ -138,6 +138,7 @@ void test_nghttp2_session_detach_item_from_closed_stream(void);
void
test_nghttp2_session_flooding
(
void
);
void
test_nghttp2_session_flooding
(
void
);
void
test_nghttp2_session_change_stream_priority
(
void
);
void
test_nghttp2_session_change_stream_priority
(
void
);
void
test_nghttp2_session_create_idle_stream
(
void
);
void
test_nghttp2_session_create_idle_stream
(
void
);
void
test_nghttp2_session_repeated_priority_change
(
void
);
void
test_nghttp2_http_mandatory_headers
(
void
);
void
test_nghttp2_http_mandatory_headers
(
void
);
void
test_nghttp2_http_content_length
(
void
);
void
test_nghttp2_http_content_length
(
void
);
void
test_nghttp2_http_content_length_mismatch
(
void
);
void
test_nghttp2_http_content_length_mismatch
(
void
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment