1
0
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:
Alexandre Abadie 2019-05-24 22:57:33 +02:00
parent b388a5b3d2
commit accff501d9
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
3 changed files with 62 additions and 0 deletions

View 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

View 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;
}

View 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))