1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

buildsystem: Kconfig test for EXTERNAL_PKG_DIRS feature

This commit is contained in:
NikLeberg 2022-02-01 12:57:03 +00:00
parent a411841322
commit 127f039f19
13 changed files with 169 additions and 0 deletions

View File

@ -4,6 +4,10 @@ USEMODULE += external_module_1
USEMODULE += external_module_2
EXTERNAL_MODULE_DIRS += external_modules
USEPKG += external_pkg_1
USEPKG += external_pkg_2
EXTERNAL_PKG_DIRS += external_pkgs
ifeq (1, $(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(APPDIR)/app.config
endif

View File

@ -9,3 +9,7 @@ CONFIG_APP_MSG_2=y
# enable configuration of external modules via kconfig
CONFIG_KCONFIG_EXTERNAL_MODULE_1=y
CONFIG_KCONFIG_EXTERNAL_MODULE_2=y
# enable configuration of external packages via kconfig
CONFIG_KCONFIG_EXTERNAL_PKG_1=y
CONFIG_KCONFIG_EXTERNAL_PKG_2=y

View File

@ -1,2 +1,4 @@
CONFIG_MODULE_EXTERNAL_MODULE_1=y
CONFIG_MODULE_EXTERNAL_MODULE_2=y
CONFIG_PACKAGE_EXTERNAL_PKG_1=y
CONFIG_PACKAGE_EXTERNAL_PKG_2=y

View File

@ -0,0 +1,17 @@
menuconfig KCONFIG_EXTERNAL_PKG_1
bool "Configure external package message 1"
default y
help
This will enable configuring the external package message
if KCONFIG_EXTERNAL_PKG_1
config EXTERNAL_PKG_1_MESSAGE
string "External package 1 text"
default "External package message 1 defined in Kconfig file"
endif # KCONFIG_EXTERNAL_PKG_1
config PACKAGE_EXTERNAL_PKG_1
bool "Select external pkg 1"
depends on TEST_KCONFIG

View File

@ -0,0 +1,16 @@
PKG_NAME = external_pkg_1
include $(RIOTBASE)/Makefile.base
.PHONY: all prepare clean distclean
all: prepare
prepare:
@:
clean::
rm -rf $(BINDIR)/pkg/$(PKG_NAME)
distclean::
rm -rf $(BINDIR)/pkg/$(PKG_NAME)

View File

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

View File

@ -0,0 +1,40 @@
/*
* Copyright (C) 2022 Niklaus Leuenberger
*
* 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>
* @author NikLeberg <niklaus.leuenb+github@gmail.com>
*
* @}
*/
#ifndef EXTERNAL_PKG_1_H
#define EXTERNAL_PKG_1_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef CONFIG_EXTERNAL_PKG_1_MESSAGE
#define CONFIG_EXTERNAL_PKG_1_MESSAGE "this should not show"
#endif
#ifdef __cplusplus
}
#endif
/** @} */
#endif /* EXTERNAL_PKG_1_H */

View File

@ -0,0 +1,17 @@
menuconfig KCONFIG_EXTERNAL_PKG_2
bool "Configure external package message 2"
default y
help
This will enable configuring the external package message
if KCONFIG_EXTERNAL_PKG_2
config EXTERNAL_PKG_2_MESSAGE
string "External package 2 text"
default "External package message 2 defined in Kconfig file"
endif # KCONFIG_EXTERNAL_PKG_2
config PACKAGE_EXTERNAL_PKG_2
bool "Select external pkg 2"
depends on TEST_KCONFIG

View File

@ -0,0 +1,16 @@
PKG_NAME = external_pkg_2
include $(RIOTBASE)/Makefile.base
.PHONY: all prepare clean distclean
all: prepare
prepare:
@:
clean::
rm -rf $(BINDIR)/pkg/$(PKG_NAME)
distclean::
rm -rf $(BINDIR)/pkg/$(PKG_NAME)

View File

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

View File

@ -0,0 +1,40 @@
/*
* Copyright (C) 2022 Niklaus Leuenberger
*
* 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>
* @author NikLeberg <niklaus.leuenb+github@gmail.com>
*
* @}
*/
#ifndef EXTERNAL_PKG_2_H
#define EXTERNAL_PKG_2_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef CONFIG_EXTERNAL_PKG_2_MESSAGE
#define CONFIG_EXTERNAL_PKG_2_MESSAGE "this should not show"
#endif
#ifdef __cplusplus
}
#endif
/** @} */
#endif /* EXTERNAL_PKG_2_H */

View File

@ -24,6 +24,8 @@
#include "kernel_defines.h"
#include "external_module_1.h"
#include "external_module_2.h"
#include "external_pkg_1.h"
#include "external_pkg_2.h"
int main(void)
{
@ -36,5 +38,8 @@ int main(void)
puts(CONFIG_EXTERNAL_MODULE_1_MESSAGE);
puts(CONFIG_EXTERNAL_MODULE_2_MESSAGE);
puts(CONFIG_EXTERNAL_PKG_1_MESSAGE);
puts(CONFIG_EXTERNAL_PKG_2_MESSAGE);
return 0;
}

View File

@ -15,6 +15,8 @@ def testfunc(child):
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")
child.expect_exact("External package message 1 defined in Kconfig file")
child.expect_exact("External package message 2 defined in Kconfig file")
if __name__ == "__main__":