1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2026-01-01 01:41:18 +01:00

tests/msg_queue_print/: new test for msg_queue_print

This commit is contained in:
JulianHolzwarth 2020-12-01 18:16:10 +01:00
parent 8309889e39
commit 08382fed33
3 changed files with 83 additions and 0 deletions

View File

@ -0,0 +1,3 @@
include ../Makefile.tests_common
include $(RIOTBASE)/Makefile.include

View File

@ -0,0 +1,47 @@
/*
* Copyright (C) 2021 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 testing msg_queue_print
*
*
* @author Julian Holzwarth <julian.holzwarth@fu-berlin.de>
*
*/
#include <stdio.h>
#include <inttypes.h>
#include "msg.h"
#define QUEUE_SIZE 8
msg_t msg_queue[QUEUE_SIZE];
int main(void)
{
msg_t messages[QUEUE_SIZE];
msg_queue_print();
msg_init_queue(msg_queue, QUEUE_SIZE);
msg_queue_print();
for (int i = 0; i < QUEUE_SIZE; i++) {
messages[i].type = i;
messages[i].content.value = i;
msg_send_to_self(&messages[i]);
}
msg_queue_print();
printf("DONE");
return 0;
}

View File

@ -0,0 +1,33 @@
#!/usr/bin/env python3
# Copyright (C) 2021 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.
# @author Julian Holzwarth <julian.holzwarth@fu-berlin.de>
import sys
from testrunner import run
def testfunc(child):
child.expect("No message queue")
child.expect("Message queue of thread 2")
child.expect_exact('size: 8 (avail: 0)')
child.expect("Message queue of thread 2")
child.expect_exact('size: 8 (avail: 8)')
child.expect_exact('type: 0x0000, content: 0 ((nil))')
child.expect_exact('type: 0x0001, content: 1 (0x1)')
child.expect_exact('type: 0x0002, content: 2 (0x2)')
child.expect_exact('type: 0x0003, content: 3 (0x3)')
child.expect_exact('type: 0x0004, content: 4 (0x4)')
child.expect_exact('type: 0x0005, content: 5 (0x5)')
child.expect_exact('type: 0x0006, content: 6 (0x6)')
child.expect_exact('type: 0x0007, content: 7 (0x7)')
child.expect_exact('DONE')
if __name__ == "__main__":
sys.exit(run(testfunc))