1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

tests/kcnfig: add external modules test

This commit is contained in:
Francisco Molina 2021-02-19 15:11:20 +01:00
parent 582e3a3153
commit ab457abb38
No known key found for this signature in database
GPG Key ID: 3E94EAC3DBDEEDA8
12 changed files with 130 additions and 0 deletions

View File

@ -1,2 +1,8 @@
include ../Makefile.tests_common
USEMODULE += external_module_1
USEMODULE += external_module_2
EXTERNAL_MODULE_DIRS += $(CURDIR)/external_module_1
EXTERNAL_MODULE_DIRS += $(CURDIR)/external_module_2
include $(RIOTBASE)/Makefile.include

View File

@ -5,3 +5,7 @@ CONFIG_APP_MSG_1_TEXT="Message 1 defined in app.config file"
# enable printing message 2
CONFIG_APP_MSG_2=y
# enable configuration of external modules via kconfig
CONFIG_KCONFIG_EXTERNAL_MODULE_1=y
CONFIG_KCONFIG_EXTERNAL_MODULE_2=y

View File

@ -0,0 +1,13 @@
menuconfig KCONFIG_EXTERNAL_MODULE_1
bool "Configure external module message 1"
default y
help
This will enable configuring the external module message
if KCONFIG_EXTERNAL_MODULE_1
config EXTERNAL_MODULE_1_MESSAGE
string "External module 1 text"
default "External Message 1 defined in Kconfig file"
endif # KCONFIG_EXTERNAL_MODULE_1

View File

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

View File

@ -0,0 +1,3 @@
# Use an immediate variable to evaluate `MAKEFILE_LIST` now
USEMODULE_INCLUDES_external_module_1 := $(LAST_MAKEFILEDIR)/include
USEMODULE_INCLUDES += $(USEMODULE_INCLUDES_external_module_1)

View File

@ -0,0 +1,39 @@
/*
* Copyright (C) 2021 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.
*/
/**
* @defgroup
* @ingroup
* @brief
* @{
*
* @file
* @brief
*
* @author Francisco Molina <francois-xavier.molina@inria.fr>
*
* @}
*/
#ifndef EXTERNAL_MODULE_1_H
#define EXTERNAL_MODULE_1_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef CONFIG_EXTERNAL_MODULE_1_MESSAGE
#define CONFIG_EXTERNAL_MODULE_1_MESSAGE "this should not show"
#endif
#ifdef __cplusplus
}
#endif
/** @} */
#endif /* EXTERNAL_MODULE_1_H */

View File

@ -0,0 +1,13 @@
menuconfig KCONFIG_EXTERNAL_MODULE_2
bool "Configure external module message 2"
default y
help
This will enable configuring the external module message
if KCONFIG_EXTERNAL_MODULE_2
config EXTERNAL_MODULE_2_MESSAGE
string "External module 2 text"
default "External Message 2 defined in Kconfig file"
endif # KCONFIG_EXTERNAL_MODULE_2

View File

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

View File

@ -0,0 +1,3 @@
# Use an immediate variable to evaluate `MAKEFILE_LIST` now
USEMODULE_INCLUDES_external_module_2 := $(LAST_MAKEFILEDIR)/include
USEMODULE_INCLUDES += $(USEMODULE_INCLUDES_external_module_2)

View File

@ -0,0 +1,39 @@
/*
* Copyright (C) 2021 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.
*/
/**
* @defgroup
* @ingroup
* @brief
* @{
*
* @file
* @brief
*
* @author Francisco Molina <francois-xavier.molina@inria.fr>
*
* @}
*/
#ifndef EXTERNAL_MODULE_2_H
#define EXTERNAL_MODULE_2_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef CONFIG_EXTERNAL_MODULE_2_MESSAGE
#define CONFIG_EXTERNAL_MODULE_2_MESSAGE "this should not show either"
#endif
#ifdef __cplusplus
}
#endif
/** @} */
#endif /* EXTERNAL_MODULE_2_H */

View File

@ -22,6 +22,8 @@
#include <stdint.h>
#include "app.h"
#include "kernel_defines.h"
#include "external_module_1.h"
#include "external_module_2.h"
int main(void)
{
@ -30,5 +32,9 @@ int main(void)
if (IS_ACTIVE(CONFIG_APP_MSG_2)) {
puts("MSG_2 is active");
}
puts(CONFIG_EXTERNAL_MODULE_1_MESSAGE);
puts(CONFIG_EXTERNAL_MODULE_2_MESSAGE);
return 0;
}

View File

@ -13,6 +13,8 @@ from testrunner import run
def testfunc(child):
child.expect_exact("Message 1 defined in app.config file")
child.expect_exact("MSG_2 is active")
child.expect_exact("External Message 1 defined in Kconfig file")
child.expect_exact("External Message 2 defined in Kconfig file")
if __name__ == "__main__":