1##########################################################################
2# Copyright (c) 2018, 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
13
14@tests.add_test
15class MallocTest(TestCommon):
16    '''basic malloc functionality on a single core'''
17    name = "malloctest"
18
19    def get_modules(self, build, machine):
20        modules = super(MallocTest, self).get_modules(build, machine)
21        modules.add_module("malloctest")
22        return modules
23
24    def get_finish_string(self):
25        return "malloctest done."
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