Add uid to the failure log of testFirewallBlocking
ConnectivityManagerTest#testFirewallBlockingXXX were flaky.
One possibility of making this test flaky is that somehow the test was
running with system uid.
So this CL adds uid to the failure log.
Test: m
Bug: 276496378
Change-Id: Iae1a0fe2ee8311213091e852fb1be9233cc3db56
diff --git a/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java b/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java
index ee2f6bb..1411a37 100644
--- a/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java
+++ b/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java
@@ -3410,6 +3410,7 @@
private void checkFirewallBlocking(final DatagramSocket srcSock, final DatagramSocket dstSock,
final boolean expectBlock, final int chain) throws Exception {
+ final int uid = Process.myUid();
final Random random = new Random();
final byte[] sendData = new byte[100];
random.nextBytes(sendData);
@@ -3425,7 +3426,8 @@
fail("Expect not to be blocked by firewall but sending packet was blocked:"
+ " chain=" + chain
+ " chainEnabled=" + mCm.getFirewallChainEnabled(chain)
- + " uidFirewallRule=" + mCm.getUidFirewallRule(chain, Process.myUid()));
+ + " uid=" + uid
+ + " uidFirewallRule=" + mCm.getUidFirewallRule(chain, uid));
}
dstSock.receive(pkt);
@@ -3435,7 +3437,8 @@
fail("Expect to be blocked by firewall but sending packet was not blocked:"
+ " chain=" + chain
+ " chainEnabled=" + mCm.getFirewallChainEnabled(chain)
- + " uidFirewallRule=" + mCm.getUidFirewallRule(chain, Process.myUid()));
+ + " uid=" + uid
+ + " uidFirewallRule=" + mCm.getUidFirewallRule(chain, uid));
}
}