Fix some checkstyle nits in DhcpPacketTest.
Use the Generated code suppression comment filter instead of the
IndentationCheck suppression comment filter because the latter
complains that '+' should be on a new line.
Bug: 120584519
Bug: 127423755
Test: atest NetworkStackTests
Test: atest FrameworksNetTests
Change-Id: I35b8c943b95a4301c25b7f6cfb02f03a8c1bc34e
Merged-In: I60071bc029d25485bf204cfd3a8cebd538ca12b6
(cherry picked from commit 65f6ae271b)
This commit is contained in:
@@ -329,6 +329,7 @@ public class DhcpPacketTest {
|
||||
// TODO: Turn all of these into golden files. This will probably require using
|
||||
// androidx.test.InstrumentationRegistry for obtaining a Context object
|
||||
// to read such golden files, along with an appropriate Android.mk.
|
||||
// CHECKSTYLE:OFF Generated code
|
||||
final ByteBuffer packet = ByteBuffer.wrap(HexDump.hexStringToByteArray(
|
||||
// IP header.
|
||||
"451001480000000080118849c0a89003c0a89ff7" +
|
||||
@@ -349,6 +350,7 @@ public class DhcpPacketTest {
|
||||
// Options
|
||||
"638253633501023604c0a89003330400001c200104fffff0000304c0a89ffe06080808080808080404" +
|
||||
"3a0400000e103b040000189cff00000000000000000000"));
|
||||
// CHECKSTYLE:ON Generated code
|
||||
|
||||
DhcpPacket offerPacket = DhcpPacket.decodeFullPacket(packet, ENCAP_L3);
|
||||
assertTrue(offerPacket instanceof DhcpOfferPacket); // Implicitly checks it's non-null.
|
||||
@@ -359,6 +361,7 @@ public class DhcpPacketTest {
|
||||
|
||||
@Test
|
||||
public void testOffer2() throws Exception {
|
||||
// CHECKSTYLE:OFF Generated code
|
||||
final ByteBuffer packet = ByteBuffer.wrap(HexDump.hexStringToByteArray(
|
||||
// IP header.
|
||||
"450001518d0600004011144dc0a82b01c0a82bf7" +
|
||||
@@ -379,6 +382,7 @@ public class DhcpPacketTest {
|
||||
// Options
|
||||
"638253633501023604c0a82b01330400000e103a04000007083b0400000c4e0104ffffff00" +
|
||||
"1c04c0a82bff0304c0a82b010604c0a82b012b0f414e44524f49445f4d455445524544ff"));
|
||||
// CHECKSTYLE:ON Generated code
|
||||
|
||||
assertEquals(337, packet.limit());
|
||||
DhcpPacket offerPacket = DhcpPacket.decodeFullPacket(packet, ENCAP_L3);
|
||||
@@ -596,6 +600,7 @@ public class DhcpPacketTest {
|
||||
|
||||
@Test
|
||||
public void testMtu() throws Exception {
|
||||
// CHECKSTYLE:OFF Generated code
|
||||
final ByteBuffer packet = ByteBuffer.wrap(HexDump.hexStringToByteArray(
|
||||
// IP header.
|
||||
"451001480000000080118849c0a89003c0a89ff7" +
|
||||
@@ -616,6 +621,7 @@ public class DhcpPacketTest {
|
||||
// Options
|
||||
"638253633501023604c0a89003330400001c200104fffff0000304c0a89ffe06080808080808080404" +
|
||||
"3a0400000e103b040000189cff00000000"));
|
||||
// CHECKSTYLE:ON Generated code
|
||||
|
||||
checkMtu(packet, 0, null);
|
||||
checkMtu(packet, 0, mtuBytes(1501));
|
||||
@@ -632,6 +638,7 @@ public class DhcpPacketTest {
|
||||
|
||||
@Test
|
||||
public void testBadHwaddrLength() throws Exception {
|
||||
// CHECKSTYLE:OFF Generated code
|
||||
final ByteBuffer packet = ByteBuffer.wrap(HexDump.hexStringToByteArray(
|
||||
// IP header.
|
||||
"450001518d0600004011144dc0a82b01c0a82bf7" +
|
||||
@@ -652,6 +659,7 @@ public class DhcpPacketTest {
|
||||
// Options
|
||||
"638253633501023604c0a82b01330400000e103a04000007083b0400000c4e0104ffffff00" +
|
||||
"1c04c0a82bff0304c0a82b010604c0a82b012b0f414e44524f49445f4d455445524544ff"));
|
||||
// CHECKSTYLE:ON Generated code
|
||||
String expectedClientMac = "30766FF2A90C";
|
||||
|
||||
final int hwAddrLenOffset = 20 + 8 + 2;
|
||||
@@ -708,6 +716,7 @@ public class DhcpPacketTest {
|
||||
// store any information in the overloaded fields).
|
||||
//
|
||||
// For now, we just check that it parses correctly.
|
||||
// CHECKSTYLE:OFF Generated code
|
||||
final ByteBuffer packet = ByteBuffer.wrap(HexDump.hexStringToByteArray(
|
||||
// Ethernet header.
|
||||
"b4cef6000000e80462236e300800" +
|
||||
@@ -730,6 +739,7 @@ public class DhcpPacketTest {
|
||||
// Options
|
||||
"638253633501023604010101010104ffff000033040000a8c03401030304ac1101010604ac110101" +
|
||||
"0000000000000000000000000000000000000000000000ff000000"));
|
||||
// CHECKSTYLE:ON Generated code
|
||||
|
||||
DhcpPacket offerPacket = DhcpPacket.decodeFullPacket(packet, ENCAP_L2);
|
||||
assertTrue(offerPacket instanceof DhcpOfferPacket);
|
||||
@@ -740,6 +750,7 @@ public class DhcpPacketTest {
|
||||
|
||||
@Test
|
||||
public void testBug2111() throws Exception {
|
||||
// CHECKSTYLE:OFF Generated code
|
||||
final ByteBuffer packet = ByteBuffer.wrap(HexDump.hexStringToByteArray(
|
||||
// IP header.
|
||||
"4500014c00000000ff119beac3eaf3880a3f5d04" +
|
||||
@@ -760,6 +771,7 @@ public class DhcpPacketTest {
|
||||
// Options.
|
||||
"638253633501023604c00002fe33040000bfc60104fffff00003040a3f50010608c0000201c0000202" +
|
||||
"0f0f646f6d61696e3132332e636f2e756b0000000000ff00000000"));
|
||||
// CHECKSTYLE:ON Generated code
|
||||
|
||||
DhcpPacket offerPacket = DhcpPacket.decodeFullPacket(packet, ENCAP_L3);
|
||||
assertTrue(offerPacket instanceof DhcpOfferPacket);
|
||||
@@ -770,6 +782,7 @@ public class DhcpPacketTest {
|
||||
|
||||
@Test
|
||||
public void testBug2136() throws Exception {
|
||||
// CHECKSTYLE:OFF Generated code
|
||||
final ByteBuffer packet = ByteBuffer.wrap(HexDump.hexStringToByteArray(
|
||||
// Ethernet header.
|
||||
"bcf5ac000000d0c7890000000800" +
|
||||
@@ -792,6 +805,7 @@ public class DhcpPacketTest {
|
||||
// Options.
|
||||
"6382536335010236040a20ff80330400001c200104fffff00003040a20900106089458413494584135" +
|
||||
"0f0b6c616e63732e61632e756b000000000000000000ff00000000"));
|
||||
// CHECKSTYLE:ON Generated code
|
||||
|
||||
DhcpPacket offerPacket = DhcpPacket.decodeFullPacket(packet, ENCAP_L2);
|
||||
assertTrue(offerPacket instanceof DhcpOfferPacket);
|
||||
@@ -803,6 +817,7 @@ public class DhcpPacketTest {
|
||||
|
||||
@Test
|
||||
public void testUdpServerAnySourcePort() throws Exception {
|
||||
// CHECKSTYLE:OFF Generated code
|
||||
final ByteBuffer packet = ByteBuffer.wrap(HexDump.hexStringToByteArray(
|
||||
// Ethernet header.
|
||||
"9cd917000000001c2e0000000800" +
|
||||
@@ -826,6 +841,7 @@ public class DhcpPacketTest {
|
||||
// Options.
|
||||
"6382536335010236040a0169fc3304000151800104ffff000003040a0fc817060cd1818003d1819403" +
|
||||
"d18180060f0777766d2e6564751c040a0fffffff000000"));
|
||||
// CHECKSTYLE:ON Generated code
|
||||
|
||||
DhcpPacket offerPacket = DhcpPacket.decodeFullPacket(packet, ENCAP_L2);
|
||||
assertTrue(offerPacket instanceof DhcpOfferPacket);
|
||||
@@ -838,6 +854,7 @@ public class DhcpPacketTest {
|
||||
|
||||
@Test
|
||||
public void testUdpInvalidDstPort() throws Exception {
|
||||
// CHECKSTYLE:OFF Generated code
|
||||
final ByteBuffer packet = ByteBuffer.wrap(HexDump.hexStringToByteArray(
|
||||
// Ethernet header.
|
||||
"9cd917000000001c2e0000000800" +
|
||||
@@ -861,6 +878,7 @@ public class DhcpPacketTest {
|
||||
// Options.
|
||||
"6382536335010236040a0169fc3304000151800104ffff000003040a0fc817060cd1818003d1819403" +
|
||||
"d18180060f0777766d2e6564751c040a0fffffff000000"));
|
||||
// CHECKSTYLE:ON Generated code
|
||||
|
||||
try {
|
||||
DhcpPacket.decodeFullPacket(packet, ENCAP_L2);
|
||||
@@ -870,6 +888,7 @@ public class DhcpPacketTest {
|
||||
|
||||
@Test
|
||||
public void testMultipleRouters() throws Exception {
|
||||
// CHECKSTYLE:OFF Generated code
|
||||
final ByteBuffer packet = ByteBuffer.wrap(HexDump.hexStringToByteArray(
|
||||
// Ethernet header.
|
||||
"fc3d93000000" + "081735000000" + "0800" +
|
||||
@@ -892,6 +911,7 @@ public class DhcpPacketTest {
|
||||
// Options.
|
||||
"638253633501023604c0abbd023304000070803a04000038403b04000062700104ffffff00" +
|
||||
"0308c0a8bd01ffffff0006080808080808080404ff000000000000"));
|
||||
// CHECKSTYLE:ON Generated code
|
||||
|
||||
DhcpPacket offerPacket = DhcpPacket.decodeFullPacket(packet, ENCAP_L2);
|
||||
assertTrue(offerPacket instanceof DhcpOfferPacket);
|
||||
|
||||
Reference in New Issue
Block a user