Skip to content

Commit 6e53da7

Browse files
committed
Add Makefile template for GNU API tests
Signed-off-by: Jerry Zhang Jian <[email protected]>
1 parent dfaf3eb commit 6e53da7

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

gnu-test-setup/Makefile.gnu

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
TESTSUITE ?= TESTSUITE_PATH
2+
RUNTEST := $(shell command -v runtest || echo "")
3+
4+
ifeq ($(RUNTEST),)
5+
$(error "Error: runtest not found in PATH")
6+
endif
7+
8+
# SELECTED_TEST is similar to $(EXP)=$(TEST), this is easier for
9+
# test-driver to pass the options
10+
# Please see "How can you run the testsuite on selected tests?" secion in
11+
# https://gcc.gnu.org/install/test.html
12+
# to find how to select tests.
13+
SELECTED_TEST:=
14+
15+
TEST_TARGET:=gcc g++
16+
PWD:=$(shell pwd)
17+
18+
.PHONY: all check clean
19+
20+
21+
all: $(addsuffix .sum, $(TEST_TARGET))
22+
23+
check: all
24+
25+
gcc-parallel-%: site.exp
26+
mkdir -p gcc/$@
27+
cp site.exp gcc/$@
28+
sed -i 's/set tmpdir.*/set tmpdir "$(subst /,\/,$(PWD))\/gcc\/$@"/g' $(PWD)/gcc/$@/site.exp
29+
-cd gcc/$@ && $(RUNTEST) --tool gcc $(RUNTESTFLAGS) $(SELECTED_TEST)
30+
touch $$GCC_RUNTEST_PARALLELIZE_DIR/finished
31+
32+
g++-parallel-%: site.exp
33+
mkdir -p g++/$@
34+
cp site.exp g++/$@
35+
sed -i 's/set tmpdir.*/set tmpdir "$(subst /,\/,$(PWD))\/g++\/$@"/g' $(PWD)/g++/$@/site.exp
36+
-cd g++/$@ && $(RUNTEST) --tool g++ $(RUNTESTFLAGS) $(SELECTED_TEST)
37+
touch $$GCC_RUNTEST_PARALLELIZE_DIR/finished
38+
39+
gcc.sum: site.exp
40+
rm -rf $(PWD)/gcc/gcc-parallel
41+
mkdir -p $(PWD)/gcc/gcc-parallel
42+
export GCC_RUNTEST_PARALLELIZE_DIR=$(PWD)/gcc/gcc-parallel; \
43+
$(MAKE) $(addprefix gcc-parallel-,$(shell seq 40))
44+
-cd gcc && python3 $(TESTSUITE)/dg-extract-results.py -L */gcc.log > gcc.log
45+
-cd gcc && python3 $(TESTSUITE)/dg-extract-results.py */gcc.sum > gcc.sum
46+
cp gcc/gcc.log .
47+
cp gcc/gcc.sum .
48+
49+
g++.sum: site.exp
50+
rm -rf $(PWD)/g++/g++-parallel
51+
mkdir -p $(PWD)/g++/g++-parallel
52+
export GCC_RUNTEST_PARALLELIZE_DIR=$(PWD)/g++/g++-parallel; \
53+
$(MAKE) $(addprefix g++-parallel-,$(shell seq 40))
54+
-cd g++ && python3 $(TESTSUITE)/dg-extract-results.py -L */g++.log > g++.log
55+
-cd g++ && python3 $(TESTSUITE)/dg-extract-results.py */g++.sum > g++.sum
56+
cp g++/g++.log .
57+
cp g++/g++.sum .
58+
59+
clean:
60+
rm -rf *.log *.sum *.bc *.s gcc g++

0 commit comments

Comments
 (0)