forked from RIOT-OS/RIOT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add a test for buildir integration with docker
Add a test to verify that the build system correctly integrates 'build' with docker even if set outside of RIOTBASE.
- Loading branch information
Showing
3 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Only one board the goal is not the compilation but the build system | ||
# integration | ||
BOARD_WHITELIST = native | ||
|
||
include ../Makefile.tests_common | ||
include $(RIOTBASE)/Makefile.include | ||
|
||
|
||
.PHONY: test_file_in_build clean_file_in_build | ||
|
||
|
||
TESTFILE = $(BUILD_DIR)/tmp/output_$(APPLICATION) | ||
|
||
# Create the file as a dependency of an intermediate target | ||
# This ensures it is executed in docker | ||
$(ELFFILE): | $(TESTFILE) | ||
test: test_file_in_build | ||
clean: clean_file_in_build | ||
|
||
|
||
$(TESTFILE): Makefile # Rebuild if this Makefile changed | ||
$(Q)mkdir -p $(dir $(@)) | ||
$(Q)echo '$(APPLICATION)/$(BOARD)' > $@ | ||
|
||
test_file_in_build: | ||
test -f $(TESTFILE) && test $$(cat $(TESTFILE)) = '$(APPLICATION)/$(BOARD)' | ||
|
||
clean_file_in_build: | ||
$(Q)rm -rf $(dir $(TESTFILE)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Build system test: build directory | ||
================================== | ||
|
||
Test handling of the build directory within docker. | ||
|
||
This test is mainly done to test 'docker' integration to verify that the | ||
`BUILD_DIR` variable is correctly passed and mounted into docker. | ||
|
||
|
||
Usage | ||
----- | ||
|
||
The test can be run with | ||
|
||
make clean all test \ | ||
BUILD_DIR=/tmp/riot/build \ | ||
BUILD_IN_DOCKER=1 DOCKER='sudo docker' | ||
|
||
I used a directory outside of 'RIOT' to show that the directory is mounted in | ||
the container. | ||
A directory with an absolute path in RIOT should also fail but we can use a | ||
different one anyway. | ||
|
||
It can also be run without docker but does not really test anything. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright (C) 2018 Freie Universität Berlin | ||
* | ||
* 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 Empty application | ||
* | ||
* @author Gaëtan Harter <[email protected]> | ||
* | ||
* @} | ||
*/ | ||
|
||
int main(void) | ||
{ | ||
/* | ||
* The main part of the test is in the Makefile. See README.md for more | ||
* informations | ||
*/ | ||
return 0; | ||
} |