mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
tests/sys/shell_coreclk: add test application for shell_cmd_coreclk
This commit is contained in:
parent
19ce68dd2e
commit
9b3771778f
12
tests/sys/shell_coreclk/Makefile
Normal file
12
tests/sys/shell_coreclk/Makefile
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
include ../Makefile.sys_common
|
||||||
|
|
||||||
|
USEMODULE += shell
|
||||||
|
USEMODULE += shell_cmd_coreclk
|
||||||
|
|
||||||
|
# Use a terminal that does not introduce extra characters into the stream.
|
||||||
|
RIOT_TERMINAL ?= socat
|
||||||
|
|
||||||
|
include $(RIOTBASE)/Makefile.include
|
||||||
|
|
||||||
|
# the test script skips tests if socat is not used
|
||||||
|
$(call target-export-variables,$(RIOT_TERMINAL),RIOT_TERMINAL)
|
30
tests/sys/shell_coreclk/main.c
Normal file
30
tests/sys/shell_coreclk/main.c
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 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 for the coreclk shell command
|
||||||
|
*
|
||||||
|
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "shell.h"
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
/* define buffer to be used by the shell */
|
||||||
|
char line_buf[SHELL_DEFAULT_BUFSIZE];
|
||||||
|
|
||||||
|
/* start shell */
|
||||||
|
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
38
tests/sys/shell_coreclk/tests/01-run.py
Executable file
38
tests/sys/shell_coreclk/tests/01-run.py
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
# Copyright (C) 2023 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.
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from testrunner import run
|
||||||
|
|
||||||
|
EXPECTED_HELP = (
|
||||||
|
'Command Description',
|
||||||
|
'---------------------------------------',
|
||||||
|
'coreclk Print the CPU frequency',
|
||||||
|
)
|
||||||
|
BOARD = os.environ['BOARD']
|
||||||
|
|
||||||
|
|
||||||
|
def testfunc(child):
|
||||||
|
# avoid sending an extra empty line on native.
|
||||||
|
if BOARD == 'native':
|
||||||
|
child.crlf = '\n'
|
||||||
|
|
||||||
|
# check the help
|
||||||
|
child.sendline('help')
|
||||||
|
for line in EXPECTED_HELP:
|
||||||
|
child.expect_exact(line)
|
||||||
|
|
||||||
|
# coreclk
|
||||||
|
child.sendline('coreclk')
|
||||||
|
child.expect(r"core clock: \d+ Hz")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(run(testfunc))
|
Loading…
Reference in New Issue
Block a user