Change the separation between packets to help PXE testing.

This commit is contained in:
David Anderson 2016-02-27 23:15:07 -08:00
parent 3cbc2e2788
commit 33e5e06817
3 changed files with 5 additions and 9 deletions

View File

@ -75,8 +75,7 @@ func (p *Packet) testString() string {
if p.Broadcast { if p.Broadcast {
bcast = "Broadcast" bcast = "Broadcast"
} }
fmt.Fprintf(&b, `===== fmt.Fprintf(&b, `%s
%s
%#v %#v
%s %s
MAC: %s MAC: %s
@ -99,7 +98,6 @@ func (p *Packet) testString() string {
for _, n := range opts { for _, n := range opts {
fmt.Fprintf(&b, " %d: %#v\n", n, p.Options[n]) fmt.Fprintf(&b, " %d: %#v\n", n, p.Options[n])
} }
b.WriteString("=====\n")
return b.String() return b.String()
} }

View File

@ -55,6 +55,7 @@ func TestParse(t *testing.T) {
t.Fatalf("Parsing DHCP packet #%d: %s", i+1, err) t.Fatalf("Parsing DHCP packet #%d: %s", i+1, err)
} }
pkts.WriteString(pkt.testString()) pkts.WriteString(pkt.testString())
pkts.WriteString("======\n")
} }
expectedFile := "testdata/dhcp.parsed" expectedFile := "testdata/dhcp.parsed"

View File

@ -1,4 +1,3 @@
=====
DHCPDISCOVER DHCPDISCOVER
"\x9bN\x05W" "\x9bN\x05W"
Broadcast Broadcast
@ -19,8 +18,7 @@ DHCPDISCOVER
93: []byte{0x0, 0x0} 93: []byte{0x0, 0x0}
94: []byte{0x1, 0x2, 0x1} 94: []byte{0x1, 0x2, 0x1}
97: []byte{0x0, 0x0, 0x2, 0x0, 0x3, 0x0, 0x4, 0x0, 0x5, 0x0, 0x6, 0x0, 0x7, 0x0, 0x8, 0x0, 0x9} 97: []byte{0x0, 0x0, 0x2, 0x0, 0x3, 0x0, 0x4, 0x0, 0x5, 0x0, 0x6, 0x0, 0x7, 0x0, 0x8, 0x0, 0x9}
===== ======
=====
DHCPOFFER DHCPOFFER
"\x9bN\x05W" "\x9bN\x05W"
Broadcast Broadcast
@ -39,8 +37,7 @@ DHCPOFFER
54: []byte{0xc0, 0xa8, 0x10, 0xa} 54: []byte{0xc0, 0xa8, 0x10, 0xa}
60: []byte{0x50, 0x58, 0x45, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74} 60: []byte{0x50, 0x58, 0x45, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74}
97: []byte{0x0, 0x0, 0x2, 0x0, 0x3, 0x0, 0x4, 0x0, 0x5, 0x0, 0x6, 0x0, 0x7, 0x0, 0x8, 0x0, 0x9} 97: []byte{0x0, 0x0, 0x2, 0x0, 0x3, 0x0, 0x4, 0x0, 0x5, 0x0, 0x6, 0x0, 0x7, 0x0, 0x8, 0x0, 0x9}
===== ======
=====
DHCPOFFER DHCPOFFER
"\x9bN\x05W" "\x9bN\x05W"
Broadcast Broadcast
@ -65,4 +62,4 @@ DHCPOFFER
54: []byte{0xc0, 0xa8, 0x10, 0x1} 54: []byte{0xc0, 0xa8, 0x10, 0x1}
58: []byte{0x0, 0x0, 0x7, 0x8} 58: []byte{0x0, 0x0, 0x7, 0x8}
59: []byte{0x0, 0x0, 0xc, 0x4e} 59: []byte{0x0, 0x0, 0xc, 0x4e}
===== ======