Skip to content

Commit 116332d

Browse files
committed
Added tests for forwards and backwards disk compatibility
This is a bit tricky since we need two different version of littlefs in order to test for most compatibility concerns. Fortunately we already have scripts/changeprefix.py for version-specific symbols, so it's not that hard to link in the previous version of littlefs in CI as a separate set of symbols, "lfsp_" in this case. So that we can at least test the compatibility tests locally, I've added an ifdef against the expected define "LFSP" to define a set of aliases mapping "lfsp_" symbols to "lfs_" symbols. This is manual at the moment, and a bit hacky, but gets the job done. --- Also changed BUILDDIR creation to derive subdirectories from a few Makefile variables. This makes the subdirectories less manual and more flexible for things like LFSP. Note this wasn't possible until BUILDDIR was changed to default to "." when omitted.
1 parent f0cc1db commit 116332d

File tree

2 files changed

+1294
-11
lines changed

2 files changed

+1294
-11
lines changed

Makefile

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
1-
ifdef BUILDDIR
2-
# bit of a hack, but we want to make sure BUILDDIR directory structure
3-
# is correct before any commands
4-
$(if $(findstring n,$(MAKEFLAGS)),, $(shell mkdir -p \
5-
$(BUILDDIR)/ \
6-
$(BUILDDIR)/bd \
7-
$(BUILDDIR)/runners \
8-
$(BUILDDIR)/tests \
9-
$(BUILDDIR)/benches))
10-
endif
1+
# overrideable build dir, default is in-place
112
BUILDDIR ?= .
12-
133
# overridable target/src/tools/flags/etc
144
ifneq ($(wildcard test.c main.c),)
155
TARGET ?= $(BUILDDIR)/lfs
@@ -163,6 +153,18 @@ TESTFLAGS += --perf-path="$(PERF)"
163153
BENCHFLAGS += --perf-path="$(PERF)"
164154
endif
165155

156+
# this is a bit of a hack, but we want to make sure the BUILDDIR
157+
# directory structure is correct before we run any commands
158+
ifneq ($(BUILDDIR),.)
159+
$(if $(findstring n,$(MAKEFLAGS)),, $(shell mkdir -p \
160+
$(addprefix $(BUILDDIR)/,$(dir \
161+
$(SRC) \
162+
$(TESTS) \
163+
$(TEST_SRC) \
164+
$(BENCHES) \
165+
$(BENCH_SRC)))))
166+
endif
167+
166168

167169
# commands
168170

@@ -514,6 +516,9 @@ $(BUILDDIR)/runners/bench_runner: $(BENCH_OBJ)
514516
$(BUILDDIR)/%.o $(BUILDDIR)/%.ci: %.c
515517
$(CC) -c -MMD $(CFLAGS) $< -o $(BUILDDIR)/$*.o
516518

519+
$(BUILDDIR)/%.o $(BUILDDIR)/%.ci: $(BUILDDIR)/%.c
520+
$(CC) -c -MMD $(CFLAGS) $< -o $(BUILDDIR)/$*.o
521+
517522
$(BUILDDIR)/%.s: %.c
518523
$(CC) -S $(CFLAGS) $< -o $@
519524

0 commit comments

Comments
 (0)