Skip to content

Commit

Permalink
Add Makefile template for GNU API tests
Browse files Browse the repository at this point in the history
Signed-off-by: Jerry Zhang Jian <jerry.zhangjian@sifive.com>
  • Loading branch information
jerryzj committed Feb 25, 2025
1 parent dfaf3eb commit 6e53da7
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions gnu-test-setup/Makefile.gnu
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
TESTSUITE ?= TESTSUITE_PATH
RUNTEST := $(shell command -v runtest || echo "")

ifeq ($(RUNTEST),)
$(error "Error: runtest not found in PATH")
endif

# SELECTED_TEST is similar to $(EXP)=$(TEST), this is easier for
# test-driver to pass the options
# Please see "How can you run the testsuite on selected tests?" secion in
# https://gcc.gnu.org/install/test.html
# to find how to select tests.
SELECTED_TEST:=

TEST_TARGET:=gcc g++
PWD:=$(shell pwd)

.PHONY: all check clean


all: $(addsuffix .sum, $(TEST_TARGET))

check: all

gcc-parallel-%: site.exp
mkdir -p gcc/$@
cp site.exp gcc/$@
sed -i 's/set tmpdir.*/set tmpdir "$(subst /,\/,$(PWD))\/gcc\/$@"/g' $(PWD)/gcc/$@/site.exp
-cd gcc/$@ && $(RUNTEST) --tool gcc $(RUNTESTFLAGS) $(SELECTED_TEST)
touch $$GCC_RUNTEST_PARALLELIZE_DIR/finished

g++-parallel-%: site.exp
mkdir -p g++/$@
cp site.exp g++/$@
sed -i 's/set tmpdir.*/set tmpdir "$(subst /,\/,$(PWD))\/g++\/$@"/g' $(PWD)/g++/$@/site.exp
-cd g++/$@ && $(RUNTEST) --tool g++ $(RUNTESTFLAGS) $(SELECTED_TEST)
touch $$GCC_RUNTEST_PARALLELIZE_DIR/finished

gcc.sum: site.exp
rm -rf $(PWD)/gcc/gcc-parallel
mkdir -p $(PWD)/gcc/gcc-parallel
export GCC_RUNTEST_PARALLELIZE_DIR=$(PWD)/gcc/gcc-parallel; \
$(MAKE) $(addprefix gcc-parallel-,$(shell seq 40))
-cd gcc && python3 $(TESTSUITE)/dg-extract-results.py -L */gcc.log > gcc.log
-cd gcc && python3 $(TESTSUITE)/dg-extract-results.py */gcc.sum > gcc.sum
cp gcc/gcc.log .
cp gcc/gcc.sum .

g++.sum: site.exp
rm -rf $(PWD)/g++/g++-parallel
mkdir -p $(PWD)/g++/g++-parallel
export GCC_RUNTEST_PARALLELIZE_DIR=$(PWD)/g++/g++-parallel; \
$(MAKE) $(addprefix g++-parallel-,$(shell seq 40))
-cd g++ && python3 $(TESTSUITE)/dg-extract-results.py -L */g++.log > g++.log
-cd g++ && python3 $(TESTSUITE)/dg-extract-results.py */g++.sum > g++.sum
cp g++/g++.log .
cp g++/g++.sum .

clean:
rm -rf *.log *.sum *.bc *.s gcc g++

0 comments on commit 6e53da7

Please sign in to comment.