Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
b800200d
Commit
b800200d
authored
Jan 26, 2011
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update some net tests from master sources.
From-SVN: r169298
parent
01c59996
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
13 deletions
+37
-13
libgo/go/net/dialgoogle_test.go
+29
-9
libgo/go/net/timeout_test.go
+8
-4
No files found.
libgo/go/net/dialgoogle_test.go
View file @
b800200d
...
@@ -6,12 +6,14 @@ package net
...
@@ -6,12 +6,14 @@ package net
import
(
import
(
"flag"
"flag"
"fmt"
"io"
"io"
"strings"
"syscall"
"syscall"
"testing"
"testing"
)
)
// If an IPv6 tunnel is running
(see go/stubl)
, we can try dialing a real IPv6 address.
// If an IPv6 tunnel is running, we can try dialing a real IPv6 address.
var
ipv6
=
flag
.
Bool
(
"ipv6"
,
false
,
"assume ipv6 tunnel is present"
)
var
ipv6
=
flag
.
Bool
(
"ipv6"
,
false
,
"assume ipv6 tunnel is present"
)
// fd is already connected to the destination, port 80.
// fd is already connected to the destination, port 80.
...
@@ -40,16 +42,16 @@ func doDial(t *testing.T, network, addr string) {
...
@@ -40,16 +42,16 @@ func doDial(t *testing.T, network, addr string) {
}
}
var
googleaddrs
=
[]
string
{
var
googleaddrs
=
[]
string
{
"
74.125.19.99
:80"
,
"
%d.%d.%d.%d
:80"
,
"www.google.com:80"
,
"www.google.com:80"
,
"
74.125.19.99
:http"
,
"
%d.%d.%d.%d
:http"
,
"www.google.com:http"
,
"www.google.com:http"
,
"
074.125.019.099
:0080"
,
"
%03d.%03d.%03d.%03d
:0080"
,
"[::ffff:
74.125.19.99
]:80"
,
"[::ffff:
%d.%d.%d.%d
]:80"
,
"[::ffff:
4a7d:1363
]:80"
,
"[::ffff:
%02x%02x:%02x%02x
]:80"
,
"[0:0:0:0:0000:ffff:
74.125.19.99
]:80"
,
"[0:0:0:0:0000:ffff:
%d.%d.%d.%d
]:80"
,
"[0:0:0:0:000000:ffff:
74.125.19.99
]:80"
,
"[0:0:0:0:000000:ffff:
%d.%d.%d.%d
]:80"
,
"[0:0:0:0:0:ffff::
74.125.19.99
]:80"
,
"[0:0:0:0:0:ffff::
%d.%d.%d.%d
]:80"
,
"[2001:4860:0:2001::68]:80"
,
// ipv6.google.com; removed if ipv6 flag not set
"[2001:4860:0:2001::68]:80"
,
// ipv6.google.com; removed if ipv6 flag not set
}
}
...
@@ -59,6 +61,24 @@ func TestDialGoogle(t *testing.T) {
...
@@ -59,6 +61,24 @@ func TestDialGoogle(t *testing.T) {
googleaddrs
[
len
(
googleaddrs
)
-
1
]
=
""
googleaddrs
[
len
(
googleaddrs
)
-
1
]
=
""
}
}
// Insert an actual IP address for google.com
// into the table.
_
,
addrs
,
err
:=
LookupHost
(
"www.google.com"
)
if
err
!=
nil
{
t
.
Fatalf
(
"lookup www.google.com: %v"
,
err
)
}
if
len
(
addrs
)
==
0
{
t
.
Fatalf
(
"no addresses for www.google.com"
)
}
ip
:=
ParseIP
(
addrs
[
0
])
.
To4
()
for
i
,
s
:=
range
googleaddrs
{
if
strings
.
Contains
(
s
,
"%"
)
{
googleaddrs
[
i
]
=
fmt
.
Sprintf
(
s
,
ip
[
0
],
ip
[
1
],
ip
[
2
],
ip
[
3
])
}
}
for
i
:=
0
;
i
<
len
(
googleaddrs
);
i
++
{
for
i
:=
0
;
i
<
len
(
googleaddrs
);
i
++
{
addr
:=
googleaddrs
[
i
]
addr
:=
googleaddrs
[
i
]
if
addr
==
""
{
if
addr
==
""
{
...
...
libgo/go/net/timeout_test.go
View file @
b800200d
...
@@ -46,8 +46,12 @@ func TestTimeoutUDP(t *testing.T) {
...
@@ -46,8 +46,12 @@ func TestTimeoutUDP(t *testing.T) {
}
}
func
TestTimeoutTCP
(
t
*
testing
.
T
)
{
func
TestTimeoutTCP
(
t
*
testing
.
T
)
{
// 74.125.19.99 is www.google.com.
// set up a listener that won't talk back
// could use dns, but dns depends on
listening
:=
make
(
chan
string
)
// timeouts and this is the timeout test.
done
:=
make
(
chan
int
)
testTimeout
(
t
,
"tcp"
,
"74.125.19.99:80"
,
false
)
go
runServe
(
t
,
"tcp"
,
"127.0.0.1:0"
,
listening
,
done
)
addr
:=
<-
listening
testTimeout
(
t
,
"tcp"
,
addr
,
false
)
<-
done
}
}
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