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 
 41 env:
 42   # These are needed to make the MSYS2 bash work properly
 43   MSYS2_PATH_TYPE: minimal
 44   CHERE_INVOKING: 1
 45 
 46 jobs:
 47   test:
 48     name: test
 49     runs-on: ${{ inputs.runs-on }}
 50     defaults:
 51       run:
 52         shell: bash
 53 
 54     strategy:
 55       fail-fast: false
 56       matrix:
 57         test-name:
 58           - 'jdk/tier1 part 1'
 59           - 'jdk/tier1 part 2'
 60           - 'jdk/tier1 part 3'
 61           - 'langtools/tier1'
 62           - 'hs/tier1 common'
 63           - 'hs/tier1 compiler part 1'
 64           - 'hs/tier1 compiler part 2'
 65           - 'hs/tier1 compiler part 3'
 66           - 'hs/tier1 compiler not-xcomp'
 67           - 'hs/tier1 gc'
 68           - 'hs/tier1 runtime'
 69           - 'hs/tier1 serviceability'
 70           - 'lib-test/tier1'
 71 
 72         include:
 73           - test-name: 'jdk/tier1 part 1'
 74             test-suite: 'test/jdk/:tier1_part1'
 75 
 76           - test-name: 'jdk/tier1 part 2'
 77             test-suite: 'test/jdk/:tier1_part2'
 78 
 79           - test-name: 'jdk/tier1 part 3'
 80             test-suite: 'test/jdk/:tier1_part3'
 81 
 82           - test-name: 'langtools/tier1'
 83             test-suite: 'test/langtools/:tier1'
 84 
 85           - test-name: 'hs/tier1 common'
 86             test-suite: 'test/hotspot/jtreg/:tier1_common'
 87             debug-suffix: -debug
 88 
 89           - test-name: 'hs/tier1 compiler part 1'
 90             test-suite: 'test/hotspot/jtreg/:tier1_compiler_1'
 91             debug-suffix: -debug
 92 
 93           - test-name: 'hs/tier1 compiler part 2'
 94             test-suite: 'test/hotspot/jtreg/:tier1_compiler_2'
 95             debug-suffix: -debug
 96 
 97           - test-name: 'hs/tier1 compiler part 3'
 98             test-suite: 'test/hotspot/jtreg/:tier1_compiler_3'
 99             debug-suffix: -debug
