Pārlūkot izejas kodu

Reduced build sources to just the core littlefs

Currently this is just lfs.c and lfs_util.c. Previously this included
the block devices, but this meant all of the scripts needed to
explicitly deselect the block devices to avoid reporting build
size/coverage info on them.

Note that test.py still explicitly adds the block devices for compiling
tests, which is their main purpose. Humorously this means the block
devices will probably be compiled into most builds in this repo anyways.
Christopher Haster 5 gadi atpakaļ
vecāks
revīzija
104d65113d
3 mainītis faili ar 8 papildinājumiem un 17 dzēšanām
  1. 1 13
      .github/workflows/test.yml
  2. 2 2
      Makefile
  3. 5 2
      scripts/test.py

+ 1 - 13
.github/workflows/test.yml

@@ -138,14 +138,7 @@ jobs:
 #          make test TESTFLAGS+="-nrk \
 #          make test TESTFLAGS+="-nrk \
 #            -DLFS_READ_SIZE=11 -DLFS_BLOCK_SIZE=704"
 #            -DLFS_READ_SIZE=11 -DLFS_BLOCK_SIZE=704"
 
 
-      # collect coverage
-      - name: collect-coverage
-        continue-on-error: true
-        run: |
-          # we only care about littlefs's actual source
-          lcov -e coverage/${{github.job}}-${{matrix.arch}}.info \
-            $(for f in lfs*.c ; do echo "/$f" ; done) \
-            -o coverage/${{github.job}}-${{matrix.arch}}.info
+      # upload coveragefor later coverage
       - name: upload-coverage
       - name: upload-coverage
         continue-on-error: true
         continue-on-error: true
         uses: actions/upload-artifact@v2
         uses: actions/upload-artifact@v2
@@ -159,10 +152,8 @@ jobs:
         continue-on-error: true
         continue-on-error: true
         run: |
         run: |
           mkdir -p results
           mkdir -p results
-          # TODO remove the need for SRC
           make clean
           make clean
           make code \
           make code \
-            SRC="$(echo lfs*.c)" \
             CFLAGS+=" \
             CFLAGS+=" \
               -DLFS_NO_ASSERT \
               -DLFS_NO_ASSERT \
               -DLFS_NO_DEBUG \
               -DLFS_NO_DEBUG \
@@ -175,7 +166,6 @@ jobs:
           mkdir -p results
           mkdir -p results
           make clean
           make clean
           make code \
           make code \
-            SRC="$(echo lfs*.c)" \
             CFLAGS+=" \
             CFLAGS+=" \
               -DLFS_NO_ASSERT \
               -DLFS_NO_ASSERT \
               -DLFS_NO_DEBUG \
               -DLFS_NO_DEBUG \
@@ -189,7 +179,6 @@ jobs:
           mkdir -p results
           mkdir -p results
           make clean
           make clean
           make code \
           make code \
-            SRC="$(echo lfs*.c)" \
             CFLAGS+=" \
             CFLAGS+=" \
               -DLFS_NO_ASSERT \
               -DLFS_NO_ASSERT \
               -DLFS_NO_DEBUG \
               -DLFS_NO_DEBUG \
@@ -203,7 +192,6 @@ jobs:
           mkdir -p results
           mkdir -p results
           make clean
           make clean
           make code \
           make code \
-            SRC="$(echo lfs*.c)" \
             CFLAGS+=" \
             CFLAGS+=" \
               -DLFS_NO_ASSERT \
               -DLFS_NO_ASSERT \
               -DLFS_NO_DEBUG \
               -DLFS_NO_DEBUG \

+ 2 - 2
Makefile

@@ -24,7 +24,7 @@ CTAGS ?= ctags
 NM ?= nm
 NM ?= nm
 LCOV ?= lcov
 LCOV ?= lcov
 
 
-SRC ?= $(wildcard *.c bd/*.c)
+SRC ?= $(wildcard *.c)
 OBJ := $(SRC:%.c=$(BUILDDIR)%.o)
 OBJ := $(SRC:%.c=$(BUILDDIR)%.o)
 DEP := $(SRC:%.c=$(BUILDDIR)%.d)
 DEP := $(SRC:%.c=$(BUILDDIR)%.d)
 ASM := $(SRC:%.c=$(BUILDDIR)%.s)
 ASM := $(SRC:%.c=$(BUILDDIR)%.s)
@@ -71,7 +71,7 @@ size: $(OBJ)
 
 
 .PHONY: tags
 .PHONY: tags
 tags:
 tags:
-	$(CTAGS) --totals --c-types=+p $(shell find -name '*.h') $(SRC)
+	$(CTAGS) --totals --c-types=+p $(shell find -H -name '*.h') $(SRC)
 
 
 .PHONY: code
 .PHONY: code
 code: $(OBJ)
 code: $(OBJ)

+ 5 - 2
scripts/test.py

@@ -22,17 +22,20 @@ import signal
 
 
 TEST_PATHS = 'tests'
 TEST_PATHS = 'tests'
 RULES = """
 RULES = """
+# add block devices to sources
+TESTSRC ?= $(SRC) $(wildcard bd/*.c)
+
 define FLATTEN
 define FLATTEN
 %(path)s%%$(subst /,.,$(target)): $(target)
 %(path)s%%$(subst /,.,$(target)): $(target)
     ./scripts/explode_asserts.py $$< -o $$@
     ./scripts/explode_asserts.py $$< -o $$@
 endef
 endef
-$(foreach target,$(SRC),$(eval $(FLATTEN)))
+$(foreach target,$(TESTSRC),$(eval $(FLATTEN)))
 
 
 -include %(path)s*.d
 -include %(path)s*.d
 .SECONDARY:
 .SECONDARY:
 
 
 %(path)s.test: %(path)s.test.o \\
 %(path)s.test: %(path)s.test.o \\
-        $(foreach t,$(subst /,.,$(SRC:.c=.o)),%(path)s.$t)
+        $(foreach t,$(subst /,.,$(TESTSRC:.c=.o)),%(path)s.$t)
     $(CC) $(CFLAGS) $^ $(LFLAGS) -o $@
     $(CC) $(CFLAGS) $^ $(LFLAGS) -o $@
 
 
 # needed in case builddir is different
 # needed in case builddir is different