Skip to content

Commit 5c18987

Browse files
authored
Merge pull request adoptium#30 from renfeiw/master
Generate makefiles on the fly
2 parents 1f86f61 + 301558d commit 5c18987

11 files changed

+356
-134
lines changed

.gitignore

+34-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,34 @@
1-
/bin/
1+
# Licensed under the Apache License, Version 2.0 (the "License");
2+
# you may not use this file except in compliance with the License.
3+
# You may obtain a copy of the License at
4+
#
5+
# https://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS,
9+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
# See the License for the specific language governing permissions and
11+
# limitations under the License.
12+
13+
# java .class files
14+
*.class
15+
16+
# misc auto generated folders
17+
lib
18+
bin
19+
test_output_*
20+
21+
# misc auto generated files
22+
autoGen.mk
23+
dependencies.mk
24+
utils.mk
25+
count.mk
26+
*.log
27+
*.tap
28+
machineConfigure.mk
29+
tempTestTargetResult
30+
failedtargets.mk
31+
autoGenEnv.mk
32+
SHA.txt
33+
34+
.DS_Store

clean.mk

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
##############################################################################
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# https://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
##############################################################################
14+
15+
.DEFAULT_GOAL := clean
16+
17+
D = /
18+
19+
ifndef TEST_ROOT
20+
TEST_ROOT := $(shell pwd)$(D)..
21+
endif
22+
23+
include settings.mk
24+
25+
cleanBuild:
26+
$(RM) -r $(BUILD_ROOT)
27+
28+
clean: cleanBuild
29+
$(RM) -r $(TEST_ROOT)$(D)TKG$(D)test_output_*
30+
$(RM) $(FAILEDTARGETS)
31+
ant -f $(TEST_ROOT)$(D)TKG$(D)scripts/build_tools.xml clean
32+
33+
.PHONY: cleanBuild clean

compile.mk

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
##############################################################################
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# https://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
##############################################################################
14+
15+
.DEFAULT_GOAL := compile
16+
17+
D = /
18+
19+
ifndef TEST_ROOT
20+
TEST_ROOT := $(shell pwd)$(D)..
21+
endif
22+
23+
include settings.mk
24+
25+
#######################################
26+
# download all dependent jars
27+
#######################################
28+
getdependency:
29+
perl scripts$(D)getDependencies.pl -path '$(TEST_ROOT)$(D)TKG$(D)lib' -task default -os $(OS)
30+
31+
.PHONY: getdependency
32+
33+
#######################################
34+
# compile all tests under $(TEST_ROOT)
35+
#######################################
36+
COMPILATION_LOG=$(TESTOUTPUT)$(D)compile$(D)compilation.log
37+
MOVE_TDUMP_PERL=perl scripts$(D)moveDmp.pl --compileLogPath=$(Q)$(COMPILATION_LOG)$(Q) --testRoot=$(Q)$(TEST_ROOT)$(Q) --spec=$(Q)$(SPEC)$(Q)
38+
MOVE_TDUMP=if [ -z $$(tail -n 1 $(COMPILATION_LOG) | grep 0) ]; then $(MOVE_TDUMP_PERL); $(RM) $(Q)$(COMPILATION_LOG)$(Q); false; else $(RM) $(Q)$(COMPILATION_LOG)$(Q); fi
39+
COMPILE_CMD=ant -f scripts$(D)build_test.xml -DTEST_ROOT=$(TEST_ROOT) -DBUILD_ROOT=$(BUILD_ROOT) -DJDK_VERSION=$(JDK_VERSION) -DJDK_IMPL=$(JDK_IMPL) -DJCL_VERSION=$(JCL_VERSION) -DBUILD_LIST=${BUILD_LIST} -DRESOURCES_DIR=${RESOURCES_DIR} -DSPEC=${SPEC} -DTEST_JDK_HOME=${TEST_JDK_HOME} -DJVM_VERSION=$(JVM_VERSION) -DLIB_DIR=$(LIB_DIR)
40+
41+
compile: getdependency
42+
$(MKTREE) $(TESTOUTPUT)$(D)compile; \
43+
($(COMPILE_CMD) 2>&1; echo $$? ) | tee $(Q)$(COMPILATION_LOG)$(Q); \
44+
$(MOVE_TDUMP)
45+
46+
.PHONY: compile

makeGen.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ autoconfig:
3636
perl scripts$(D)configure.pl
3737

3838
autogen: autoconfig
39-
${TEST_JDK_HOME}/bin/java -cp ./bin/TestKitGen.jar org.testKitGen.MainRunner --spec=$(SPEC) --jdkVersion=$(JDK_VERSION) --impl=$(JDK_IMPL) --buildList=${BUILD_LIST} --iterations=$(TEST_ITERATIONS) --testFlag=$(TEST_FLAG) $(OPTS)
39+
${TEST_JDK_HOME}/bin/java -cp ./bin/TestKitGen.jar org.testKitGen.MainRunner --spec=$(SPEC) --jdkVersion=$(JDK_VERSION) --impl=$(JDK_IMPL) --buildList=${BUILD_LIST} --iterations=$(TEST_ITERATIONS) --testFlag=$(TEST_FLAG) --testTarget=$(TESTTARGET) $(OPTS)
4040

