Home | History | Annotate | Download | only in tests
      1 #    Copyright 2017 ARM Limited, Google
      2 #
      3 # Licensed under the Apache License, Version 2.0 (the "License");
      4 # you may not use this file except in compliance with the License.
      5 # You may obtain a copy of the License at
      6 #
      7 #     http://www.apache.org/licenses/LICENSE-2.0
      8 #
      9 # Unless required by applicable law or agreed to in writing, software
     10 # distributed under the License is distributed on an "AS IS" BASIS,
     11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 # See the License for the specific language governing permissions and
     13 # limitations under the License.
     14 #
     15 
     16 import os
     17 import sys
     18 
     19 import utils_tests
     20 import trappy
     21 
     22 sys.path.append(os.path.join(utils_tests.TESTS_DIRECTORY, "..", "trappy"))
     23 
     24 class TestCommonClk(utils_tests.SetupDirectory):
     25     def __init__(self, *args, **kwargs):
     26         super(TestCommonClk, self).__init__(
     27              [("trace_common_clk.txt", "trace_common_clk.txt"),],
     28              *args,
     29              **kwargs)
     30 
     31     def test_common_clk_set_rate_can_be_parsed(self):
     32         """TestCommonClk: test that clock__set_rate events can be parsed"""
     33         trace = trappy.FTrace("trace_common_clk.txt", events=['clock_set_rate'])
     34         df = trace.clock_set_rate.data_frame
     35         self.assertSetEqual(set(df.columns),
     36                             set(["__comm", "__cpu", "__line", "__pid", "__tgid", "cpu_id", "clk_name", "rate"]))
     37 
     38     def test_common_clk_enable_can_be_parsed(self):
     39         """TestCommonClk: test that clock_enable events can be parsed"""
     40         trace = trappy.FTrace("trace_common_clk.txt", events=['clock_enable'])
     41         df = trace.clock_enable.data_frame
     42         self.assertSetEqual(set(df.columns),
     43                             set(["__comm", "__cpu", "__line", "__pid", "__tgid", "cpu_id", "clk_name", "state"]))
     44 
     45     def test_common_clk_disable_can_be_parsed(self):
     46         """TestCommonClk: test that clock_disable events can be parsed"""
     47         trace = trappy.FTrace("trace_common_clk.txt", events=['clock_disable'])
     48         df = trace.clock_disable.data_frame
     49         self.assertSetEqual(set(df.columns),
     50                             set(["__comm", "__cpu", "__line", "__pid", "__tgid", "cpu_id", "clk_name", "state"]))
     51