mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
tests/log_printfnoformat: add test application & script
This commit is contained in:
parent
b388a5b3d2
commit
accff501d9
10
tests/log_printfnoformat/Makefile
Normal file
10
tests/log_printfnoformat/Makefile
Normal file
@ -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
|
33
tests/log_printfnoformat/main.c
Normal file
33
tests/log_printfnoformat/main.c
Normal file
@ -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 <alexandre.abadie@inria.fr>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#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;
|
||||
}
|
19
tests/log_printfnoformat/tests/01-run.py
Executable file
19
tests/log_printfnoformat/tests/01-run.py
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (C) 2019 Alexandre Abadie <alexandre.abadie@inria.fr>
|
||||
#
|
||||
# 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))
|
Loading…
Reference in New Issue
Block a user