From 5d2654124e9e77dbda102a4435595c552cbc8e36 Mon Sep 17 00:00:00 2001 From: Hugo Benichi Date: Wed, 2 Nov 2016 13:43:22 +0900 Subject: [PATCH] DO NOT MERGE: ApfTest: tag tests with @SmallTest or @MediumTest Test methods not tagged with @{Small,Medium,Large}Test will not appear in the Android Platform Continuous Testing dashboard. Test methods tagged with @LargeTest will not be run in the Android Platform Continuous Testing dashboard. Test: ApfTest passes ($runtest frameworks-net) Bug: 31479480 (cherry picked from commit 4195c28347cc100954f83c3c92b4dde4673f8608) Change-Id: Ia215fc8e2ccc61f6223c24fdf390e1e759de302f --- tests/net/java/android/net/apf/ApfTest.java | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/net/java/android/net/apf/ApfTest.java b/tests/net/java/android/net/apf/ApfTest.java index b7ec00460ae63..81f66a5bc95af 100644 --- a/tests/net/java/android/net/apf/ApfTest.java +++ b/tests/net/java/android/net/apf/ApfTest.java @@ -32,7 +32,8 @@ import android.os.Parcelable; import android.system.ErrnoException; import android.system.Os; import android.test.AndroidTestCase; -import android.test.suitebuilder.annotation.LargeTest; +import android.test.suitebuilder.annotation.SmallTest; +import android.test.suitebuilder.annotation.MediumTest; import static android.system.OsConstants.*; import com.android.frameworks.tests.net.R; @@ -154,7 +155,7 @@ public class ApfTest extends AndroidTestCase { * generating bytecode for that program and running it through the * interpreter to verify it functions correctly. */ - @LargeTest + @MediumTest public void testApfInstructions() throws IllegalInstructionException { // Empty program should pass because having the program counter reach the // location immediately after the program indicates the packet should be @@ -562,7 +563,7 @@ public class ApfTest extends AndroidTestCase { * Generate some BPF programs, translate them to APF, then run APF and BPF programs * over packet traces and verify both programs filter out the same packets. */ - @LargeTest + @MediumTest public void testApfAgainstBpf() throws Exception { String[] tcpdump_filters = new String[]{ "udp", "tcp", "icmp", "icmp6", "udp port 53", "arp", "dst 239.255.255.250", "arp or tcp or udp port 53", "net 192.168.1.0/24", @@ -720,7 +721,7 @@ public class ApfTest extends AndroidTestCase { private static final byte[] ANOTHER_IPV4_ADDR = {10, 0, 0, 2}; private static final byte[] IPV4_ANY_HOST_ADDR = {0, 0, 0, 0}; - @LargeTest + @MediumTest public void testApfFilterIPv4() throws Exception { MockIpManagerCallback ipManagerCallback = new MockIpManagerCallback(); LinkAddress link = new LinkAddress(InetAddress.getByAddress(MOCK_IPV4_ADDR), 19); @@ -775,7 +776,7 @@ public class ApfTest extends AndroidTestCase { apfFilter.shutdown(); } - @LargeTest + @MediumTest public void testApfFilterIPv6() throws Exception { MockIpManagerCallback ipManagerCallback = new MockIpManagerCallback(); ApfFilter apfFilter = new TestApfFilter(ipManagerCallback, ALLOW_MULTICAST, mLog); @@ -801,7 +802,7 @@ public class ApfTest extends AndroidTestCase { apfFilter.shutdown(); } - @LargeTest + @MediumTest public void testApfFilterMulticast() throws Exception { final byte[] unicastIpv4Addr = {(byte)192,0,2,63}; final byte[] broadcastIpv4Addr = {(byte)192,0,2,(byte)255}; @@ -911,7 +912,7 @@ public class ApfTest extends AndroidTestCase { assertDrop(program, garpReply()); } - @LargeTest + @MediumTest public void testApfFilterArp() throws Exception { MockIpManagerCallback ipManagerCallback = new MockIpManagerCallback(); ApfFilter apfFilter = new TestApfFilter(ipManagerCallback, ALLOW_MULTICAST, mLog); @@ -1030,7 +1031,7 @@ public class ApfTest extends AndroidTestCase { ipManagerCallback.assertNoProgramUpdate(); } - @LargeTest + @MediumTest public void testApfFilterRa() throws Exception { MockIpManagerCallback ipManagerCallback = new MockIpManagerCallback(); TestApfFilter apfFilter = new TestApfFilter(ipManagerCallback, DROP_MULTICAST, mLog); @@ -1147,6 +1148,7 @@ public class ApfTest extends AndroidTestCase { buffer.position(original); } + @SmallTest public void testRaParsing() throws Exception { final int maxRandomPacketSize = 512; final Random r = new Random(); @@ -1164,6 +1166,7 @@ public class ApfTest extends AndroidTestCase { } } + @SmallTest public void testRaProcessing() throws Exception { final int maxRandomPacketSize = 512; final Random r = new Random(); @@ -1201,6 +1204,7 @@ public class ApfTest extends AndroidTestCase { private native static boolean compareBpfApf(String filter, String pcap_filename, byte[] apf_program); + @SmallTest public void testBytesToInt() { assertEquals(0x00000000, ApfFilter.bytesToInt(IPV4_ANY_HOST_ADDR)); assertEquals(0xffffffff, ApfFilter.bytesToInt(IPV4_BROADCAST_ADDRESS));