1 #
2 # Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # This code is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 only, as
7 # published by the Free Software Foundation. Oracle designates this
8 # particular file as subject to the "Classpath" exception as provided
9 # by Oracle in the LICENSE file that accompanied this code.
10 #
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
16 #
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 # or visit www.oracle.com if you need additional information or have any
23 # questions.
24 #
25
26 name: 'Run tests'
27
28 on:
29 workflow_call:
30 inputs:
31 platform:
32 required: true
33 type: string
34 bootjdk-platform:
35 required: true
36 type: string
37 runs-on:
38 required: true
39 type: string
40 xcode-toolset-version:
41 required: false
42 type: string
43
44 env:
45 # These are needed to make the MSYS2 bash work properly
46 MSYS2_PATH_TYPE: minimal
47 CHERE_INVOKING: 1
48
49 jobs:
50 test:
51 name: test
52 runs-on: ${{ inputs.runs-on }}
53 defaults:
54 run:
55 shell: bash
56
57 strategy:
58 fail-fast: false
59 matrix:
60 test-name:
61 - 'jdk/tier1 part 1'
62 - 'jdk/tier1 part 2'
63 - 'jdk/tier1 part 3'
64 - 'langtools/tier1'
65 - 'hs/tier1 common'
66 - 'hs/tier1 compiler part 1'
67 - 'hs/tier1 compiler part 2'
68 - 'hs/tier1 compiler part 3'
69 - 'hs/tier1 compiler not-xcomp'
70 - 'hs/tier1 gc'
71 - 'hs/tier1 runtime'
72 - 'hs/tier1 serviceability'
73 - 'lib-test/tier1'
74
75 include:
76 - test-name: 'jdk/tier1 part 1'
77 test-suite: 'test/jdk/:tier1_part1'
78
79 - test-name: 'jdk/tier1 part 2'
80 test-suite: 'test/jdk/:tier1_part2'
81
82 - test-name: 'jdk/tier1 part 3'
83 test-suite: 'test/jdk/:tier1_part3'
84
85 - test-name: 'langtools/tier1'
86 test-suite: 'test/langtools/:tier1'
87
88 - test-name: 'hs/tier1 common'
89 test-suite: 'test/hotspot/jtreg/:tier1_common'
90 debug-suffix: -debug
91
92 - test-name: 'hs/tier1 compiler part 1'
93 test-suite: 'test/hotspot/jtreg/:tier1_compiler_1'
94 debug-suffix: -debug
95
96 - test-name: 'hs/tier1 compiler part 2'
97 test-suite: 'test/hotspot/jtreg/:tier1_compiler_2'
98 debug-suffix: -debug
99
100 - test-name: 'hs/tier1 compiler part 3'
101 test-suite: 'test/hotspot/jtreg/:tier1_compiler_3'
102 debug-suffix: -debug
103
104 - test-name: 'hs/tier1 compiler not-xcomp'
105 test-suite: 'test/hotspot/jtreg/:tier1_compiler_not_xcomp'
106 debug-suffix: -debug
107
108 - test-name: 'hs/tier1 gc'
109 test-suite: 'test/hotspot/jtreg/:tier1_gc'
110 debug-suffix: -debug
111
112 - test-name: 'hs/tier1 runtime'
113 test-suite: 'test/hotspot/jtreg/:tier1_runtime'
114 debug-suffix: -debug
115
116 - test-name: 'hs/tier1 serviceability'
117 test-suite: 'test/hotspot/jtreg/:tier1_serviceability'
118 debug-suffix: -debug
119
120 - test-name: 'lib-test/tier1'
121 test-suite: 'test/lib-test/:tier1'
122 debug-suffix: -debug
123
124 steps:
125 - name: 'Checkout the JDK source'
126 uses: actions/checkout@v4
127
128 - name: 'Get MSYS2'
129 uses: ./.github/actions/get-msys2
130 if: runner.os == 'Windows'
131
132 - name: 'Get the BootJDK'
133 id: bootjdk
134 uses: ./.github/actions/get-bootjdk
135 with:
136 platform: ${{ inputs.bootjdk-platform }}
137
138 - name: 'Get JTReg'
139 id: jtreg
140 uses: ./.github/actions/get-jtreg
141
142 - name: 'Get bundles'
143 id: bundles
144 uses: ./.github/actions/get-bundles
145 with:
146 platform: ${{ inputs.platform }}
147 debug-suffix: ${{ matrix.debug-suffix }}
148
149 - name: 'Install dependencies'
150 run: |
151 # On macOS we need to install some dependencies for testing
152 brew install make
153 sudo xcode-select --switch /Applications/Xcode_${{ inputs.xcode-toolset-version }}.app/Contents/Developer
154 # This will make GNU make available as 'make' and not only as 'gmake'
155 echo '/usr/local/opt/make/libexec/gnubin' >> $GITHUB_PATH
156 if: runner.os == 'macOS'
157
158 - name: 'Set PATH'
159 id: path
160 run: |
161 # We need a minimal PATH on Windows
162 # Set PATH to "", so just GITHUB_PATH is included
163 if [[ '${{ runner.os }}' == 'Windows' ]]; then
164 echo "value=" >> $GITHUB_OUTPUT
165 else
166 echo "value=$PATH" >> $GITHUB_OUTPUT
167 fi
168
169 - name: 'Run tests'
170 id: run-tests
171 run: >
172 make test-prebuilt
173 TEST='${{ matrix.test-suite }}'
174 BOOT_JDK=${{ steps.bootjdk.outputs.path }}
175 JT_HOME=${{ steps.jtreg.outputs.path }}
176 JDK_IMAGE_DIR=${{ steps.bundles.outputs.jdk-path }}
177 SYMBOLS_IMAGE_DIR=${{ steps.bundles.outputs.symbols-path }}
178 TEST_IMAGE_DIR=${{ steps.bundles.outputs.tests-path }}
179 JTREG='JAVA_OPTIONS=-XX:-CreateCoredumpOnCrash;VERBOSE=fail,error,time;KEYWORDS=!headful'
180 && bash ./.github/scripts/gen-test-summary.sh "$GITHUB_STEP_SUMMARY" "$GITHUB_OUTPUT"
181 env:
182 PATH: ${{ steps.path.outputs.value }}
183
184 # This is a separate step, since if the markdown from a step gets bigger than
185 # 1024 kB it is skipped, but then the short summary above is still generated
186 - name: 'Generate test report'
187 run: bash ./.github/scripts/gen-test-results.sh "$GITHUB_STEP_SUMMARY"
188 if: always()
189
190 - name: 'Package test results'
191 id: package
192 run: |
193 # Package test-results and relevant parts of test-support
194 mkdir results
195
196 if [[ -d build/run-test-prebuilt/test-results ]]; then
197 cd build/run-test-prebuilt/test-results/
198 zip -r -9 "$GITHUB_WORKSPACE/results/test-results.zip" .
199 cd $GITHUB_WORKSPACE
200 else
201 echo '::warning ::Missing test-results directory'
202 fi
203
204 if [[ -d build/run-test-prebuilt/test-support ]]; then
205 cd build/run-test-prebuilt/test-support/
206 zip -r -9 "$GITHUB_WORKSPACE/results/test-support.zip" . -i *.jtr -i */hs_err*.log -i */replay*.log
207 cd $GITHUB_WORKSPACE
208 else
209 echo '::warning ::Missing test-support directory'
210 fi
211
212 artifact_name="results-${{ inputs.platform }}-$(echo ${{ matrix.test-name }} | tr '/ ' '__')"
213 echo "artifact-name=$artifact_name" >> $GITHUB_OUTPUT
214 if: always()
215
216 - name: 'Upload test results'
217 uses: actions/upload-artifact@v4
218 with:
219 path: results
220 name: ${{ steps.package.outputs.artifact-name }}
221 if: always()
222
223 # This is the best way I found to abort the job with an error message
224 - name: 'Notify about test failures'
225 uses: actions/github-script@v7
226 with:
227 script: core.setFailed('${{ steps.run-tests.outputs.error-message }}')
228 if: steps.run-tests.outputs.failure == 'true'