From 7bac10f13d9a9087abc4ff7a582762157c2c4dbd Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Fri, 26 May 2023 15:47:50 +0200 Subject: [PATCH] dist/tools/buildsystem_sanity_check: add check for tests subdirs --- dist/tools/buildsystem_sanity_check/check.sh | 27 ++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/dist/tools/buildsystem_sanity_check/check.sh b/dist/tools/buildsystem_sanity_check/check.sh index 7e7f2cbf6e..4884e5fb5b 100755 --- a/dist/tools/buildsystem_sanity_check/check.sh +++ b/dist/tools/buildsystem_sanity_check/check.sh @@ -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 '' } @@ -383,6 +409,7 @@ all_checks() { check_no_pkg_source_local check_no_riot_config check_stderr_null + check_tests_application_path } main() {