summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authormukesh agrawal <quiche@google.com>2017-01-31 17:30:25 -0800
committermukesh agrawal <quiche@google.com>2017-02-10 15:24:15 -0800
commit3355eb4392aabfae9453e7d6f11d9f0620bf5dae (patch)
tree21b08d6d09e28e1e47d9d37ac02efcf68b99b16a /tests
parent3f2187fdcc3ed55c909cb4cdee589744655d3243 (diff)
last mile: add timeout support (2/2)
- Update WifiStateMachine to report connection timeout events to LastMileLogger. - Update LastMileLogger to process timeout events, but ignore spurious timeouts. - Update LastMileLoggerTest, to be clearer about which sections of trace data are present. - Revise the requirements for connection IDs in BaseWifiDiagnostics. Bug: 34691329 Test: wifitests/runtests.sh Change-Id: Ib08b11b8907f47f8b62bfb5e38d0a8263e9d2e4a
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/LastMileLoggerTest.java49
1 files changed, 48 insertions, 1 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/LastMileLoggerTest.java b/tests/wifitests/src/com/android/server/wifi/LastMileLoggerTest.java
index 6107869d0..995dbcc98 100644
--- a/tests/wifitests/src/com/android/server/wifi/LastMileLoggerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/LastMileLoggerTest.java
@@ -58,6 +58,7 @@ public class LastMileLoggerTest {
mTraceDataFile.deleteOnExit();
mTraceEnableFile.deleteOnExit();
mTraceReleaseFile.deleteOnExit();
+ FileUtils.stringToFile(mTraceEnableFile, "0");
mLastMileLogger = new LastMileLogger(mWifiInjector, mTraceDataFile.getPath(),
mTraceEnableFile.getPath(), mTraceReleaseFile.getPath());
}
@@ -85,6 +86,14 @@ public class LastMileLoggerTest {
}
@Test
+ public void connectionEventStartedDoesNotEnableTracingForInvalidConnectionId()
+ throws Exception {
+ mLastMileLogger.reportConnectionEvent(
+ -1, BaseWifiDiagnostics.CONNECTION_EVENT_STARTED);
+ assertEquals("0", IoUtils.readFileAsString(mTraceEnableFile.getPath()));
+ }
+
+ @Test
public void connectionEventStartedDoesNotCrashIfEnableFileIsMissing() throws Exception {
mTraceEnableFile.delete();
mLastMileLogger.reportConnectionEvent(
@@ -122,9 +131,33 @@ public class LastMileLoggerTest {
}
@Test
- public void connectionEventFailedDisablesTracing() throws Exception {
+ public void connectionEventFailedDisablesTracingWhenPendingFails() throws Exception {
+ mLastMileLogger.reportConnectionEvent(
+ FAKE_CONNECTION_ID, BaseWifiDiagnostics.CONNECTION_EVENT_STARTED);
+ mLastMileLogger.reportConnectionEvent(
+ FAKE_CONNECTION_ID, BaseWifiDiagnostics.CONNECTION_EVENT_FAILED);
+ assertEquals("0", IoUtils.readFileAsString(mTraceEnableFile.getPath()));
+ }
+
+ @Test
+ public void connectionEventFailedDoesNotDisableTracingOnFailureOfStaleConnection()
+ throws Exception {
+ mLastMileLogger.reportConnectionEvent(
+ FAKE_CONNECTION_ID, BaseWifiDiagnostics.CONNECTION_EVENT_STARTED);
+ mLastMileLogger.reportConnectionEvent(
+ FAKE_CONNECTION_ID + 1, BaseWifiDiagnostics.CONNECTION_EVENT_STARTED);
mLastMileLogger.reportConnectionEvent(
FAKE_CONNECTION_ID, BaseWifiDiagnostics.CONNECTION_EVENT_FAILED);
+ assertEquals("1", IoUtils.readFileAsString(mTraceEnableFile.getPath()));
+ }
+
+ @Test
+ public void connectionEventFailedDisablesTracingOnFailureOfFutureConnection()
+ throws Exception {
+ mLastMileLogger.reportConnectionEvent(
+ FAKE_CONNECTION_ID, BaseWifiDiagnostics.CONNECTION_EVENT_STARTED);
+ mLastMileLogger.reportConnectionEvent(
+ FAKE_CONNECTION_ID + 1, BaseWifiDiagnostics.CONNECTION_EVENT_FAILED);
assertEquals("0", IoUtils.readFileAsString(mTraceEnableFile.getPath()));
}
@@ -157,6 +190,18 @@ public class LastMileLoggerTest {
FileUtils.stringToFile(mTraceDataFile.getPath(), "rdev_connect");
mLastMileLogger.reportConnectionEvent(
FAKE_CONNECTION_ID, BaseWifiDiagnostics.CONNECTION_EVENT_FAILED);
+ assertTrue(getDumpString().contains("--- Last failed"));
+ assertTrue(getDumpString().contains("rdev_connect"));
+ }
+
+ @Test
+ public void dumpShowsFailureTraceEvenIfConnectionIdIncreases() throws Exception {
+ mLastMileLogger.reportConnectionEvent(
+ FAKE_CONNECTION_ID, BaseWifiDiagnostics.CONNECTION_EVENT_STARTED);
+ FileUtils.stringToFile(mTraceDataFile.getPath(), "rdev_connect");
+ mLastMileLogger.reportConnectionEvent(
+ FAKE_CONNECTION_ID + 1, BaseWifiDiagnostics.CONNECTION_EVENT_FAILED);
+ assertTrue(getDumpString().contains("--- Last failed"));
assertTrue(getDumpString().contains("rdev_connect"));
}
@@ -165,6 +210,8 @@ public class LastMileLoggerTest {
mLastMileLogger.reportConnectionEvent(
FAKE_CONNECTION_ID, BaseWifiDiagnostics.CONNECTION_EVENT_STARTED);
FileUtils.stringToFile(mTraceDataFile.getPath(), "rdev_connect");
+ assertTrue(getDumpString().contains("No last mile log for \"Last failed"));
+ assertTrue(getDumpString().contains("--- Latest"));
assertTrue(getDumpString().contains("rdev_connect"));
}