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

Commit 2a8e461c authored by Treehugger Robot's avatar Treehugger Robot Committed by Mark Chien
Browse files

Skip testPhysicalEthernet if the test run adb over network

If the test run adb over network and ethernet is available, it is likely
that adb may run over ethernet. Then the test would fail because adb
would break when ethernet is switching from client mode to server mode.

Bug: 160389275
Test: atest CtsTetheringTest

Merged-In: I57d365d33316881c50c3bf7fd1c98926d10842d3
Change-Id: I57d365d33316881c50c3bf7fd1c98926d10842d3
parent d99b74a9
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -42,6 +42,7 @@ import android.net.dhcp.DhcpPacket;
import android.os.Handler;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.HandlerThread;
import android.os.SystemClock;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.system.Os;
import android.system.Os;
import android.util.Log;
import android.util.Log;


@@ -224,9 +225,19 @@ public class EthernetTetheringTest {


    }
    }


    private boolean isAdbOverNetwork() {
        // If adb TCP port opened, this test may running by adb over network.
        return (SystemProperties.getInt("persist.adb.tcp.port", -1) > -1)
                || (SystemProperties.getInt("service.adb.tcp.port", -1) > -1);
    }

    @Test
    @Test
    public void testPhysicalEthernet() throws Exception {
    public void testPhysicalEthernet() throws Exception {
        assumeTrue(mEm.isAvailable());
        assumeTrue(mEm.isAvailable());
        // Do not run this test if adb is over network and ethernet is connected.
        // It is likely the adb run over ethernet, the adb would break when ethernet is switching
        // from client mode to server mode. See b/160389275.
        assumeFalse(isAdbOverNetwork());


        // Get an interface to use.
        // Get an interface to use.
        final String iface = mTetheredInterfaceRequester.getInterface();
        final String iface = mTetheredInterfaceRequester.getInterface();