• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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 
17 package com.android.tests.odsign;
18 
19 import static org.junit.Assert.assertTrue;
20 
21 import com.android.tradefed.invoker.TestInformation;
22 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
23 import com.android.tradefed.testtype.junit4.AfterClassWithInfo;
24 import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
25 import com.android.tradefed.testtype.junit4.BeforeClassWithInfo;
26 
27 import org.junit.Before;
28 import org.junit.Test;
29 import org.junit.runner.RunWith;
30 
31 /**
32  * Test to check if the early boot compilation works properly.
33  *
34  * @see ActivationTest for actual tests
35  * @see CompOsSigningHostTest for the same test with compilation happens in the CompOS VM
36  */
37 @RunWith(DeviceJUnit4ClassRunner.class)
38 public class OnDeviceSigningHostTest extends ActivationTest {
39     @BeforeClassWithInfo
beforeClassWithDevice(TestInformation testInfo)40     public static void beforeClassWithDevice(TestInformation testInfo) throws Exception {
41         OdsignTestUtils testUtils = new OdsignTestUtils(testInfo);
42         testUtils.installTestApex();
43         testUtils.reboot();
44     }
45 
46     @AfterClassWithInfo
afterClassWithDevice(TestInformation testInfo)47     public static void afterClassWithDevice(TestInformation testInfo) throws Exception {
48         OdsignTestUtils testUtils = new OdsignTestUtils(testInfo);
49         testUtils.uninstallTestApex();
50         testUtils.reboot();
51     }
52 
53     @Test
verifyCompilationLogGenerated()54     public void verifyCompilationLogGenerated() throws Exception {
55         OdsignTestUtils testUtils = new OdsignTestUtils(getTestInformation());
56 
57         // Check there is a compilation log, we expect compilation to have occurred.
58         assertTrue("Compilation log not found", testUtils.haveCompilationLog());
59     }
60 }
61