|
| 1 | +# |
| 2 | +# Copyright (c) 2022, 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 FIPS 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 | + |
| 62 | + include: |
| 63 | + - test-name: 'jdk/tier1 part 1' |
| 64 | + test-suite: 'test/jdk/:tier1_part1' |
| 65 | + |
| 66 | + - test-name: 'jdk/tier1 part 2' |
| 67 | + test-suite: 'test/jdk/:tier1_part2' |
| 68 | + |
| 69 | + - test-name: 'jdk/tier1 part 3' |
| 70 | + test-suite: 'test/jdk/:tier1_part3' |
| 71 | + |
| 72 | + steps: |
| 73 | + - name: 'Checkout the JDK source' |
| 74 | + uses: actions/checkout@v3 |
| 75 | + |
| 76 | + - name: 'Get MSYS2' |
| 77 | + uses: ./.github/actions/get-msys2 |
| 78 | + if: runner.os == 'Windows' |
| 79 | + |
| 80 | + - name: 'Get the BootJDK' |
| 81 | + id: bootjdk |
| 82 | + uses: ./.github/actions/get-bootjdk |
| 83 | + with: |
| 84 | + platform: ${{ inputs.bootjdk-platform }} |
| 85 | + |
| 86 | + - name: 'Get JTReg' |
| 87 | + id: jtreg |
| 88 | + uses: ./.github/actions/get-jtreg |
| 89 | + |
| 90 | + - name: 'Get bundles' |
| 91 | + id: bundles |
| 92 | + uses: ./.github/actions/get-bundles |
| 93 | + with: |
| 94 | + platform: ${{ inputs.platform }} |
| 95 | + debug-suffix: ${{ matrix.debug-suffix }} |
| 96 | + |
| 97 | + - name: 'Install dependencies' |
| 98 | + run: | |
| 99 | + # On macOS we need to install some dependencies for testing |
| 100 | + brew install make |
| 101 | + sudo xcode-select --switch /Applications/Xcode_11.7.app/Contents/Developer |
| 102 | + # This will make GNU make available as 'make' and not only as 'gmake' |
| 103 | + echo '/usr/local/opt/make/libexec/gnubin' >> $GITHUB_PATH |
| 104 | + if: runner.os == 'macOS' |
| 105 | + |
| 106 | + - name: 'Set PATH' |
| 107 | + id: path |
| 108 | + run: | |
| 109 | + # We need a minimal PATH on Windows |
| 110 | + # Set PATH to "", so just GITHUB_PATH is included |
| 111 | + if [[ '${{ runner.os }}' == 'Windows' ]]; then |
| 112 | + echo "value=" >> $GITHUB_OUTPUT |
| 113 | + else |
| 114 | + echo "value=$PATH" >> $GITHUB_OUTPUT |
| 115 | + fi |
| 116 | +
|
| 117 | + - name: Turn on system security properties and FIPS mode support |
| 118 | + run: | |
| 119 | + sed -i -e "s:^security.useSystemPropertiesFile=.*:security.useSystemPropertiesFile=true:" ${{ steps.bundles.outputs.jdk-path }}/conf/security/java.security |
| 120 | +
|
| 121 | + - name: 'Run tests' |
| 122 | + id: run-tests |
| 123 | + run: > |
| 124 | + make test-prebuilt |
| 125 | + TEST='${{ matrix.test-suite }}' |
| 126 | + BOOT_JDK=${{ steps.bootjdk.outputs.path }} |
| 127 | + JT_HOME=${{ steps.jtreg.outputs.path }} |
| 128 | + JDK_IMAGE_DIR=${{ steps.bundles.outputs.jdk-path }} |
| 129 | + SYMBOLS_IMAGE_DIR=${{ steps.bundles.outputs.symbols-path }} |
| 130 | + TEST_IMAGE_DIR=${{ steps.bundles.outputs.tests-path }} |
| 131 | + JTREG='JAVA_OPTIONS=-XX:-CreateCoredumpOnCrash;VERBOSE=fail,error,time;KEYWORDS=!headful' |
| 132 | + && bash ./.github/scripts/gen-test-summary.sh "$GITHUB_STEP_SUMMARY" "$GITHUB_OUTPUT" |
| 133 | + env: |
| 134 | + PATH: ${{ steps.path.outputs.value }} |
| 135 | + |
| 136 | + # This is a separate step, since if the markdown from a step gets bigger than |
| 137 | + # 1024 kB it is skipped, but then the short summary above is still generated |
| 138 | + - name: 'Generate test report' |
| 139 | + run: bash ./.github/scripts/gen-test-results.sh "$GITHUB_STEP_SUMMARY" |
| 140 | + if: always() |
| 141 | + |
| 142 | + - name: 'Package test results' |
| 143 | + id: package |
| 144 | + run: | |
| 145 | + # Package test-results and relevant parts of test-support |
| 146 | + mkdir results |
| 147 | +
|
| 148 | + if [[ -d build/run-test-prebuilt/test-results ]]; then |
| 149 | + cd build/run-test-prebuilt/test-results/ |
| 150 | + zip -r -9 "$GITHUB_WORKSPACE/results/fips-test-results.zip" . |
| 151 | + cd $GITHUB_WORKSPACE |
| 152 | + else |
| 153 | + echo '::warning ::Missing test-results directory' |
| 154 | + fi |
| 155 | +
|
| 156 | + if [[ -d build/run-test-prebuilt/test-support ]]; then |
| 157 | + cd build/run-test-prebuilt/test-support/ |
| 158 | + zip -r -9 "$GITHUB_WORKSPACE/results/fips-test-support.zip" . -i *.jtr -i */hs_err*.log -i */replay*.log |
| 159 | + cd $GITHUB_WORKSPACE |
| 160 | + else |
| 161 | + echo '::warning ::Missing test-support directory' |
| 162 | + fi |
| 163 | +
|
| 164 | + artifact_name="results-${{ inputs.platform }}-$(echo ${{ matrix.test-name }} | tr '/ ' '__')" |
| 165 | + echo "artifact-name=$artifact_name" >> $GITHUB_OUTPUT |
| 166 | + if: always() |
| 167 | + |
| 168 | + - name: 'Upload test results' |
| 169 | + uses: actions/upload-artifact@v3 |
| 170 | + with: |
| 171 | + path: results |
| 172 | + name: ${{ steps.package.outputs.artifact-name }} |
| 173 | + if: always() |
| 174 | + |
| 175 | + # This is the best way I found to abort the job with an error message |
| 176 | + - name: 'Notify about test failures' |
| 177 | + uses: actions/github-script@v6 |
| 178 | + with: |
| 179 | + script: core.setFailed('${{ steps.run-tests.outputs.error-message }}') |
| 180 | + if: steps.run-tests.outputs.failure == 'true' |
0 commit comments