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 4195c28347)
(cherry picked from commit 5d2654124e)
Change-Id: Id718e8a02f8db96ff8babac3ec54192148f7bbbd
This commit is contained in:
committed by
Lorenzo Colitti
parent
144223318c
commit
1e04e9ee49
@@ -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",
|
||||
@@ -724,7 +725,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);
|
||||
@@ -779,7 +780,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);
|
||||
@@ -811,7 +812,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};
|
||||
@@ -921,7 +922,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);
|
||||
@@ -1040,7 +1041,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);
|
||||
@@ -1157,6 +1158,7 @@ public class ApfTest extends AndroidTestCase {
|
||||
buffer.position(original);
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testRaParsing() throws Exception {
|
||||
final int maxRandomPacketSize = 512;
|
||||
final Random r = new Random();
|
||||
@@ -1174,6 +1176,7 @@ public class ApfTest extends AndroidTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testRaProcessing() throws Exception {
|
||||
final int maxRandomPacketSize = 512;
|
||||
final Random r = new Random();
|
||||
@@ -1211,6 +1214,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));
|
||||
|
||||
Reference in New Issue
Block a user