diff --git a/tests/cortexm_common_ldscript/Makefile b/tests/cortexm_common_ldscript/Makefile
index 5bd527ef86f6270aeeb1f1b18741ddb340a0e10f..d04e375c710eeb8baab216e2ffb10a4a32b3c58e 100644
--- a/tests/cortexm_common_ldscript/Makefile
+++ b/tests/cortexm_common_ldscript/Makefile
@@ -27,7 +27,10 @@ include $(RIOTBASE)/Makefile.include
 COMPILE_TESTS  = test-elffile-overflow test-elffile-fw_rom_length
 COMPILE_TESTS += tests-offsets tests-fw_rom_len tests-rom-overflow
 
+# The tests should only be executed in build environment
+ifneq ($(BUILD_IN_DOCKER),1)
 all: compile-tests
+endif
 
 compile-tests: $(COMPILE_TESTS)
 .PHONY: compile-tests $(COMPILE_TESTS)