4141
AUTOGEN_FILES = $(wildcard $(CURRENT_DIR)$(D)jvmTest.mk)
4242
AUTOGEN_FILES += $(wildcard $(CURRENT_DIR)$(D)machineConfigure.mk)

makefile

+31-46
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# you may not use this file except in compliance with the License.
44
# You may obtain a copy of the License at
55
#
6-
# https://www.apache.org/licenses/LICENSE-2.0
6+
# https:$(D)$(D)www.apache.org$(D)licenses$(D)LICENSE-2.0
77
#
88
# Unless required by applicable law or agreed to in writing, software
99
# distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,7 +16,11 @@
1616
# Makefile to run various JVM tests
1717
#
1818

19-
.DEFAULT_GOAL := test
19+
ifndef TEST_JDK_HOME
20+
$(error Please provide TEST_JDK_HOME value.)
21+
else
22+
export TEST_JDK_HOME:=$(subst \,/,$(TEST_JDK_HOME))
23+
endif
2024

2125
D = /
2226

@@ -26,57 +30,38 @@ ifndef TEST_ROOT
2630
TEST_ROOT := $(shell pwd)$(D)..
2731
endif
2832

29-
include settings.mk
30-
31-
include count.mk
3233

3334
#######################################
34-
# run all tests under $(TEST_ROOT)
35+
# run test
3536
#######################################
36-
runtest:
37-
@$(MAKE) -C $(TEST_ROOT) -f autoGen.mk _all
38-
39-
.PHONY: runtest
40-
41-
test: compile runtest
42-
@$(ECHO) "All Tests Completed"
43-
44-
.PHONY: test
45-
46-
.NOTPARALLEL: test
47-
48-
failed:
49-
@$(MAKE) -f failedtargets.mk failed
50-
51-
.PHONY: failed
52-
53-
.NOTPARALLEL: failed
54-
55-
cleanBuild:
56-
$(RM) -r $(BUILD_ROOT)
57-
58-
clean: cleanBuild
59-
$(RM) -r $(TEST_ROOT)$(D)TKG$(D)test_output_*
60-
$(RM) $(FAILEDTARGETS)
61-
62-
.PHONY: cleanBuild clean
37+
_TESTTARGET = $(firstword $(MAKECMDGOALS))
38+
TESTTARGET = $(patsubst _%,%,$(_TESTTARGET))
39+
ifneq (compile, $(_TESTTARGET))
40+
ifneq (clean, $(_TESTTARGET))
41+
$(_TESTTARGET):
42+
$(MAKE) -f makeGen.mk AUTO_DETECT=$(AUTO_DETECT) TESTTARGET=$(TESTTARGET)
43+
$(MAKE) -f runtest.mk $(_TESTTARGET)
44+
endif
45+
endif
6346

6447
#######################################
65-
# download all dependent jars
48+
# compile
49+
# If AUTO_DETECT is turned on, compile and execute envDetector in build_envInfo.xml.
6650
#######################################
67-
getdependency:
68-
perl scripts$(D)getDependencies.pl -path '$(TEST_ROOT)$(D)TKG$(D)lib' -task default -os $(OS)
51+
compile:
52+
ant -f .$(D)scripts$(D)build_tools.xml -DTEST_JDK_HOME=$(TEST_JDK_HOME)
53+
ifneq ($(AUTO_DETECT), false)
54+
@echo "AUTO_DETECT is set to true"
55+
${TEST_JDK_HOME}$(D)bin$(D)java -cp .$(D)bin$(D)TestKitGen.jar org.openj9.envInfo.EnvDetector JavaInfo
56+
else
57+
@echo "AUTO_DETECT is set to false"
58+
endif
59+
$(MAKE) -f compile.mk compile
6960

