Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 352147a3 authored by Hugo Benichi's avatar Hugo Benichi Committed by Lorenzo Colitti
Browse files

frameworks-test: adding missing @SmallTest

This activates all frameworks-test tests in runs of the continuous
platform tests.

Test: $ runtest frameworks-net passes (expect Tether
Bug: 32561414
(cherry picked from commit fa8a6f62)

Change-Id: I7b0706a7e3368f971d508388e8ad4afc5de9d646
parent 222ebe48
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.net;

import android.os.Bundle;
import android.os.Parcel;
import android.test.suitebuilder.annotation.SmallTest;
import java.util.List;
import junit.framework.TestCase;
import org.mockito.ArgumentCaptor;
@@ -49,6 +50,7 @@ public class ConnectivityMetricsLoggerTest extends TestCase {
        mLog = new ConnectivityMetricsLogger(mService);
    }

    @SmallTest
    public void testLogEvents() throws Exception {
        mLog.logEvent(1, FAKE_COMPONENT, FAKE_EVENT, FAKE_EV);
        mLog.logEvent(2, FAKE_COMPONENT, FAKE_EVENT, FAKE_EV);
@@ -60,6 +62,7 @@ public class ConnectivityMetricsLoggerTest extends TestCase {
        assertEventsEqual(expectedEvent(3), gotEvents.get(2));
    }

    @SmallTest
    public void testLogEventTriggerThrottling() throws Exception {
        when(mService.logEvent(any())).thenReturn(1234L);

@@ -70,6 +73,7 @@ public class ConnectivityMetricsLoggerTest extends TestCase {
        assertEventsEqual(expectedEvent(1), gotEvents.get(0));
    }

    @SmallTest
    public void testLogEventFails() throws Exception {
        when(mService.logEvent(any())).thenReturn(-1L); // Error.

@@ -80,6 +84,7 @@ public class ConnectivityMetricsLoggerTest extends TestCase {
        assertEventsEqual(expectedEvent(1), gotEvents.get(0));
    }

    @SmallTest
    public void testLogEventWhenThrottling() throws Exception {
        when(mService.logEvent(any())).thenReturn(Long.MAX_VALUE); // Throttled

@@ -92,6 +97,7 @@ public class ConnectivityMetricsLoggerTest extends TestCase {
        assertEventsEqual(expectedEvent(1), gotEvents.get(0));
    }

    @SmallTest
    public void testLogEventRecoverFromThrottling() throws Exception {
        final long throttleTimeout = System.currentTimeMillis() + 10;
        when(mService.logEvent(any())).thenReturn(throttleTimeout, 0L);
+7 −8
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import android.system.ErrnoException;
import android.system.Os;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
import android.test.suitebuilder.annotation.MediumTest;
import static android.system.OsConstants.*;

import com.android.frameworks.tests.net.R;
@@ -155,7 +154,7 @@ public class ApfTest extends AndroidTestCase {
     * generating bytecode for that program and running it through the
     * interpreter to verify it functions correctly.
     */
    @MediumTest
    @SmallTest
    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
@@ -563,7 +562,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.
     */
    @MediumTest
    @SmallTest
    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",
@@ -725,7 +724,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};

    @MediumTest
    @SmallTest
    public void testApfFilterIPv4() throws Exception {
        MockIpManagerCallback ipManagerCallback = new MockIpManagerCallback();
        LinkAddress link = new LinkAddress(InetAddress.getByAddress(MOCK_IPV4_ADDR), 19);
@@ -780,7 +779,7 @@ public class ApfTest extends AndroidTestCase {
        apfFilter.shutdown();
    }

    @MediumTest
    @SmallTest
    public void testApfFilterIPv6() throws Exception {
        MockIpManagerCallback ipManagerCallback = new MockIpManagerCallback();
        ApfFilter apfFilter = new TestApfFilter(ipManagerCallback, ALLOW_MULTICAST, mLog);
@@ -812,7 +811,7 @@ public class ApfTest extends AndroidTestCase {
        apfFilter.shutdown();
    }

    @MediumTest
    @SmallTest
    public void testApfFilterMulticast() throws Exception {
        final byte[] unicastIpv4Addr   = {(byte)192,0,2,63};
        final byte[] broadcastIpv4Addr = {(byte)192,0,2,(byte)255};
@@ -922,7 +921,7 @@ public class ApfTest extends AndroidTestCase {
        assertDrop(program, garpReply());
    }

    @MediumTest
    @SmallTest
    public void testApfFilterArp() throws Exception {
        MockIpManagerCallback ipManagerCallback = new MockIpManagerCallback();
        ApfFilter apfFilter = new TestApfFilter(ipManagerCallback, ALLOW_MULTICAST, mLog);
@@ -1041,7 +1040,7 @@ public class ApfTest extends AndroidTestCase {
        ipManagerCallback.assertNoProgramUpdate();
    }

    @MediumTest
    @SmallTest
    public void testApfFilterRa() throws Exception {
        MockIpManagerCallback ipManagerCallback = new MockIpManagerCallback();
        TestApfFilter apfFilter = new TestApfFilter(ipManagerCallback, DROP_MULTICAST, mLog);
+2 −0
Original line number Diff line number Diff line
@@ -473,6 +473,7 @@ public class DhcpPacketTest extends TestCase {
        assertEquals(Integer.toHexString(expected), Integer.toHexString(got));
    }

    @SmallTest
    public void testTruncatedOfferPackets() throws Exception {
        final byte[] packet = HexDump.hexStringToByteArray(
            // IP header.
@@ -506,6 +507,7 @@ public class DhcpPacketTest extends TestCase {
        }
    }

    @SmallTest
    public void testRandomPackets() throws Exception {
        final int maxRandomPacketSize = 512;
        final Random r = new Random();
+2 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.net.netlink.NetlinkConstants;
import android.net.netlink.NetlinkErrorMessage;
import android.net.netlink.NetlinkMessage;
import android.net.netlink.StructNlMsgErr;
import android.test.suitebuilder.annotation.SmallTest;
import android.util.Log;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -53,6 +54,7 @@ public class NetlinkErrorMessageTest extends TestCase {
    public static final byte[] NLM_ERROR_OK =
            HexEncoding.decode(NLM_ERROR_OK_HEX.toCharArray(), false);

    @SmallTest
    public void testParseNlmErrorOk() {
        final ByteBuffer byteBuffer = ByteBuffer.wrap(NLM_ERROR_OK);
        byteBuffer.order(ByteOrder.LITTLE_ENDIAN);  // For testing.
+3 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.net.netlink.NetlinkSocket;
import android.net.netlink.RtNetlinkNeighborMessage;
import android.net.netlink.StructNdMsg;
import android.net.netlink.StructNlMsgHdr;
import android.test.suitebuilder.annotation.SmallTest;
import android.system.ErrnoException;
import android.system.NetlinkSocketAddress;
import android.system.OsConstants;
@@ -33,6 +34,7 @@ import junit.framework.TestCase;
public class NetlinkSocketTest extends TestCase {
    private final String TAG = "NetlinkSocketTest";

    @SmallTest
    public void testBasicWorkingGetNeighborsQuery() throws Exception {
        NetlinkSocket s = new NetlinkSocket(OsConstants.NETLINK_ROUTE);
        assertNotNull(s);
@@ -91,6 +93,7 @@ public class NetlinkSocketTest extends TestCase {
        s.close();
    }

    @SmallTest
    public void testRepeatedCloseCallsAreQuiet() throws Exception {
        // Create a working NetlinkSocket.
        NetlinkSocket s = new NetlinkSocket(OsConstants.NETLINK_ROUTE);
Loading