1##########################################################################
2# Copyright (c) 2012, ETH Zurich.
3# All rights reserved.
4#
5# This file is distributed under the terms in the attached LICENSE file.
6# If you do not find this file, copies can be found by writing to:
7# ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
8##########################################################################
9
10import re
11import tests
12from common import TestCommon
13from results import PassFailResult
14
15@tests.add_test
16class PerfMonTest(TestCommon):
17    '''Sanity check for performance counter support'''
18    name = "perfmontest"
19
20    def get_modules(self, build, machine):
21        modules = super(PerfMonTest, self).get_modules(build, machine)
22        modules.add_module("perfmontest")
23        return modules
24
25    def get_finish_string(self):
26        return "Perfmon Overflow data END"
27
28    def process_data(self, testdir, rawiter):
29        # the test passed iff the last line is the finish string
30        lastline = ''
31        for line in rawiter:
32            lastline = line
33        passed = lastline.startswith(self.get_finish_string())
34        return PassFailResult(passed)
35