[fs][tests] break some fs tests into their own module

Include the test modules if the overal virtual/test module is included.
Also set a new global build system var along with a configuration
variable.
This commit is contained in:
Travis Geiselbrecht
2022-04-25 22:20:29 -07:00
parent cb5ccee400
commit f6f43edc3c
7 changed files with 29 additions and 11 deletions

View File

@@ -7,6 +7,10 @@ MODULE_DEPS += lib/bio
MODULE_DEPS += lib/fs
MODULE_DEPS += lib/libcpp
ifeq ($(call TOBOOL,WITH_TESTS),true)
MODULE_DEPS += $(LOCAL_DIR)/test
endif
MODULE_SRCS += $(LOCAL_DIR)/dir.cpp
MODULE_SRCS += $(LOCAL_DIR)/fat.cpp
MODULE_SRCS += $(LOCAL_DIR)/file.cpp

9
lib/fs/fat/test/rules.mk Normal file
View File

@@ -0,0 +1,9 @@
LOCAL_DIR := $(GET_LOCAL_DIR)
MODULE := $(LOCAL_DIR)
MODULE_DEPS += lib/fs/fat
MODULE_SRCS += $(LOCAL_DIR)/test.cpp
include make/module.mk

0
lib/fs/fat/test/test.cpp Normal file
View File

View File

@@ -2,12 +2,14 @@ LOCAL_DIR := $(GET_LOCAL_DIR)
MODULE := $(LOCAL_DIR)
MODULE_SRCS += \
$(LOCAL_DIR)/spifs.c \
MODULE_SRCS += $(LOCAL_DIR)/spifs.c
MODULE_DEPS += \
lib/fs \
lib/cksum \
lib/bio
ifeq ($(call TOBOOL,WITH_TESTS),true)
MODULE_DEPS += $(LOCAL_DIR)/test
endif
MODULE_DEPS += lib/bio
MODULE_DEPS += lib/cksum
MODULE_DEPS += lib/fs
include make/module.mk

View File

@@ -2,9 +2,7 @@ include project/target/stm32f746g-disco.mk
include project/virtual/test.mk
include project/virtual/minip.mk
MODULES += \
lib/fs \
app/loader
MODULES += app/loader
include project/virtual/fs.mk

View File

@@ -1,10 +1,9 @@
# modules related to a file system layer
# modules related to a file system layer some file system implementations
MODULES += \
lib/fs \
lib/fs/ext2 \
lib/fs/fat \
lib/fs/spifs \
lib/fs/spifs/test \
lib/fs/memfs

View File

@@ -11,3 +11,9 @@ MODULES += \
lib/debugcommands \
lib/unittest \
lib/version
# set a build system variable for other modules to include test code
# on their own.
WITH_TESTS := true
GLOBAL_DEFINES += WITH_TESTS=1