1########################################################################## 2# Copyright (c) 2009 - 2016, 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, Universitaetstr. 6, CH-8092 Zurich. Attn: Systems Group. 8########################################################################## 9 10import tests 11from common import TestCommon 12from results import PassFailResult, PassFailMultiResult 13 14@tests.add_test 15class NkmTest(TestCommon): 16 '''memory kernel interface tests''' 17 name = "nkmtest" 18 19 def get_modules(self, build, machine): 20 modules = super(NkmTest, self).get_modules(build, machine) 21 modules.add_module("nkmtest_all") 22 return modules 23 24 def get_finish_string(self): 25 return "nkmtest_all: all tests passed" 26 27 def process_data(self, testdir, rawiter): 28 # the test passed iff the last line is the finish string 29 lastline = '' 30 for line in rawiter: 31 lastline = line 32 passed = lastline.startswith(self.get_finish_string()) 33 return PassFailResult(passed) 34 35@tests.add_test 36class NkmTestMapOffset(TestCommon): 37 '''test that kernel map interface does check source frame size''' 38 name = "nkmtest_map_offset" 39 40 def get_modules(self, build, machine): 41 modules = super(NkmTestMapOffset, self).get_modules(build, machine) 42 modules.add_module("nkmtest_map_offset") 43 return modules 44 45 def get_finish_string(self): 46 return "nkmtest_map_offset: " 47 48 def process_data(self, testdir, rawiter): 49 # the test passed iff the last line is the finish string 50 errors = [] 51 for line in rawiter: 52 if line.startswith("nkmtest_map_offset: FAILURE"): 53 errors.append(line) 54 return PassFailMultiResult(self.name, errors) 55