1#!/usr/bin/env python
2#
3# Copyright (C) 2016 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#      http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17
18import logging
19import os
20
21from vts.runners.host import const
22from vts.runners.host import keys
23from vts.runners.host import test_runner
24from vts.utils.python.controllers import android_device
25
26from vts.testcases.template.gtest_binary_test import gtest_binary_test
27from vts.testcases.kernel.cpu_profiling import cpu_profiling_test_config as config
28
29
30class CpuProfilingTest(gtest_binary_test.GtestBinaryTest):
31    """Runs cpu profiling test cases against Android OS kernel."""
32
33    def setUpClass(self):
34        """Creates a remote shell instance, and copies data files."""
35        super(CpuProfilingTest, self).setUpClass()
36        required_params = ["AndroidDevice"]
37        self.getUserParams(req_param_names=required_params)
38        self.product_type = self.AndroidDevice[0]['product_type']
39
40    def generateAllTests(self):
41        """Runs all gtests. Skip if device is excluded"""
42        if self.product_type in config.CPT_HOTPLUG_EXCLUDE_DEVICES:
43            logging.info("Skip test on device {}.".format(self.product_type))
44            return
45
46        super(CpuProfilingTest, self).generateAllTests()
47
48
49if __name__ == "__main__":
50    test_runner.main()
51