100 
101           - test-name: 'hs/tier1 compiler not-xcomp'
102             test-suite: 'test/hotspot/jtreg/:tier1_compiler_not_xcomp'
103             debug-suffix: -debug
104 
105           - test-name: 'hs/tier1 gc'
106             test-suite: 'test/hotspot/jtreg/:tier1_gc'
107             debug-suffix: -debug
108 
109           - test-name: 'hs/tier1 runtime'
110             test-suite: 'test/hotspot/jtreg/:tier1_runtime'
111             debug-suffix: -debug
112 
113           - test-name: 'hs/tier1 serviceability'
114             test-suite: 'test/hotspot/jtreg/:tier1_serviceability'
115             debug-suffix: -debug
116 
117           - test-name: 'lib-test/tier1'
118             test-suite: 'test/lib-test/:tier1'
119             debug-suffix: -debug
120 
121     steps:
122       - name: 'Checkout the JDK source'
123         uses: actions/checkout@v4
124 
125       - name: 'Get MSYS2'
126         uses: ./.github/actions/get-msys2
127         if: runner.os == 'Windows'
128 
129       - name: 'Get the BootJDK'
130         id: bootjdk
131         uses: ./.github/actions/get-bootjdk
132         with:
133           platform: ${{ inputs.bootjdk-platform }}
134 
135       - name: 'Get JTReg'
136         id: jtreg
137         uses: ./.github/actions/get-jtreg
138 
139       - name: 'Get bundles'
140         id: bundles
141         uses: ./.github/actions/get-bundles
142         with:
143           platform: ${{ inputs.platform }}
144           debug-suffix: ${{ matrix.debug-suffix }}
145 
146       - name: 'Install dependencies'
147         run: |
148           # On macOS we need to install some dependencies for testing
149           brew install make
150           sudo xcode-select --switch /Applications/Xcode_14.3.1.app/Contents/Developer
151           # This will make GNU make available as 'make' and not only as 'gmake'
152           echo '/usr/local/opt/make/libexec/gnubin' >> $GITHUB_PATH
153         if: runner.os == 'macOS'
154 
155       - name: 'Set PATH'
156         id: path
157         run: |
158           # We need a minimal PATH on Windows
159           # Set PATH to "", so just GITHUB_PATH is included
160           if [[ '${{ runner.os }}' == 'Windows' ]]; then
161             echo "value=" >> $GITHUB_OUTPUT
162           else
163             echo "value=$PATH" >> $GITHUB_OUTPUT
164           fi
165 
166       - name: 'Run tests'
167         id: run-tests
168         run: >
169           make test-prebuilt
170           TEST='${{ matrix.test-suite }}'
171           BOOT_JDK=${{ steps.bootjdk.outputs.path }}
172           JT_HOME=${{ steps.jtreg.outputs.path }}
173           JDK_IMAGE_DIR=${{ steps.bundles.outputs.jdk-path }}
174           SYMBOLS_IMAGE_DIR=${{ steps.bundles.outputs.symbols-path }}
175           TEST_IMAGE_DIR=${{ steps.bundles.outputs.tests-path }}
176           JTREG='JAVA_OPTIONS=-XX:-CreateCoredumpOnCrash;VERBOSE=fail,error,time;KEYWORDS=!headful'
177           && bash ./.github/scripts/gen-test-summary.sh "$GITHUB_STEP_SUMMARY" "$GITHUB_OUTPUT"
178         env:
179           PATH: ${{ steps.path.outputs.value }}
180 
181         # This is a separate step, since if the markdown from a step gets bigger than
182         # 1024 kB it is skipped, but then the short summary above is still generated
183       - name: 'Generate test report'
184         run: bash ./.github/scripts/gen-test-results.sh "$GITHUB_STEP_SUMMARY"
185         if: always()
186 
187       - name: 'Package test results'
188         id: package
189         run: |
190           # Package test-results and relevant parts of test-support
191           mkdir results
192 
193           if [[ -d build/run-test-prebuilt/test-results ]]; then
194             cd build/run-test-prebuilt/test-results/
195             zip -r -9 "$GITHUB_WORKSPACE/results/test-results.zip" .
196             cd $GITHUB_WORKSPACE
197           else
198             echo '::warning ::Missing test-results directory'
199           fi
200 
201           if [[ -d build/run-test-prebuilt/test-support ]]; then
202             cd build/run-test-prebuilt/test-support/
203             zip -r -9 "$GITHUB_WORKSPACE/results/test-support.zip" . -i *.jtr -i */hs_err*.log -i */replay*.log
204             cd $GITHUB_WORKSPACE
205           else
206             echo '::warning ::Missing test-support directory'
207           fi
208 
209           artifact_name="results-${{ inputs.platform }}-$(echo ${{ matrix.test-name }} | tr '/ ' '__')"
210           echo "artifact-name=$artifact_name" >> $GITHUB_OUTPUT
211         if: always()
212 
213       - name: 'Upload test results'
214         uses: actions/upload-artifact@v4
215         with:
216           path: results
217           name: ${{ steps.package.outputs.artifact-name }}
218         if: always()
219 
220         # This is the best way I found to abort the job with an error message
221       - name: 'Notify about test failures'
222         uses: actions/github-script@v7
223         with:
224           script: core.setFailed('${{ steps.run-tests.outputs.error-message }}')
225         if: steps.run-tests.outputs.failure == 'true'