summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2019-04-27 16:36:39 +0900
committerLorenzo Colitti <lorenzo@google.com>2019-04-27 16:36:39 +0900
commit275205fc6bb186ea1e6544bebcef79a09e22e6f0 (patch)
tree9d32a1506420c6982f89262bce76f63001d0c1fc
parentef1ac51adacb2751f6357e6afc8ce36af8c46ea4 (diff)
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: Ia9865c75f940e2fbb3aef374a297339e8ea2fd1b
-rw-r--r--tests/src/android/net/dhcp/DhcpPacketTest.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/src/android/net/dhcp/DhcpPacketTest.java b/tests/src/android/net/dhcp/DhcpPacketTest.java
index 5f863ef..a30d3e4 100644
--- a/tests/src/android/net/dhcp/DhcpPacketTest.java
+++ b/tests/src/android/net/dhcp/DhcpPacketTest.java
@@ -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);