summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKai Shi <kaishi@google.com>2020-03-20 20:26:15 -0700
committerKai Shi <kaishi@google.com>2020-03-24 21:33:03 -0700
commitca554bc60a2ba4e7847e696508e058012df47849 (patch)
tree9484d7fb029a17b6008262ddbf12b23644cc8a95 /tests
parent5086f8da98e4d1fe44033a3ef2a3be2d76b4e333 (diff)
WifiHealthMonitor: improve regression detection
Current SW regression detection uses the following logic isRegression = recentFailureRate >= highThr && previousFailureRate <= lowThr; This logic works well when the network starts with a low failure value (e.g., 0~5%) and then increase to a high value (e.g., 20%). However, this may not work well when the network starts with a high value (e.g. 20%) and then failure rate further increases to a higher value (e.g., 40%). This case is possible, e.g., enterprise network. To make it work in the above case, change the regression detection logic to isRegression = recentFailureRate / previousFailureRate >= failureRateRatioMinThr && recentFailureCnt >= failureCntMinThr The 2nd check is to ensure the detection confidence level is high when minConnectionAttempt is small. In addition, use Laplace's rule of succession to calculate the probability of failure p = (f + 1) / (n + 2) which has a better estimation especially for small n. Bug: 152096939 Test: atest com.android.server.wifi Change-Id: I037c1a4f80f8094580209765ec31f933cb5d50fa
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/DeviceConfigFacadeTest.java65
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiHealthMonitorTest.java28
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiScoreCardTest.java100
3 files changed, 122 insertions, 71 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/DeviceConfigFacadeTest.java b/tests/wifitests/src/com/android/server/wifi/DeviceConfigFacadeTest.java
index 1737231aa..d6a05c7a3 100644
--- a/tests/wifitests/src/com/android/server/wifi/DeviceConfigFacadeTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/DeviceConfigFacadeTest.java
@@ -138,28 +138,30 @@ public class DeviceConfigFacadeTest extends WifiBaseTest {
mDeviceConfigFacade.getRxPktPerSecondThr());
assertEquals(DeviceConfigFacade.DEFAULT_CONNECTION_FAILURE_HIGH_THR_PERCENT,
mDeviceConfigFacade.getConnectionFailureHighThrPercent());
- assertEquals(DeviceConfigFacade.DEFAULT_CONNECTION_FAILURE_LOW_THR_PERCENT,
- mDeviceConfigFacade.getConnectionFailureLowThrPercent());
+ assertEquals(DeviceConfigFacade.DEFAULT_CONNECTION_FAILURE_COUNT_MIN,
+ mDeviceConfigFacade.getConnectionFailureCountMin());
assertEquals(DeviceConfigFacade.DEFAULT_ASSOC_REJECTION_HIGH_THR_PERCENT,
mDeviceConfigFacade.getAssocRejectionHighThrPercent());
- assertEquals(DeviceConfigFacade.DEFAULT_ASSOC_REJECTION_LOW_THR_PERCENT,
- mDeviceConfigFacade.getAssocRejectionLowThrPercent());
+ assertEquals(DeviceConfigFacade.DEFAULT_ASSOC_REJECTION_COUNT_MIN,
+ mDeviceConfigFacade.getAssocRejectionCountMin());
assertEquals(DeviceConfigFacade.DEFAULT_ASSOC_TIMEOUT_HIGH_THR_PERCENT,
mDeviceConfigFacade.getAssocTimeoutHighThrPercent());
- assertEquals(DeviceConfigFacade.DEFAULT_ASSOC_TIMEOUT_LOW_THR_PERCENT,
- mDeviceConfigFacade.getAssocTimeoutLowThrPercent());
+ assertEquals(DeviceConfigFacade.DEFAULT_ASSOC_TIMEOUT_COUNT_MIN,
+ mDeviceConfigFacade.getAssocTimeoutCountMin());
assertEquals(DeviceConfigFacade.DEFAULT_AUTH_FAILURE_HIGH_THR_PERCENT,
mDeviceConfigFacade.getAuthFailureHighThrPercent());
- assertEquals(DeviceConfigFacade.DEFAULT_AUTH_FAILURE_LOW_THR_PERCENT,
- mDeviceConfigFacade.getAuthFailureLowThrPercent());
+ assertEquals(DeviceConfigFacade.DEFAULT_AUTH_FAILURE_COUNT_MIN,
+ mDeviceConfigFacade.getAuthFailureCountMin());
assertEquals(DeviceConfigFacade.DEFAULT_SHORT_CONNECTION_NONLOCAL_HIGH_THR_PERCENT,
mDeviceConfigFacade.getShortConnectionNonlocalHighThrPercent());
- assertEquals(DeviceConfigFacade.DEFAULT_SHORT_CONNECTION_NONLOCAL_LOW_THR_PERCENT,
- mDeviceConfigFacade.getShortConnectionNonlocalLowThrPercent());
+ assertEquals(DeviceConfigFacade.DEFAULT_SHORT_CONNECTION_NONLOCAL_COUNT_MIN,
+ mDeviceConfigFacade.getShortConnectionNonlocalCountMin());
assertEquals(DeviceConfigFacade.DEFAULT_DISCONNECTION_NONLOCAL_HIGH_THR_PERCENT,
mDeviceConfigFacade.getDisconnectionNonlocalHighThrPercent());
- assertEquals(DeviceConfigFacade.DEFAULT_DISCONNECTION_NONLOCAL_LOW_THR_PERCENT,
- mDeviceConfigFacade.getDisconnectionNonlocalLowThrPercent());
+ assertEquals(DeviceConfigFacade.DEFAULT_DISCONNECTION_NONLOCAL_COUNT_MIN,
+ mDeviceConfigFacade.getDisconnectionNonlocalCountMin());
+ assertEquals(DeviceConfigFacade.DEFAULT_HEALTH_MONITOR_RATIO_THR_NUMERATOR,
+ mDeviceConfigFacade.getHealthMonitorRatioThrNumerator());
assertEquals(DeviceConfigFacade.DEFAULT_HEALTH_MONITOR_MIN_RSSI_THR_DBM,
mDeviceConfigFacade.getHealthMonitorMinRssiThrDbm());
assertEquals(Collections.emptySet(),
@@ -207,28 +209,30 @@ public class DeviceConfigFacadeTest extends WifiBaseTest {
anyInt())).thenReturn(5);
when(DeviceConfig.getInt(anyString(), eq("connection_failure_high_thr_percent"),
anyInt())).thenReturn(31);
- when(DeviceConfig.getInt(anyString(), eq("connection_failure_low_thr_percent"),
- anyInt())).thenReturn(3);
+ when(DeviceConfig.getInt(anyString(), eq("connection_failure_count_min"),
+ anyInt())).thenReturn(4);
when(DeviceConfig.getInt(anyString(), eq("assoc_rejection_high_thr_percent"),
anyInt())).thenReturn(10);
- when(DeviceConfig.getInt(anyString(), eq("assoc_rejection_low_thr_percent"),
- anyInt())).thenReturn(2);
+ when(DeviceConfig.getInt(anyString(), eq("assoc_rejection_count_min"),
+ anyInt())).thenReturn(5);
when(DeviceConfig.getInt(anyString(), eq("assoc_timeout_high_thr_percent"),
anyInt())).thenReturn(12);
- when(DeviceConfig.getInt(anyString(), eq("assoc_timeout_low_thr_percent"),
- anyInt())).thenReturn(3);
+ when(DeviceConfig.getInt(anyString(), eq("assoc_timeout_count_min"),
+ anyInt())).thenReturn(6);
when(DeviceConfig.getInt(anyString(), eq("auth_failure_high_thr_percent"),
anyInt())).thenReturn(11);
- when(DeviceConfig.getInt(anyString(), eq("auth_failure_low_thr_percent"),
- anyInt())).thenReturn(2);
+ when(DeviceConfig.getInt(anyString(), eq("auth_failure_count_min"),
+ anyInt())).thenReturn(7);
when(DeviceConfig.getInt(anyString(), eq("short_connection_nonlocal_high_thr_percent"),
anyInt())).thenReturn(8);
- when(DeviceConfig.getInt(anyString(), eq("short_connection_nonlocal_low_thr_percent"),
- anyInt())).thenReturn(1);
+ when(DeviceConfig.getInt(anyString(), eq("short_connection_nonlocal_count_min"),
+ anyInt())).thenReturn(8);
when(DeviceConfig.getInt(anyString(), eq("disconnection_nonlocal_high_thr_percent"),
anyInt())).thenReturn(12);
- when(DeviceConfig.getInt(anyString(), eq("disconnection_nonlocal_low_thr_percent"),
- anyInt())).thenReturn(2);
+ when(DeviceConfig.getInt(anyString(), eq("disconnection_nonlocal_count_min"),
+ anyInt())).thenReturn(9);
+ when(DeviceConfig.getInt(anyString(), eq("health_monitor_ratio_thr_numerator"),
+ anyInt())).thenReturn(3);
when(DeviceConfig.getInt(anyString(), eq("health_monitor_min_rssi_thr_dbm"),
anyInt())).thenReturn(-67);
String testSsidList = "ssid_1,ssid_2";
@@ -263,17 +267,18 @@ public class DeviceConfigFacadeTest extends WifiBaseTest {
assertEquals(10, mDeviceConfigFacade.getTxPktPerSecondThr());
assertEquals(5, mDeviceConfigFacade.getRxPktPerSecondThr());
assertEquals(31, mDeviceConfigFacade.getConnectionFailureHighThrPercent());
- assertEquals(3, mDeviceConfigFacade.getConnectionFailureLowThrPercent());
+ assertEquals(4, mDeviceConfigFacade.getConnectionFailureCountMin());
assertEquals(10, mDeviceConfigFacade.getAssocRejectionHighThrPercent());
- assertEquals(2, mDeviceConfigFacade.getAssocRejectionLowThrPercent());
+ assertEquals(5, mDeviceConfigFacade.getAssocRejectionCountMin());
assertEquals(12, mDeviceConfigFacade.getAssocTimeoutHighThrPercent());
- assertEquals(3, mDeviceConfigFacade.getAssocTimeoutLowThrPercent());
+ assertEquals(6, mDeviceConfigFacade.getAssocTimeoutCountMin());
assertEquals(11, mDeviceConfigFacade.getAuthFailureHighThrPercent());
- assertEquals(2, mDeviceConfigFacade.getAuthFailureLowThrPercent());
+ assertEquals(7, mDeviceConfigFacade.getAuthFailureCountMin());
assertEquals(8, mDeviceConfigFacade.getShortConnectionNonlocalHighThrPercent());
- assertEquals(1, mDeviceConfigFacade.getShortConnectionNonlocalLowThrPercent());
+ assertEquals(8, mDeviceConfigFacade.getShortConnectionNonlocalCountMin());
assertEquals(12, mDeviceConfigFacade.getDisconnectionNonlocalHighThrPercent());
- assertEquals(2, mDeviceConfigFacade.getDisconnectionNonlocalLowThrPercent());
+ assertEquals(9, mDeviceConfigFacade.getDisconnectionNonlocalCountMin());
+ assertEquals(3, mDeviceConfigFacade.getHealthMonitorRatioThrNumerator());
assertEquals(-67, mDeviceConfigFacade.getHealthMonitorMinRssiThrDbm());
assertEquals(testSsidSet, mDeviceConfigFacade.getRandomizationFlakySsidHotlist());
assertEquals(testSsidSet,
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiHealthMonitorTest.java b/tests/wifitests/src/com/android/server/wifi/WifiHealthMonitorTest.java
index 89de82675..3342f93a1 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiHealthMonitorTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiHealthMonitorTest.java
@@ -169,34 +169,34 @@ public class WifiHealthMonitorTest extends WifiBaseTest {
when(mWifiInjector.getWifiScanner()).thenReturn(mWifiScanner);
when(mWifiNative.getDriverVersion()).thenReturn(mDriverVersion);
when(mWifiNative.getFirmwareVersion()).thenReturn(mFirmwareVersion);
- when(mDeviceConfigFacade.getHealthMonitorMinRssiThrDbm()).thenReturn(
- DeviceConfigFacade.DEFAULT_HEALTH_MONITOR_MIN_RSSI_THR_DBM);
when(mDeviceConfigFacade.getConnectionFailureHighThrPercent()).thenReturn(
DeviceConfigFacade.DEFAULT_CONNECTION_FAILURE_HIGH_THR_PERCENT);
- when(mDeviceConfigFacade.getConnectionFailureLowThrPercent()).thenReturn(
- DeviceConfigFacade.DEFAULT_CONNECTION_FAILURE_LOW_THR_PERCENT);
+ when(mDeviceConfigFacade.getConnectionFailureCountMin()).thenReturn(
+ DeviceConfigFacade.DEFAULT_CONNECTION_FAILURE_COUNT_MIN);
when(mDeviceConfigFacade.getAssocRejectionHighThrPercent()).thenReturn(
DeviceConfigFacade.DEFAULT_ASSOC_REJECTION_HIGH_THR_PERCENT);
- when(mDeviceConfigFacade.getAssocRejectionLowThrPercent()).thenReturn(
- DeviceConfigFacade.DEFAULT_ASSOC_REJECTION_LOW_THR_PERCENT);
+ when(mDeviceConfigFacade.getAssocRejectionCountMin()).thenReturn(
+ DeviceConfigFacade.DEFAULT_ASSOC_REJECTION_COUNT_MIN);
when(mDeviceConfigFacade.getAssocTimeoutHighThrPercent()).thenReturn(
DeviceConfigFacade.DEFAULT_ASSOC_TIMEOUT_HIGH_THR_PERCENT);
- when(mDeviceConfigFacade.getAssocTimeoutLowThrPercent()).thenReturn(
- DeviceConfigFacade.DEFAULT_ASSOC_TIMEOUT_LOW_THR_PERCENT);
+ when(mDeviceConfigFacade.getAssocTimeoutCountMin()).thenReturn(
+ DeviceConfigFacade.DEFAULT_ASSOC_TIMEOUT_COUNT_MIN);
when(mDeviceConfigFacade.getAuthFailureHighThrPercent()).thenReturn(
DeviceConfigFacade.DEFAULT_AUTH_FAILURE_HIGH_THR_PERCENT);
- when(mDeviceConfigFacade.getAuthFailureLowThrPercent()).thenReturn(
- DeviceConfigFacade.DEFAULT_AUTH_FAILURE_LOW_THR_PERCENT);
+ when(mDeviceConfigFacade.getAuthFailureCountMin()).thenReturn(
+ DeviceConfigFacade.DEFAULT_AUTH_FAILURE_COUNT_MIN);
when(mDeviceConfigFacade.getShortConnectionNonlocalHighThrPercent()).thenReturn(
DeviceConfigFacade.DEFAULT_SHORT_CONNECTION_NONLOCAL_HIGH_THR_PERCENT);
- when(mDeviceConfigFacade.getShortConnectionNonlocalLowThrPercent()).thenReturn(
- DeviceConfigFacade.DEFAULT_SHORT_CONNECTION_NONLOCAL_LOW_THR_PERCENT);
+ when(mDeviceConfigFacade.getShortConnectionNonlocalCountMin()).thenReturn(
+ DeviceConfigFacade.DEFAULT_SHORT_CONNECTION_NONLOCAL_COUNT_MIN);
when(mDeviceConfigFacade.getDisconnectionNonlocalHighThrPercent()).thenReturn(
DeviceConfigFacade.DEFAULT_DISCONNECTION_NONLOCAL_HIGH_THR_PERCENT);
- when(mDeviceConfigFacade.getDisconnectionNonlocalLowThrPercent()).thenReturn(
- DeviceConfigFacade.DEFAULT_DISCONNECTION_NONLOCAL_LOW_THR_PERCENT);
+ when(mDeviceConfigFacade.getDisconnectionNonlocalCountMin()).thenReturn(
+ DeviceConfigFacade.DEFAULT_DISCONNECTION_NONLOCAL_COUNT_MIN);
when(mDeviceConfigFacade.getHealthMonitorMinRssiThrDbm()).thenReturn(
DeviceConfigFacade.DEFAULT_HEALTH_MONITOR_MIN_RSSI_THR_DBM);
+ when(mDeviceConfigFacade.getHealthMonitorRatioThrNumerator()).thenReturn(
+ DeviceConfigFacade.DEFAULT_HEALTH_MONITOR_RATIO_THR_NUMERATOR);
when(mDeviceConfigFacade.getHealthMonitorMinNumConnectionAttempt()).thenReturn(
DeviceConfigFacade.DEFAULT_HEALTH_MONITOR_MIN_NUM_CONNECTION_ATTEMPT);
mWifiHealthMonitor = new WifiHealthMonitor(mContext, mWifiInjector, mClock,
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiScoreCardTest.java b/tests/wifitests/src/com/android/server/wifi/WifiScoreCardTest.java
index f52837572..e98b03acf 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiScoreCardTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiScoreCardTest.java
@@ -126,30 +126,32 @@ public class WifiScoreCardTest extends WifiBaseTest {
mWifiScoreCard.mPersistentHistograms = true; // TODO - remove when ready
when(mDeviceConfigFacade.getConnectionFailureHighThrPercent()).thenReturn(
DeviceConfigFacade.DEFAULT_CONNECTION_FAILURE_HIGH_THR_PERCENT);
- when(mDeviceConfigFacade.getConnectionFailureLowThrPercent()).thenReturn(
- DeviceConfigFacade.DEFAULT_CONNECTION_FAILURE_LOW_THR_PERCENT);
+ when(mDeviceConfigFacade.getConnectionFailureCountMin()).thenReturn(
+ DeviceConfigFacade.DEFAULT_CONNECTION_FAILURE_COUNT_MIN);
when(mDeviceConfigFacade.getAssocRejectionHighThrPercent()).thenReturn(
DeviceConfigFacade.DEFAULT_ASSOC_REJECTION_HIGH_THR_PERCENT);
- when(mDeviceConfigFacade.getAssocRejectionLowThrPercent()).thenReturn(
- DeviceConfigFacade.DEFAULT_ASSOC_REJECTION_LOW_THR_PERCENT);
+ when(mDeviceConfigFacade.getAssocRejectionCountMin()).thenReturn(
+ DeviceConfigFacade.DEFAULT_ASSOC_REJECTION_COUNT_MIN);
when(mDeviceConfigFacade.getAssocTimeoutHighThrPercent()).thenReturn(
DeviceConfigFacade.DEFAULT_ASSOC_TIMEOUT_HIGH_THR_PERCENT);
- when(mDeviceConfigFacade.getAssocTimeoutLowThrPercent()).thenReturn(
- DeviceConfigFacade.DEFAULT_ASSOC_TIMEOUT_LOW_THR_PERCENT);
+ when(mDeviceConfigFacade.getAssocTimeoutCountMin()).thenReturn(
+ DeviceConfigFacade.DEFAULT_ASSOC_TIMEOUT_COUNT_MIN);
when(mDeviceConfigFacade.getAuthFailureHighThrPercent()).thenReturn(
DeviceConfigFacade.DEFAULT_AUTH_FAILURE_HIGH_THR_PERCENT);
- when(mDeviceConfigFacade.getAuthFailureLowThrPercent()).thenReturn(
- DeviceConfigFacade.DEFAULT_AUTH_FAILURE_LOW_THR_PERCENT);
+ when(mDeviceConfigFacade.getAuthFailureCountMin()).thenReturn(
+ DeviceConfigFacade.DEFAULT_AUTH_FAILURE_COUNT_MIN);
when(mDeviceConfigFacade.getShortConnectionNonlocalHighThrPercent()).thenReturn(
DeviceConfigFacade.DEFAULT_SHORT_CONNECTION_NONLOCAL_HIGH_THR_PERCENT);
- when(mDeviceConfigFacade.getShortConnectionNonlocalLowThrPercent()).thenReturn(
- DeviceConfigFacade.DEFAULT_SHORT_CONNECTION_NONLOCAL_LOW_THR_PERCENT);
+ when(mDeviceConfigFacade.getShortConnectionNonlocalCountMin()).thenReturn(
+ DeviceConfigFacade.DEFAULT_SHORT_CONNECTION_NONLOCAL_COUNT_MIN);
when(mDeviceConfigFacade.getDisconnectionNonlocalHighThrPercent()).thenReturn(
DeviceConfigFacade.DEFAULT_DISCONNECTION_NONLOCAL_HIGH_THR_PERCENT);
- when(mDeviceConfigFacade.getDisconnectionNonlocalLowThrPercent()).thenReturn(
- DeviceConfigFacade.DEFAULT_DISCONNECTION_NONLOCAL_LOW_THR_PERCENT);
+ when(mDeviceConfigFacade.getDisconnectionNonlocalCountMin()).thenReturn(
+ DeviceConfigFacade.DEFAULT_DISCONNECTION_NONLOCAL_COUNT_MIN);
when(mDeviceConfigFacade.getHealthMonitorMinRssiThrDbm()).thenReturn(
DeviceConfigFacade.DEFAULT_HEALTH_MONITOR_MIN_RSSI_THR_DBM);
+ when(mDeviceConfigFacade.getHealthMonitorRatioThrNumerator()).thenReturn(
+ DeviceConfigFacade.DEFAULT_HEALTH_MONITOR_RATIO_THR_NUMERATOR);
when(mDeviceConfigFacade.getHealthMonitorMinNumConnectionAttempt()).thenReturn(
DeviceConfigFacade.DEFAULT_HEALTH_MONITOR_MIN_NUM_CONNECTION_ATTEMPT);
mWifiScoreCard.enableVerboseLogging(true);
@@ -1107,22 +1109,32 @@ public class WifiScoreCardTest extends WifiBaseTest {
}
/**
- * Run a few days with good connection, followed by a SW build change which results
+ * Run a few days with mostly good connection and some failures,
+ * followed by a SW build change which results
* in performance regression. Check if the regression is detected properly.
*/
@Test
public void testRegressionAfterSwBuildChange() throws Exception {
PerNetwork perNetwork = mWifiScoreCard.lookupNetwork(mWifiInfo.getSSID());
- int numGoodConnectionDays = 5;
+ int numGoodConnectionDays = 4;
for (int i = 0; i < numGoodConnectionDays; i++) {
makeRecentStatsWithGoodConnection();
perNetwork.updateAfterDailyDetection();
}
-
- perNetwork.updateAfterSwBuildChange();
+ // Extra day with mixed failures
makeRecentStatsWithShortConnection();
makeRecentStatsWithAssocTimeOut();
makeRecentStatsWithAuthFailure();
+ perNetwork.updateAfterDailyDetection();
+
+ perNetwork.updateAfterSwBuildChange();
+ // Add >2x failures after the SW build change
+ int numBadConnectionDays = 4;
+ for (int i = 0; i < numBadConnectionDays; i++) {
+ makeRecentStatsWithShortConnection();
+ makeRecentStatsWithAssocTimeOut();
+ makeRecentStatsWithAuthFailure();
+ }
FailureStats statsDec = new FailureStats();
FailureStats statsInc = new FailureStats();
@@ -1135,25 +1147,59 @@ public class WifiScoreCardTest extends WifiBaseTest {
}
/**
+ * Check regression detection is missed due to low failure count
+ */
+ @Test
+ public void testMissRegressionDetectionDuetoLowFailureCnt() throws Exception {
+ PerNetwork perNetwork = mWifiScoreCard.lookupNetwork(mWifiInfo.getSSID());
+ int numGoodConnectionDays = 1;
+ for (int i = 0; i < numGoodConnectionDays; i++) {
+ makeRecentStatsWithGoodConnection();
+ perNetwork.updateAfterDailyDetection();
+ }
+
+ perNetwork.updateAfterSwBuildChange();
+ makeRecentStatsWithGoodConnection();
+ // Add a small number of failures for each failure type after the SW build change
+ for (int i = 0; i < mDeviceConfigFacade.getAuthFailureCountMin() - 1; i++) {
+ makeShortConnectionExample();
+ makeAssocTimeOutExample();
+ makeAuthFailureExample();
+ }
+
+ FailureStats statsDec = new FailureStats();
+ FailureStats statsInc = new FailureStats();
+ FailureStats statsHigh = new FailureStats();
+ int detectionFlag = perNetwork.dailyDetection(statsDec, statsInc, statsHigh);
+ assertEquals(WifiScoreCard.SUFFICIENT_RECENT_PREV_STATS, detectionFlag);
+ checkStatsDeltaExample(statsDec, 0);
+ checkStatsDeltaExample(statsInc, 0);
+ checkStatsDeltaExample(statsHigh, 0);
+ }
+
+ /**
* Run a few days with bad connections, followed by a SW build change which results
* in performance improvement. Check if the improvement is detected properly.
*/
@Test
public void testImprovementAfterSwBuildChange() throws Exception {
PerNetwork perNetwork = mWifiScoreCard.lookupNetwork(mWifiInfo.getSSID());
- makeRecentStatsWithGoodConnection(); // Day 1
- perNetwork.updateAfterDailyDetection();
- makeRecentStatsWithAssocTimeOut(); // Day 2
- perNetwork.updateAfterDailyDetection();
- makeRecentStatsWithAuthFailure(); // Day 3
- perNetwork.updateAfterDailyDetection();
- makeRecentStatsWithShortConnection(); // Day 4
- perNetwork.updateAfterDailyDetection();
- makeRecentStatsWithShortConnection(); // Day 5
- perNetwork.updateAfterDailyDetection();
+ for (int i = 0; i < 2; i++) {
+ makeRecentStatsWithShortConnection();
+ makeRecentStatsWithAssocTimeOut();
+ makeRecentStatsWithAuthFailure();
+ perNetwork.updateAfterDailyDetection();
+ }
perNetwork.updateAfterSwBuildChange();
- makeRecentStatsWithGoodConnection(); // Day 6
+ // Add <50% failures after the SW build change
+ int numGoodConnectionDays = 4;
+ for (int i = 0; i < numGoodConnectionDays; i++) {
+ makeRecentStatsWithGoodConnection();
+ }
+ makeRecentStatsWithShortConnection();
+ makeRecentStatsWithAssocTimeOut();
+ makeRecentStatsWithAuthFailure();
FailureStats statsDec = new FailureStats();
FailureStats statsInc = new FailureStats();