1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.android.tests.dynamic_partitions;
17 
18 import com.android.tradefed.device.ITestDevice;
19 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
20 import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
21 import org.junit.Assert;
22 import org.junit.Before;
23 import org.junit.Test;
24 import org.junit.runner.RunWith;
25 
26 /* A test to check if dynamic partitions is enabled for new devices in Q and later. */
27 @RunWith(DeviceJUnit4ClassRunner.class)
28 public class KernelDynamicPartitionsTest extends BaseHostJUnit4Test {
29     // The property to indicate dynamic partitions are enabled.
30     private static final String DYNAMIC_PARTITIONS_PROP = "ro.boot.dynamic_partitions";
31 
32     private ITestDevice mDevice;
33 
34     @Before
setUp()35     public void setUp() throws Exception {
36         mDevice = getDevice();
37     }
38 
39     /* Checks ro.build.dynamic_partitions is 'true'. */
40     @Test
testDynamicPartitionsSysProp()41     public void testDynamicPartitionsSysProp() throws Exception {
42         Assert.assertEquals(DYNAMIC_PARTITIONS_PROP + " is not true", "true",
43                 mDevice.getProperty(DYNAMIC_PARTITIONS_PROP));
44     }
45 }
46