Merge "TEST_MAPPING for BatteryStats" into sc-dev

This commit is contained in:
Adam Bookatz
2021-02-26 17:11:40 +00:00
committed by Android (Google) Code Review
19 changed files with 119 additions and 2 deletions

View File

@@ -38,6 +38,23 @@
"include-filter": "com.android.server.pm.parsing.PackageInfoUserFieldsTest"
}
]
},
{
"file_patterns": ["BatteryStats.java"],
"name": "FrameworksCoreTests",
"options": [
{ "include-filter": "com.android.internal.os.BatteryStatsTests" },
{ "exclude-annotation": "com.android.internal.os.SkipPresubmit" }
]
},
{
"file_patterns": ["BatteryStats.java"],
"name": "FrameworksServicesTests",
"options": [
{ "include-filter": "com.android.server.am.BatteryStatsServiceTest" },
{ "include-filter": "com.android.server.am.MeasuredEnergySnapshotTest" },
{ "include-filter": "com.android.server.am.BatteryExternalStatsWorkerTest" }
]
}
],
"postsubmit": [

View File

@@ -1,5 +1,22 @@
{
"presubmit": [
{
"file_patterns": ["Battery[^/]*\\.java"],
"name": "FrameworksCoreTests",
"options": [
{ "include-filter": "com.android.internal.os.BatteryStatsTests" },
{ "exclude-annotation": "com.android.internal.os.SkipPresubmit" }
]
},
{
"file_patterns": ["Battery[^/]*\\.java"],
"name": "FrameworksServicesTests",
"options": [
{ "include-filter": "com.android.server.am.BatteryStatsServiceTest" },
{ "include-filter": "com.android.server.am.MeasuredEnergySnapshotTest" },
{ "include-filter": "com.android.server.am.BatteryExternalStatsWorkerTest" }
]
},
{
"name": "FrameworksCoreTests",
"options": [

View File

@@ -0,0 +1,19 @@
{
"presubmit": [
{
"name": "FrameworksCoreTests",
"options": [
{ "include-filter": "com.android.internal.os.BatteryStatsTests" },
{ "exclude-annotation": "com.android.internal.os.SkipPresubmit" }
]
},
{
"name": "FrameworksServicesTests",
"options": [
{ "include-filter": "com.android.server.am.BatteryStatsServiceTest" },
{ "include-filter": "com.android.server.am.MeasuredEnergySnapshotTest" },
{ "include-filter": "com.android.server.am.BatteryExternalStatsWorkerTest" }
]
}
]
}

View File

@@ -77,6 +77,7 @@ import java.util.Arrays;
* bit FrameworksCoreTests:com.android.internal.os.BatteryStatsCpuTimesTest
*/
@SmallTest
@SkipPresubmit("b/180015146")
@RunWith(AndroidJUnit4.class)
public class BatteryStatsCpuTimesTest {
@Mock

View File

@@ -73,6 +73,7 @@ public class BatteryStatsImplTest {
}
@Test
@SkipPresubmit("b/180015146")
public void testUpdateProcStateCpuTimes() {
mBatteryStatsImpl.setOnBatteryInternal(true);
mBatteryStatsImpl.updateTimeBasesLocked(false, Display.STATE_ON, 0, 0);
@@ -230,6 +231,7 @@ public class BatteryStatsImplTest {
}
@Test
@SkipPresubmit("b/180015146")
public void testCopyFromAllUidsCpuTimes() {
mBatteryStatsImpl.setOnBatteryInternal(false);
mBatteryStatsImpl.updateTimeBasesLocked(false, Display.STATE_ON, 0, 0);

View File

@@ -295,6 +295,7 @@ public class BatteryStatsNoteTest extends TestCase {
}
@SmallTest
@SkipPresubmit("b/180015146")
public void testAlarmStartAndFinishLocked() throws Exception {
final MockClocks clocks = new MockClocks(); // holds realtime and uptime in ms
MockBatteryStatsImpl bi = new MockBatteryStatsImpl(clocks);
@@ -332,6 +333,7 @@ public class BatteryStatsNoteTest extends TestCase {
}
@SmallTest
@SkipPresubmit("b/180015146")
public void testAlarmStartAndFinishLocked_workSource() throws Exception {
final MockClocks clocks = new MockClocks(); // holds realtime and uptime in ms
MockBatteryStatsImpl bi = new MockBatteryStatsImpl(clocks);

View File

@@ -56,6 +56,7 @@ public class BatteryStatsSamplingTimerTest extends TestCase {
}
@SmallTest
@SkipPresubmit("b/180015146")
public void testEndSampleAndContinueWhenTimeOrCountDecreases() throws Exception {
final MockClocks clocks = new MockClocks();
final BatteryStatsImpl.TimeBase timeBase = Mockito.mock(BatteryStatsImpl.TimeBase.class);

View File

@@ -77,5 +77,4 @@ import org.junit.runners.Suite;
com.android.internal.power.MeasuredEnergyStatsTest.class
})
public class BatteryStatsTests {
}
}

View File

@@ -78,6 +78,7 @@ public class BatteryStatsUserLifecycleTests {
}
@Test
@SkipPresubmit("b/180015146")
public void testNoCpuDataForRemovedUser() throws Exception {
mIam.startUserInBackground(mTestUserId);
waitUntilTrue("No uids for started user " + mTestUserId,

View File

@@ -35,6 +35,7 @@ import org.junit.runner.RunWith;
import java.util.List;
@SmallTest
@SkipPresubmit("b/180015146")
@RunWith(AndroidJUnit4.class)
public class BatteryUsageStatsTest {

View File

@@ -43,6 +43,7 @@ public class BluetoothPowerCalculatorTest {
.setAveragePower(PowerProfile.POWER_BLUETOOTH_CONTROLLER_TX, 100.0);
@Test
@SkipPresubmit("b/180015146")
public void testTimerBasedModel() {
setDurationsAndPower(mStatsRule.getUidStats(Process.BLUETOOTH_UID)
.getOrCreateBluetoothControllerActivityLocked(),
@@ -73,6 +74,7 @@ public class BluetoothPowerCalculatorTest {
}
@Test
@SkipPresubmit("b/180015146")
public void testReportedPowerBasedModel() {
setDurationsAndPower(mStatsRule.getUidStats(Process.BLUETOOTH_UID)
.getOrCreateBluetoothControllerActivityLocked(),

View File

@@ -382,6 +382,7 @@ public class BstatsCpuTimesValidationTest {
}
@Test
@SkipPresubmit("b/180015146 flakey")
public void testCpuFreqTimes_stateFgService() throws Exception {
if (!sCpuFreqTimesAvailable || !sPerProcStateTimesAvailable) {
Log.w(TAG, "Skipping " + testName.getMethodName()
@@ -514,6 +515,7 @@ public class BstatsCpuTimesValidationTest {
}
@Test
@SkipPresubmit("b/180015146")
public void testCpuFreqTimes_trackingDisabled() throws Exception {
if (!sCpuFreqTimesAvailable || !sPerProcStateTimesAvailable) {
Log.w(TAG, "Skipping " + testName.getMethodName()

View File

@@ -92,6 +92,7 @@ public class CpuPowerCalculatorTest {
}
@Test
@SkipPresubmit("b/180015146")
public void testTimerBasedModel() {
when(mMockUserInfoProvider.exists(anyInt())).thenReturn(true);

View File

@@ -42,6 +42,7 @@ public class CustomMeasuredPowerCalculatorTest {
public final BatteryUsageStatsRule mStatsRule = new BatteryUsageStatsRule();
@Test
@SkipPresubmit("b/180015146")
public void testMeasuredEnergyCopiedIntoBatteryConsumers() {
final BatteryStatsImpl batteryStats = mStatsRule.getBatteryStats();
SparseLongArray uidEnergies = new SparseLongArray();

View File

@@ -87,6 +87,7 @@ public class KernelCpuUidUserSysTimeReaderTest {
}
@Test
@SkipPresubmit("b/180015146")
public void testThrottler() throws Exception {
mReader = new KernelCpuUidUserSysTimeReader(
new KernelCpuProcStringReader(mTestFile.getAbsolutePath()), true);

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.internal.os;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/** Annotation to skip a test from TEST_MAPPING presubmit. */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
public @interface SkipPresubmit {
/** The optional reason why the test is ignored. */
String value() default "";
}

View File

@@ -78,6 +78,7 @@ public class SystemServicePowerCalculatorTest {
}
@Test
@SkipPresubmit("b/180015146")
public void testPowerProfileBasedModel() {
when(mMockUserInfoProvider.exists(anyInt())).thenReturn(true);

View File

@@ -44,6 +44,23 @@
"exclude-annotation": "androidx.test.filters.FlakyTest"
}
]
},
{
"file_patterns": ["Battery[^/]*\\.java", "MeasuredEnergy[^/]*\\.java"],
"name": "FrameworksCoreTests",
"options": [
{ "include-filter": "com.android.internal.os.BatteryStatsTests" },
{ "exclude-annotation": "com.android.internal.os.SkipPresubmit" }
]
},
{
"file_patterns": ["Battery[^/]*\\.java", "MeasuredEnergy[^/]*\\.java"],
"name": "FrameworksServicesTests",
"options": [
{ "include-filter": "com.android.server.am.BatteryStatsServiceTest" },
{ "include-filter": "com.android.server.am.MeasuredEnergySnapshotTest" },
{ "include-filter": "com.android.server.am.BatteryExternalStatsWorkerTest" }
]
}
],
"postsubmit": [

View File

@@ -30,6 +30,7 @@ import com.android.internal.os.BatteryStatsImpl;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -59,6 +60,7 @@ public final class BatteryStatsServiceTest {
}
@Test
@Ignore("b/180015146")
public void testAwaitCompletion() throws Exception {
final CountDownLatch readyLatch = new CountDownLatch(2);
final CountDownLatch startLatch = new CountDownLatch(1);