Reworked unit tests for machine and renamed test_programs directory

This commit is contained in:
François Autin
2023-03-12 00:22:16 +01:00
parent 177abfe846
commit c75e2995e7
29 changed files with 24 additions and 48 deletions

38
test/Makefile.tests Normal file
View File

@@ -0,0 +1,38 @@
include $(TOPDIR)/Makefile.config
USERLIB = $(TOPDIR)/userlib
INCPATH += -I$(TOPDIR) -I$(USERLIB)
LDFLAGS = $(RISCV_LDFLAGS) -T $(USERLIB)/ldscript.lds
ASFLAGS = $(RISCV_ASFLAGS) $(INCPATH)
CFLAGS = $(RISCV_CFLAGS) $(INCPATH)
# Rules
%.o: %.s
$(RISCV_AS) $(ASFLAGS) -c $<
%.o: %.c
$(RISCV_GCC) $(CFLAGS) -c $<
%.dump: %.o
$(RISCV_OBJCOPY) -j .text -O $(DUMP_FORMAT) $< $@
%.guac: %.o
$(RISCV_LD) $(LDFLAGS) $+ -o $@
# Dependencies
.%.d: %.s
@echo Generating dependencies for $<
@$(SHELL) -ec '$(GCC) -x assembler-with-cpp -M $(ASFLAGS) $< \
| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
[ -s $@ ] || rm -f $@'
.%.d: %.c
@echo Generating dependencies for $<
@$(SHELL) -ec '$(GCC) -M $(CFLAGS) $< \
| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
[ -s $@ ] || rm -f $@'
# Targets
#clean:
# rm -rf *.o 2> /dev/null
# rm -rf *.dump 2> /dev/null
# rm -rf *.guac 2> /dev/null