7061
#######################################
71-
# compile all tests under $(TEST_ROOT)
62+
# clean
7263
#######################################
73-
COMPILATION_LOG=$(TESTOUTPUT)$(D)compile$(D)compilation.log
74-
75-
MOVE_TDUMP_PERL=perl scripts$(D)moveDmp.pl --compileLogPath=$(Q)$(COMPILATION_LOG)$(Q) --testRoot=$(Q)$(TEST_ROOT)$(Q) --spec=$(Q)$(SPEC)$(Q)
76-
MOVE_TDUMP=if [ -z $$(tail -n 1 $(COMPILATION_LOG) | grep 0) ]; then $(MOVE_TDUMP_PERL); $(RM) $(Q)$(COMPILATION_LOG)$(Q); false; else $(RM) $(Q)$(COMPILATION_LOG)$(Q); fi
77-
COMPILE_CMD=ant -f scripts$(D)build_test.xml -DTEST_ROOT=$(TEST_ROOT) -DBUILD_ROOT=$(BUILD_ROOT) -DJDK_VERSION=$(JDK_VERSION) -DJDK_IMPL=$(JDK_IMPL) -DJCL_VERSION=$(JCL_VERSION) -DBUILD_LIST=${BUILD_LIST} -DRESOURCES_DIR=${RESOURCES_DIR} -DPLATFORM=${PLATFORM} -DTEST_JDK_HOME=${TEST_JDK_HOME} -DJVM_VERSION=$(JVM_VERSION) -DLIB_DIR=$(LIB_DIR)
64+
clean:
65+
$(MAKE) -f clean.mk clean
7866

79-
compile: getdependency; \
80-
$(MKTREE) $(TESTOUTPUT)$(D)compile; \
81-
($(COMPILE_CMD) 2>&1; echo $$? ) | tee $(Q)$(COMPILATION_LOG)$(Q); \
82-
$(MOVE_TDUMP)
67+
.PHONY: clean

run_configure.mk

+5-6
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,20 @@
1919

2020
.PHONY: testconfig
2121

22+
D = /
23+
2224
ifndef TEST_JDK_HOME
2325
$(error Please provide TEST_JDK_HOME value.)
2426
else
2527
export TEST_JDK_HOME:=$(subst \,/,$(TEST_JDK_HOME))
2628
endif
2729

2830
testconfig:
29-
ant -f ./scripts/build_tools.xml -DTEST_JDK_HOME=$(TEST_JDK_HOME)
31+
ant -f .$(D)scripts$(D)build_tools.xml -DTEST_JDK_HOME=$(TEST_JDK_HOME)
3032
ifneq ($(AUTO_DETECT), false)
3133
@echo "AUTO_DETECT is set to true"
32-
${TEST_JDK_HOME}/bin/java -cp ./bin/TestKitGen.jar org.openj9.envInfo.EnvDetector JavaInfo
34+
${TEST_JDK_HOME}$(D)bin$(D)java -cp .$(D)bin$(D)TestKitGen.jar org.openj9.envInfo.EnvDetector JavaInfo
3335
else
3436
@echo "AUTO_DETECT is set to false"
3537
endif
36-
$(MAKE) -f makeGen.mk AUTO_DETECT=$(AUTO_DETECT)
37-
38-
clean:
39-
ant -f ./scripts/build_tools.xml clean
38+
$(MAKE) -f makeGen.mk AUTO_DETECT=$(AUTO_DETECT) TESTTARGET=$(TESTTARGET)

runtest.mk

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
##############################################################################
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# https://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
##############################################################################
14+
15+
#
16+
# Makefile to run various JVM tests
17+
#
18+
19+
.DEFAULT_GOAL := test
20+
21+
D = /
22+
23+
SUBDIRS = ..
24+
25+
ifndef TEST_ROOT
26+
TEST_ROOT := $(shell pwd)$(D)..
27+
endif
28+
29+
include settings.mk
30+
31+
include count.mk
32+
33+
runtest:
34+
@$(MAKE) -C $(TEST_ROOT) -f autoGen.mk _all
35+
36+
.PHONY: runtest
37+
38+
test: compile runtest
39+
@$(ECHO) "All Tests Completed"
40+
41+
.PHONY: test
42+
43+
.NOTPARALLEL: test
44+
45+
failed:
46+
@$(MAKE) -f failedtargets.mk failed
47+
48+
.PHONY: failed
49+
50+
.NOTPARALLEL: failed

settings.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ PROPS_DIR=props_unix
4343

4444
-include $(TEST_ROOT)$(D)TKG$(D)autoGenEnv.mk
4545
include $(TEST_ROOT)$(D)TKG$(D)envSettings.mk
46-
include $(TEST_ROOT)$(D)TKG$(D)utils.mk
46+
-include $(TEST_ROOT)$(D)TKG$(D)utils.mk
4747
include $(TEST_ROOT)$(D)TKG$(D)testEnv.mk
4848
include $(TEST_ROOT)$(D)TKG$(D)featureSettings.mk
4949

src/org/testKitGen/MkGen.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ private void processPlaylist() throws SAXException, IOException, ParserConfigura
109109
include = currentElement.getTextContent();
110110
} else if (currentElement.getNodeName().equals("test")) {
111111
TestInfo testInfo = new TestInfo(currentElement);
112-
testInfo.parseInfo();
113-
if (testInfo.isValid()) {
112+
if (testInfo.parseInfo()) {
114113
testInfoArr.add(testInfo);
115114
}
116115
}

0 commit comments

Comments
 (0)