]> Cypherpunks repositories - gostls13.git/commitdiff
net: Fix ICMP test.
authorChristopher Wedgwood <cw@f00f.org>
Mon, 21 Jun 2010 23:40:44 +0000 (16:40 -0700)
committerRuss Cox <rsc@golang.org>
Mon, 21 Jun 2010 23:40:44 +0000 (16:40 -0700)
Ping IDs should be limited to 16-bits.  Fix failure printing.

R=rsc
CC=golang-dev, jean-christophe smith <jeanchristophe.smith
https://golang.org/cl/1682043

src/pkg/net/ipraw_test.go

index 6d9fb965ab6af7c9254676a586f593f2a9160449..562298bdf463b14bef3eb5aa1fcde084e282d7a1 100644 (file)
@@ -87,7 +87,7 @@ func TestICMP(t *testing.T) {
                t.Fatalf(`net.ListenIP("ip4:icmp", %v) = %v, %v`, *srchost, c, err)
        }
 
-       sendid := os.Getpid()
+       sendid := os.Getpid() & 0xffff
        const sendseq = 61455
        const pingpktlen = 128
        sendpkt := makePingRequest(sendid, sendseq, pingpktlen, []byte("Go Go Gadget Ping!!!"))
@@ -109,7 +109,7 @@ func TestICMP(t *testing.T) {
                }
                rcvid, rcvseq := parsePingReply(resp)
                if rcvid != sendid || rcvseq != sendseq {
-                       t.Fatal(`Ping reply saw id,seq=%v,%v (expected %v, %v)`, rcvid, rcvseq, sendid, sendseq)
+                       t.Fatalf(`Ping reply saw id,seq=0x%x,0x%x (expected 0x%x, 0x%x)`, rcvid, rcvseq, sendid, sendseq)
                }
                return
        }