1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/tests/build_system_utils/Makefile
Gaëtan Harter 765f3e9327
makefiles/utils: functions for lowercase and uppercase
Add make only function to convert strings to lowercase and uppercase.
This can replace the `$(shell echo $(var) | tr 'a-z-' 'A-Z_')` pattern.
Using the 'make' implementation results in being around 100 times faster.
2019-08-29 13:59:31 +02:00

52 lines
1.7 KiB
Makefile

BOARD_WHITELIST = native
include ../Makefile.tests_common
include $(RIOTBASE)/Makefile.include
# Test utils commands
define command_should_fail
$1 2>/dev/null && { echo "Command '$1' should have failed but did not" >&2; $1; exit 1; } || true
endef
define command_should_succeed
$1 || { echo "Command '$1' failed" >&2; $1; exit 1; }
endef
MAKEFILES_UTILS = $(RIOTMAKE)/utils
COMPILE_TESTS += test-ensure_value test-ensure_value-negative
COMPILE_TESTS += test-exported-variables
COMPILE_TESTS += test-memoized-variables
COMPILE_TESTS += test-lowercase
COMPILE_TESTS += test-uppercase
COMPILE_TESTS += test-uppercase_and_underscore
# Tests will be run both in the host machine and in `docker`
all: build-system-utils-tests
build-system-utils-tests: $(COMPILE_TESTS)
.PHONY: build-system-utils-tests $(COMPILE_TESTS)
# tests for 'ensure_value'
test-ensure_value:
$(Q)$(call command_should_succeed,"$(MAKE)" -C $(MAKEFILES_UTILS) -f test-checks.mk test-ensure_value)
test-ensure_value-negative:
$(Q)$(call command_should_fail,"$(MAKE)" -C $(MAKEFILES_UTILS) -f test-checks.mk test-ensure_value-negative)
test-exported-variables:
$(Q)$(call command_should_succeed,"$(MAKE)" -C $(MAKEFILES_UTILS) -f test-variables.mk test-exported-variables)
test-memoized-variables:
$(Q)$(call command_should_succeed,"$(MAKE)" -C $(MAKEFILES_UTILS) -f test-variables.mk test-memoized-variables)
test-lowercase:
$(Q)$(call command_should_succeed,"$(MAKE)" -C $(MAKEFILES_UTILS) -f test-strings.mk test-lowercase)
test-uppercase:
$(Q)$(call command_should_succeed,"$(MAKE)" -C $(MAKEFILES_UTILS) -f test-strings.mk test-uppercase)
test-uppercase_and_underscore:
$(Q)$(call command_should_succeed,"$(MAKE)" -C $(MAKEFILES_UTILS) -f test-strings.mk test-uppercase_and_underscore)