-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
44c312d
commit 270f33e
Showing
2 changed files
with
151 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,7 @@ endif | |
$(info TEST_DIR_PATH: ${TEST_DIR_PATH}) | ||
$(info TEST_DIR_PATH realpath: $(realpath ${TEST_DIR_PATH})) | ||
$(info TEST_DIR_PATH abspath: $(abspath ${TEST_DIR_PATH})) | ||
$(info UNIQ_TESTNAME: ${UNIQ_TESTNAME}) | ||
|
||
TESTDIRS := $(wildcard *.testdir) | ||
|
||
|
@@ -49,6 +50,10 @@ CC := ${RISCV32_TOOL_PATH}/riscv32-unknown-elf-gcc | |
ASM := ${RISCV32_TOOL_PATH}/riscv32-unknown-elf-gcc | ||
LD := ${RISCV32_TOOL_PATH}/riscv32-unknown-elf-ld | ||
|
||
#CC := ${RISCV64_TOOL_PATH}/riscv64-unknown-elf-gcc | ||
#ASM := ${RISCV64_TOOL_PATH}/riscv64-unknown-elf-gcc | ||
#LD := ${RISCV64_TOOL_PATH}/riscv64-unknown-elf-ld | ||
|
||
|
||
|
||
all: | ||
|
@@ -79,30 +84,71 @@ build: | |
fi ; \ | ||
fi; | ||
|
||
# Convert gmsl assoc arrays into text suitable for bash assoc arrays | ||
ASM_FLAGS_AA_FOR_SH := $(foreach var,${TESTLIST},["$(var)"]="$(call get,ASM_FLAGS_AA,$(var))" ) | ||
CC_FLAGS_AA_FOR_SH := $(foreach var,${TESTLIST},["$(var)"]="$(call get,CC_FLAGS_AA,$(var))" ) | ||
LD_FLAGS_AA_FOR_SH := $(foreach var,${TESTLIST},["$(var)"]="$(call get,LD_FLAGS_AA,$(var))" ) | ||
RUN_FLAGS_AA_FOR_SH := $(foreach var,${TESTLIST},["$(var)"]="$(call get,RUN_FLAGS_AA,$(var))" ) | ||
|
||
build_tests : ${TESTLIST_BUILD} | ||
#${TESTLIST_BUILD} : | ||
# @echo "making \"$@\" in $$PWD" ; | ||
# @mkdir -p [email protected] || ( echo "unable to create [email protected]" >> test.failed ; exit $$? ; ) ; | ||
# @echo "calling \'make $@\'" ; | ||
# make $@ ; \ | ||
# if [ $$? -ne 0 ] ; \ | ||
# then \ | ||
# echo "\'make $@\' exited with nonzero exit status" >> [email protected]/test.failed ; \ | ||
# fi ; | ||
$(info ASM_FLAGS_AA_FOR_SH: ${ASM_FLAGS_AA_FOR_SH}) | ||
|
||
|
||
|
||
test : | ||
arr=(${OBJDIRS_SET}) ; \ | ||
echo "arr[]: $${arr[@]}"; | ||
testlist=(${TESTLIST}) ; \ | ||
echo "testlist[]: $${testlist[@]}"; | ||
declare -A asm_flags_aa=( ${ASM_FLAGS_AA_FOR_SH} ) ; \ | ||
echo "asm_flags_aa[]: $${asm_flags_aa[@]}"; \ | ||
declare -A cc_flags_aa=( ${CC_FLAGS_AA_FOR_SH} ) ; \ | ||
echo "cc_flags_aa[]: $${cc_flags_aa[@]}"; \ | ||
declare -A ld_flags_aa=( ${LD_FLAGS_AA_FOR_SH} ) ; \ | ||
echo "ld_flags_aa[]: $${ld_flags_aa[@]}"; \ | ||
declare -A run_flags_aa=( ${run_FLAGS_AA_FOR_SH} ) ; \ | ||
echo "run_flags_aa[]: $${runflags_aa[@]}"; | ||
|
||
.PHONY : ${TESTLIST} | ||
build_tests : ${TESTLIST} | ||
${TESTLIST} : | ||
@echo "making \"$@\" in $$PWD" ; | ||
mkdir -p [email protected] || ( echo "unable to create [email protected]" >> test.failed ; exit $$? ; ) ; | ||
declare -A asm_flags_aa=( ${ASM_FLAGS_AA_FOR_SH} ) ; \ | ||
declare -A cc_flags_aa=( ${CC_FLAGS_AA_FOR_SH} ) ; \ | ||
declare -A ld_flags_aa=( ${LD_FLAGS_AA_FOR_SH} ) ; \ | ||
declare -A run_flags_aa=( ${run_FLAGS_AA_FOR_SH} ) ; \ | ||
echo "calling \'make $@\'" ; \ | ||
echo "make [email protected]/test.elf ASM_FLAGS_NEXT=$${asm_flags_aa["$@"]} CC_FLAGS_NEXT=$${cc_flags_aa["$@"]} LD_FLAGS_NEXT=$${ld_flags_aa["$@"]}" ; \ | ||
make [email protected]/test.elf ASM_FLAGS_NEXT="$${asm_flags_aa[$@]}" CC_FLAGS_NEXT="$${cc_flags_aa[$@]}" LD_FLAGS_NEXT="$${ld_flags_aa[$@]}" ; \ | ||
if [ $$? -ne 0 ] ; \ | ||
then \ | ||
echo "\'make $@\' exited with nonzero exit status" >> [email protected]/test.failed ; \ | ||
fi ; | ||
|
||
$(info foo: $(call get,OBJS_AA,${UNIQ_TESTNAME})) | ||
$(info goo: $(call get,OBJDIR_AA,${UNIQ_TESTNAME})) | ||
$(info OBJDIRS_SET: ${OBJDIRS_SET}) | ||
OBJDIRS_OBJS := $(addsuffix /%.o,${OBJDIRS_SET}) | ||
$(info OBJDIRS_OBJS: ${OBJDIRS_OBJS}) | ||
|
||
#$(call get,OBJDIR_AA,${UNIQ_TESTNAME})/%.o : %.s %.S | ||
$(call get,OBJDIR_AA,${UNIQ_TESTNAME})/%.o : %.S | ||
#$(call get,OBJDIR_AA,${UNIQ_TESTNAME})/%.o : %.S | ||
${OBJDIRS_OBJS} : %.S | ||
@echo "making \"$@\" in $$PWD" ; | ||
@mkdir -p $(call get,OBJDIR_AA,${UNIQ_TESTNAME}) || ( echo "unable to create [email protected]" >> test.failed ; exit $$? ; ) ; | ||
${ASM} -c $(call get,ASM_FLAGS_AA,${UNIQ_TESTNAME}) \ | ||
-o $@ \ | ||
$(call get,ASM_SRC_AA,${UNIQ_TESTNAME}) | ||
@echo "ASM_FLAGS_NEXT: ${ASM_FLAGS_NEXT}" ; | ||
@mkdir -p $(dir $@) || ( echo "unable to create [email protected]" >> test.failed ; exit $$? ; ) ; | ||
${ASM} -c ${ASM_FLAGS_NEXT} -o $@ $< | ||
|
||
${OBJDIRS_OBJS} : %.c | ||
@echo "making \"$@\" in $$PWD" ; | ||
@mkdir -p $(dir $@) || ( echo "unable to create [email protected]" >> test.failed ; exit $$? ; ) ; | ||
${CC} -c ${CC_FLAGS_NEXT} -o $@ $< | ||
|
||
|
||
$(call get,OBJDIR_AA,${UNIQ_TESTNAME})/test.elf : $(call get,OBJS_AA,${UNIQ_TESTNAME}) | ||
OBJS := $(addprefix %/,${OBJS_BASE}) | ||
#$(call get,OBJDIR_AA,${UNIQ_TESTNAME})/test.elf : $(call get,OBJS_AA,${UNIQ_TESTNAME}) | ||
%/test.elf : ${OBJS} | ||
@echo "making \"$@\" in $$PWD" ; | ||
${LD} $(call get,LD_FLAGS_AA,${UNIQ_TESTNAME}) -o $@ $< | ||
${LD} ${LD_FLAGS_NEXT} -o $@ $< | ||
|
||
|
||
install: | ||
|
@@ -133,28 +179,28 @@ run: | |
|
||
# Run in parallel (potentially, based on the -j switch to make) | ||
# TODO: also redirect stderr into test.failed | ||
.PHONY: ${TESTLIST} | ||
run_tests : ${TESTLIST} | ||
${TESTLIST} : | ||
@echo "making \"$@\"" ; | ||
@mkdir -p [email protected] || ( echo "unable to create [email protected]" >> test.failed ; exit $$? ; ) ; | ||
@if [ ! -e ${TEST_DIR_PATH}/../../c_emulator/riscv_sim_RV$(call get,XLEN_AA,$@) ] ; \ | ||
then \ | ||
echo "${TEST_DIR_PATH}/../../c_emulator/riscv_sim_RV$(call get,XLEN_AA,$@) does not exist." >> [email protected]/test.failed ; \ | ||
fi ; | ||
${TEST_DIR_PATH}/../../c_emulator/riscv_sim_RV$(call get,XLEN_AA,$@) $(call get,RUN_FLAGS_AA,$@) $(call get,OBJDIR_AA,${UNIQ_TESTNAME})/test.elf > [email protected]/test.run.stdout ; \ | ||
if [ $$? -ne 0 ] ; \ | ||
then \ | ||
echo "riscv_sim_$@.$(call get,XLEN_AA,$@) exited with nonzero exit status" >> [email protected]/test.failed ; \ | ||
fi ; | ||
@if [ ! -e [email protected]/test.run.stdout ] ; \ | ||
then \ | ||
echo "file, \"[email protected]/test.run.stdout\" not found" >> [email protected]/test.failed ; \ | ||
fi ; | ||
@if [ ! -e [email protected]/test.failed ] ; \ | ||
then \ | ||
echo "${PWD} passed" >> [email protected]/test.passed ; \ | ||
fi; | ||
#.PHONY: ${TESTLIST} | ||
#run_tests : ${TESTLIST} | ||
#${TESTLIST} : | ||
# @echo "making \"$@\"" ; | ||
# @mkdir -p [email protected] || ( echo "unable to create [email protected]" >> test.failed ; exit $$? ; ) ; | ||
# @if [ ! -e ${TEST_DIR_PATH}/../../c_emulator/riscv_sim_RV$(call get,XLEN_AA,$@) ] ; \ | ||
# then \ | ||
# echo "${TEST_DIR_PATH}/../../c_emulator/riscv_sim_RV$(call get,XLEN_AA,$@) does not exist." >> [email protected]/test.failed ; \ | ||
# fi ; | ||
# ${TEST_DIR_PATH}/../../c_emulator/riscv_sim_RV$(call get,XLEN_AA,$@) $(call get,RUN_FLAGS_AA,$@) $(call get,OBJDIR_AA,${UNIQ_TESTNAME})/test.elf > [email protected]/test.run.stdout ; \ | ||
# if [ $$? -ne 0 ] ; \ | ||
# then \ | ||
# echo "riscv_sim_$@.$(call get,XLEN_AA,$@) exited with nonzero exit status" >> [email protected]/test.failed ; \ | ||
# fi ; | ||
# @if [ ! -e [email protected]/test.run.stdout ] ; \ | ||
# then \ | ||
# echo "file, \"[email protected]/test.run.stdout\" not found" >> [email protected]/test.failed ; \ | ||
# fi ; | ||
# @if [ ! -e [email protected]/test.failed ] ; \ | ||
# then \ | ||
# echo "${PWD} passed" >> [email protected]/test.passed ; \ | ||
# fi; | ||
|
||
|
||
# Gather all the test results from this directory on down. | ||
|