#!/usr/bin/env python3

# Copyright (C) 2018 Freie Universität Berlin
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.

import sys
from testrunner import run


# The default timeout is not enough for this test on some of the slower boards
TIMEOUT = 30


def testfunc(child):
    child.expect_exact('[SUCCESS]', timeout=TIMEOUT)


if __name__ == "__main__":
    sys.exit(run(testfunc))

@@ -370,82 +370,923 @@
  30%0A
-%0A%0Adef testfunc(child):%0A    child.expect_exact('%5BSUCCESS%5D', timeout=TIMEOUT
+BENCHMARK_REGEXP = r%22%5Cs+%7Bfunc%7D:%5Cs+%5Cd+us%5Cs+---%5Cs+%5Cd*%5C.*%5Cd+us per call%5Cs+---%5Cs+%5Cd+ calls per sec%22%0A%0A%0Adef testfunc(child):%0A    child.expect_exact('Runtime of Selected Core API functions')%0A    child.expect(BENCHMARK_REGEXP.format(func=%22nop loop%22))%0A    child.expect(BENCHMARK_REGEXP.format(func=r%22mutex_init%5C(%5C)%22))%0A    child.expect(BENCHMARK_REGEXP.format(func=%22mutex lock/unlock%22), timeout=TIMEOUT)%0A    child.expect(BENCHMARK_REGEXP.format(func=r%22thread_flags_set%5C(%5C)%22))%0A    child.expect(BENCHMARK_REGEXP.format(func=%22thread flags set/wait any%22), timeout=TIMEOUT)%0A    child.expect(BENCHMARK_REGEXP.format(func=%22thread flags set/wait all%22), timeout=TIMEOUT)%0A    child.expect(BENCHMARK_REGEXP.format(func=%22thread flags set/wait one%22), timeout=TIMEOUT)%0A    child.expect(BENCHMARK_REGEXP.format(func=r%22msg_try_receive%5C(%5C)%22))%0A    child.expect(BENCHMARK_REGEXP.format(func=r%22msg_avail%5C(%5C)%22))%0A    child.expect_exact('%5BSUCCESS%5D'
 )%0A%0A%0A

improve pexpect autotest