1##########################################################################
2# Copyright (c) 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, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
8##########################################################################
9
10import re
11import tests
12from common import TestCommon
13from results import PassFailResult
14import debug
15
16@tests.add_test
17class MultithreadedWaitsetTest(TestCommon):
18    '''multithreaded waitset functionality'''
19    name = "mt_waitset"
20
21    def setup(self, build, machine, testdir):
22        super(MultithreadedWaitsetTest, self).setup(build, machine, testdir)
23        self.test_timeout_delta *= 3
24        debug.verbose("%s: increasing test timeout delta by factor 3: new = %s" %
25                (self.name, self.test_timeout_delta))
26
27    def get_modules(self, build, machine):
28        modules = super(MultithreadedWaitsetTest, self).get_modules(build, machine)
29        modules.add_module("mt_waitset", ["10", "10", "10000"])
30        return modules
31
32    def get_finish_string(self):
33        # Finish line is "Test PASSED" or "Test FAILED"
34        return "Test "
35
36    def process_data(self, testdir, rawiter):
37        passed = False
38        for line in rawiter:
39            if "Test PASSED" in line:
40                passed = True
41        return PassFailResult(passed)
42