diff --git a/tests/trace/Makefile b/tests/trace/Makefile new file mode 100644 index 0000000000..fba06069ec --- /dev/null +++ b/tests/trace/Makefile @@ -0,0 +1,14 @@ +# name of your application +APPLICATION = trace +include ../Makefile.tests_common + +USEMODULE += trace + +BOARD_WHITELIST := native + +include $(RIOTBASE)/Makefile.include + +test: +# `testrunner` calls `make term` recursively, results in duplicated `TERMFLAGS`. +# So clears `TERMFLAGS` before run. + TERMFLAGS= tests/01-run.py diff --git a/tests/trace/main.c b/tests/trace/main.c new file mode 100644 index 0000000000..2c146c04b1 --- /dev/null +++ b/tests/trace/main.c @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2016 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. + */ + +/** + * @ingroup tests + * @{ + * + * @file + * @brief Tests od module. + * + * @author Martine Lenders + * + * @} + */ + +#include + +#include "trace.h" + +int main(void) +{ + printf("TRACE_SIZE: %u\n", TRACE_SIZE); + trace_print(); + return 0; +} diff --git a/tests/trace/tests/01-run.py b/tests/trace/tests/01-run.py new file mode 100755 index 0000000000..63f363c423 --- /dev/null +++ b/tests/trace/tests/01-run.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 + +# Copyright (C) 2016 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 os +import sys + + +def testfunc(child): + child.expect(r"TRACE_SIZE: (\d+)") + trace_size = int(child.match.group(1)) + for i in range(trace_size): + child.expect("0x[0-9a-f]{7,8}") + + print("All tests successful") + + +if __name__ == "__main__": + sys.path.append(os.path.join(os.environ['RIOTBASE'], + 'dist/tools/testrunner')) + import testrunner + sys.exit(testrunner.run(testfunc, timeout=1, echo=True, traceback=True))