Skip to content

Commit

Permalink
Merge #19673
Browse files Browse the repository at this point in the history
19673: tools/build_system_sanity_check: add check to verify test applications are at the right place r=maribu a=aabadie



Co-authored-by: Alexandre Abadie <alexandre.abadie@inria.fr>
  • Loading branch information
bors[bot] and aabadie authored May 28, 2023
2 parents f08ab08 + 7bac10f commit e690ef4
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions dist/tools/buildsystem_sanity_check/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,32 @@ check_stderr_null() {
| error_with_message "Redirecting stderr and stdout to /dev/null is \`>/dev/null 2>&1\`; the other way round puts the old stderr to the new stdout."
}

# Test application directories that starts by the following strings are invalid
# and should moved to the corresponding tests subdirectory.
FORBIDDEN_TEST_DIRS=()
FORBIDDEN_TEST_DIRS+=('build_system')
FORBIDDEN_TEST_DIRS+=('core') # => move under tests/core
FORBIDDEN_TEST_DIRS+=('cpu') # => move under tests/cpu
FORBIDDEN_TEST_DIRS+=('driver') # => move under tests/drivers
FORBIDDEN_TEST_DIRS+=('gnrc') # => move under tests/net
FORBIDDEN_TEST_DIRS+=('periph') # => move under tests/periph
FORBIDDEN_TEST_DIRS+=('net') # => move under tests/net
FORBIDDEN_TEST_DIRS+=('pkg') # => move under tests/pkg
FORBIDDEN_TEST_DIRS+=('sys') # => move under tests/sys
FORBIDDEN_TEST_DIRS+=('vfs') # => move under tests/sys
FORBIDDEN_TEST_DIRS+=('xtimer') # => move under tests/sys
FORBIDDEN_TEST_DIRS+=('ztimer') # => move under tests/sys

check_tests_application_path() {
local patterns=()
patterns+=(-regex "^tests/bench_.*/Makefile")
for forbidden in "${FORBIDDEN_TEST_DIRS[@]}"; do
patterns+=(-o -regex "^tests/${forbidden}_.*/Makefile")
done

find tests/ -type f "${patterns[@]}" | error_with_message "Invalid application path in tests/"
}

error_on_input() {
! grep ''
}
Expand All @@ -383,6 +409,7 @@ all_checks() {
check_no_pkg_source_local
check_no_riot_config
check_stderr_null
check_tests_application_path
}

main() {
Expand Down

0 comments on commit e690ef4

Please sign in to comment.