diff --git a/tests/log_printfnoformat/Makefile b/tests/log_printfnoformat/Makefile new file mode 100644 index 0000000000..d697625b49 --- /dev/null +++ b/tests/log_printfnoformat/Makefile @@ -0,0 +1,10 @@ +include ../Makefile.tests_common + +USEMODULE += log_printfnoformat + +TEST_ON_CI_WHITELIST += all + +# Enable debug log level +CFLAGS += -DLOG_LEVEL=4 + +include $(RIOTBASE)/Makefile.include diff --git a/tests/log_printfnoformat/main.c b/tests/log_printfnoformat/main.c new file mode 100644 index 0000000000..fafe4bdc25 --- /dev/null +++ b/tests/log_printfnoformat/main.c @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2019 Inria + * + * 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. + */ + +/** + * @file + * @brief Test logging with no format gives the expected output + * + * @author Alexandre Abadie + * + */ + +#include + +#include "log.h" + +int main(void) +{ + uint8_t value = 42; + const char *string = "test"; + const char *format = "Logging value %d and string %s"; + + LOG_ERROR(format, value, string); + LOG_WARNING(format, value, string); + LOG_INFO(format, value, string); + LOG_DEBUG(format, value, string); + + return 0; +} diff --git a/tests/log_printfnoformat/tests/01-run.py b/tests/log_printfnoformat/tests/01-run.py new file mode 100755 index 0000000000..8c9776d2b1 --- /dev/null +++ b/tests/log_printfnoformat/tests/01-run.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 + +# Copyright (C) 2019 Alexandre Abadie +# +# 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 + + +def testfunc(child): + for _ in range(4): + child.expect_exact('Logging value %d and string %s') + + +if __name__ == "__main__": + sys.exit(run(testfunc))