Skip to content

Commit

Permalink
tests/log_printfnoformat: add test application & script
Browse files Browse the repository at this point in the history
  • Loading branch information
aabadie committed May 31, 2019
1 parent 7640cb8 commit e897634
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/log_printfnoformat/Makefile
Original file line number Diff line number Diff line change
@@ -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 changes: 33 additions & 0 deletions tests/log_printfnoformat/main.c
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
*
*/

#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 changes: 19 additions & 0 deletions tests/log_printfnoformat/tests/01-run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python3

# Copyright (C) 2019 Alexandre Abadie <[email protected]>
#
# 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))

0 comments on commit e897634

Please sign in to comment.