From 33e5e068170e9d2f6ec98ca72bc3d8a63cf68475 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 27 Feb 2016 23:15:07 -0800 Subject: [PATCH] Change the separation between packets to help PXE testing. --- dhcp/dhcp.go | 4 +--- dhcp/dhcp_test.go | 1 + dhcp/testdata/dhcp.parsed | 9 +++------ 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/dhcp/dhcp.go b/dhcp/dhcp.go index 305dd32..00ad5e1 100644 --- a/dhcp/dhcp.go +++ b/dhcp/dhcp.go @@ -75,8 +75,7 @@ func (p *Packet) testString() string { if p.Broadcast { bcast = "Broadcast" } - fmt.Fprintf(&b, `===== -%s + fmt.Fprintf(&b, `%s %#v %s MAC: %s @@ -99,7 +98,6 @@ func (p *Packet) testString() string { for _, n := range opts { fmt.Fprintf(&b, " %d: %#v\n", n, p.Options[n]) } - b.WriteString("=====\n") return b.String() } diff --git a/dhcp/dhcp_test.go b/dhcp/dhcp_test.go index 95b71d4..4dc4262 100644 --- a/dhcp/dhcp_test.go +++ b/dhcp/dhcp_test.go @@ -55,6 +55,7 @@ func TestParse(t *testing.T) { t.Fatalf("Parsing DHCP packet #%d: %s", i+1, err) } pkts.WriteString(pkt.testString()) + pkts.WriteString("======\n") } expectedFile := "testdata/dhcp.parsed" diff --git a/dhcp/testdata/dhcp.parsed b/dhcp/testdata/dhcp.parsed index c1707b2..9f84201 100644 --- a/dhcp/testdata/dhcp.parsed +++ b/dhcp/testdata/dhcp.parsed @@ -1,4 +1,3 @@ -===== DHCPDISCOVER "\x9bN\x05W" Broadcast @@ -19,8 +18,7 @@ DHCPDISCOVER 93: []byte{0x0, 0x0} 94: []byte{0x1, 0x2, 0x1} 97: []byte{0x0, 0x0, 0x2, 0x0, 0x3, 0x0, 0x4, 0x0, 0x5, 0x0, 0x6, 0x0, 0x7, 0x0, 0x8, 0x0, 0x9} -===== -===== +====== DHCPOFFER "\x9bN\x05W" Broadcast @@ -39,8 +37,7 @@ DHCPOFFER 54: []byte{0xc0, 0xa8, 0x10, 0xa} 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} -===== -===== +====== DHCPOFFER "\x9bN\x05W" Broadcast @@ -65,4 +62,4 @@ DHCPOFFER 54: []byte{0xc0, 0xa8, 0x10, 0x1} 58: []byte{0x0, 0x0, 0x7, 0x8} 59: []byte{0x0, 0x0, 0xc, 0x4e} -===== +======