Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
f91d5dcf
Commit
f91d5dcf
authored
Sep 12, 2017
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug in async-io-test.c++ where several tests were always skipped.
parent
8777008e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
async-io-test.c++
c++/src/kj/async-io-test.c++
+5
-5
No files found.
c++/src/kj/async-io-test.c++
View file @
f91d5dcf
...
...
@@ -77,12 +77,13 @@ String tryParse(WaitScope& waitScope, Network& network, StringPtr text, uint por
return
network
.
parseAddress
(
text
,
portHint
).
wait
(
waitScope
)
->
toString
();
}
bool
systemSupportsAddress
(
StringPtr
addr
)
{
bool
systemSupportsAddress
(
StringPtr
addr
,
StringPtr
service
=
nullptr
)
{
// Can getaddrinfo() parse this addresses? This is only true if the address family (e.g., ipv6)
// is configured on at least one interface. (The loopback interface usually has both ipv4 and
// ipv6 configured, but not always.)
struct
addrinfo
*
list
;
int
status
=
getaddrinfo
(
addr
.
cStr
(),
nullptr
,
nullptr
,
&
list
);
int
status
=
getaddrinfo
(
addr
.
cStr
(),
service
==
nullptr
?
nullptr
:
service
.
cStr
(),
nullptr
,
&
list
);
if
(
status
==
0
)
{
freeaddrinfo
(
list
);
return
true
;
...
...
@@ -91,7 +92,6 @@ bool systemSupportsAddress(StringPtr addr) {
}
}
TEST
(
AsyncIo
,
AddressParsing
)
{
auto
ioContext
=
setupAsyncIo
();
auto
&
w
=
ioContext
.
waitScope
;
...
...
@@ -110,7 +110,7 @@ TEST(AsyncIo, AddressParsing) {
// We can parse services by name...
//
// For some reason, Android and some various Linux distros do not support service names.
if
(
systemSupportsAddress
(
"1.2.3.4
:
http"
))
{
if
(
systemSupportsAddress
(
"1.2.3.4
"
,
"
http"
))
{
EXPECT_EQ
(
"1.2.3.4:80"
,
tryParse
(
w
,
network
,
"1.2.3.4:http"
,
5678
));
EXPECT_EQ
(
"*:80"
,
tryParse
(
w
,
network
,
"*:http"
,
5678
));
}
else
{
...
...
@@ -122,7 +122,7 @@ TEST(AsyncIo, AddressParsing) {
if
(
systemSupportsAddress
(
"::"
))
{
EXPECT_EQ
(
"[::]:123"
,
tryParse
(
w
,
network
,
"0::0"
,
123
));
EXPECT_EQ
(
"[12ab:cd::34]:321"
,
tryParse
(
w
,
network
,
"[12ab:cd:0::0:34]:321"
,
432
));
if
(
systemSupportsAddress
(
"
[12ab:cd::34]:
http"
))
{
if
(
systemSupportsAddress
(
"
12ab:cd::34"
,
"
http"
))
{
EXPECT_EQ
(
"[::]:80"
,
tryParse
(
w
,
network
,
"[::]:http"
,
5678
));
EXPECT_EQ
(
"[12ab:cd::34]:80"
,
tryParse
(
w
,
network
,
"[12ab:cd::34]:http"
,
5678
));
}
else
{
...
...
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