mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
buildsystem: test for EXTERNAL_PKG_DIRS feature
This commit is contained in:
parent
9b95605f78
commit
242d9ed30d
6
tests/external_pkg_dirs/Makefile
Normal file
6
tests/external_pkg_dirs/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
include ../Makefile.tests_common
|
||||
|
||||
EXTERNAL_PKG_DIRS += external_pkgs
|
||||
USEPKG += external_pkg
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
16
tests/external_pkg_dirs/README.md
Normal file
16
tests/external_pkg_dirs/README.md
Normal file
@ -0,0 +1,16 @@
|
||||
external_pkg_dirs
|
||||
=================
|
||||
|
||||
Test application for the EXTERNAL_PKG_DIRS feature of the buildsystem.
|
||||
Two external packages are provided in `external_pkgs/`: `external_pkg` and
|
||||
`external_pkg_not_used`. If the first package is not properly included, a define
|
||||
from `CFLAGS` is missing and a precompiler error is triggered. If the second
|
||||
package somehow ends up included it triggers a makefile error.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
Set `EXTERNAL_PKG_DIRS` inside Makefile to point to other paths where the
|
||||
buildsystem can look for packages. Similar functionality to `EXTERNAL_PKG_DIRS`.
|
||||
Be careful to not name these externally provided packages the same as existing
|
||||
packages in `$(RIOTBASE)/pkg/`.
|
@ -0,0 +1,9 @@
|
||||
# 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.
|
||||
|
||||
config PACKAGE_EXTERNAL_PKG
|
||||
bool "external_pkg package"
|
||||
depends on TEST_KCONFIG
|
16
tests/external_pkg_dirs/external_pkgs/external_pkg/Makefile
Normal file
16
tests/external_pkg_dirs/external_pkgs/external_pkg/Makefile
Normal file
@ -0,0 +1,16 @@
|
||||
PKG_NAME = external_pkg
|
||||
|
||||
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)
|
@ -0,0 +1 @@
|
||||
CFLAGS += -DTEST_EXTERNAL_PKG
|
@ -0,0 +1,9 @@
|
||||
# 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.
|
||||
|
||||
config PACKAGE_EXTERNAL_PKG_NOT_USED
|
||||
bool "external_pkg_not_used package"
|
||||
depends on TEST_KCONFIG
|
@ -0,0 +1,19 @@
|
||||
PKG_NAME = external_pkg_not_used
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
|
||||
.PHONY: all prepare clean distclean
|
||||
|
||||
all:
|
||||
$(error target all for external_pkg_not_used executed)
|
||||
|
||||
prepare:
|
||||
$(error target prepare for external_pkg_not_used executed)
|
||||
|
||||
clean::
|
||||
rm -rf $(BINDIR)/pkg/$(PKG_NAME)
|
||||
$(error target clean for external_pkg_not_used executed)
|
||||
|
||||
distclean::
|
||||
rm -rf $(BINDIR)/pkg/$(PKG_NAME)
|
||||
$(error target distclean for external_pkg_not_used executed)
|
@ -0,0 +1 @@
|
||||
CFLAGS += -DTEST_EXTERNAL_PKG_NOT_USED
|
35
tests/external_pkg_dirs/main.c
Normal file
35
tests/external_pkg_dirs/main.c
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup tests
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief This is a test for the EXTERNAL_PKG_DIRS variable.
|
||||
*
|
||||
* @author Niklaus Leuenberger <niklaus.leuenb@gmail.com>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef TEST_EXTERNAL_PKG
|
||||
#error "Required external package not included."
|
||||
#endif
|
||||
|
||||
#ifdef TEST_EXTERNAL_PKG_NOT_USED
|
||||
#error "External package included that shouldn't be."
|
||||
#endif
|
||||
|
||||
int main(void)
|
||||
{
|
||||
puts("If it compiles, it works!");
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user