diff --git a/.github/actions/create-sysroot/action.yml b/.github/actions/create-sysroot/action.yml new file mode 100644 index 00000000000..ec591e75227 --- /dev/null +++ b/.github/actions/create-sysroot/action.yml @@ -0,0 +1,83 @@ +# +# Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +name: 'Create sysroot' +description: 'Create the sysroot to cross-compile and test the OpenJDK' +inputs: + target-cpu: + description: 'Target CPU architecture' + required: true + gnu-arch: + description: 'GNU CPU architecture' + required: true + debian-arch: + description: 'Debian CPU architecture' + required: true + debian-repository: + description: 'Debian repository' + required: true + debian-version: + description: 'Debian version' + required: true + debian-keyring: + description: 'Debian keyring' + required: false + +runs: + using: composite + steps: + - name: 'Check cache for sysroot' + id: get-cached-sysroot + uses: actions/cache@v3 + with: + path: sysroot + key: sysroot-${{ inputs.debian-arch }}-${{ inputs.debian-version }}-${{ hashFiles('./.github/actions/create-sysroot/action.yml') }} + + - name: 'Install sysroot dependencies' + run: sudo apt-get install debootstrap qemu-user-static + shell: bash + if: steps.get-cached-sysroot.outputs.cache-hit != 'true' + + - name: 'Create sysroot' + run: > + sudo qemu-debootstrap + --arch=${{ inputs.debian-arch }} + --verbose + --include=fakeroot,symlinks,build-essential,make,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype6-dev,libpng-dev,libatomic1,zlib1g-dev + --resolve-deps + $(test -n "${{ inputs.debian-keyring }}" && echo "--keyring=${{ inputs.debian-keyring }}") + ${{ inputs.debian-version }} + sysroot + ${{ inputs.debian-repository }} + shell: bash + if: steps.get-cached-sysroot.outputs.cache-hit != 'true' + + - name: 'Prepare sysroot' + run: | + # Prepare sysroot and remove unused files to minimize cache + sudo chroot sysroot symlinks -cr . + sudo rm -rf sysroot/{dev,proc,run,sys} + shell: bash + if: steps.get-cached-sysroot.outputs.cache-hit != 'true' diff --git a/.github/actions/get-bundles/action.yml b/.github/actions/get-bundles/action.yml index 956e1520cfb..4ee56d2b993 100644 --- a/.github/actions/get-bundles/action.yml +++ b/.github/actions/get-bundles/action.yml @@ -32,6 +32,10 @@ inputs: debug-suffix: description: 'File name suffix denoting debug level, possibly empty' required: false + path: + description: 'Path to the installed JDK bundle' + required: false + default: 'bundles' outputs: jdk-path: description: 'Path to the installed JDK bundle' @@ -51,40 +55,40 @@ runs: uses: actions/download-artifact@v3 with: name: bundles-${{ inputs.platform }}${{ inputs.debug-suffix }} - path: bundles + path: ${{ inputs.path }} continue-on-error: true - name: 'Download bundles artifact (retry)' uses: actions/download-artifact@v3 with: name: bundles-${{ inputs.platform }}${{ inputs.debug-suffix }} - path: bundles + path: ${{ inputs.path }} if: steps.download-bundles.outcome == 'failure' - name: 'Unpack bundles' run: | - if [[ -e bundles/jdk-${{ inputs.platform }}${{ inputs.debug-suffix }}.zip ]]; then + if [[ -e ${{ inputs.path }}/jdk-${{ inputs.platform }}${{ inputs.debug-suffix }}.zip ]]; then echo 'Unpacking jdk bundle...' - mkdir -p bundles/jdk - unzip -q bundles/jdk-${{ inputs.platform }}${{ inputs.debug-suffix }}.zip -d bundles/jdk + mkdir -p ${{ inputs.path }}/jdk + unzip -q ${{ inputs.path }}/jdk-${{ inputs.platform }}${{ inputs.debug-suffix }}.zip -d ${{ inputs.path }}/jdk fi - if [[ -e bundles/jdk-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz ]]; then + if [[ -e ${{ inputs.path }}/jdk-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz ]]; then echo 'Unpacking jdk bundle...' - mkdir -p bundles/jdk - tar -xf bundles/jdk-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz -C bundles/jdk + mkdir -p ${{ inputs.path }}/jdk + tar -xf ${{ inputs.path }}/jdk-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz -C ${{ inputs.path }}/jdk fi - if [[ -e bundles/symbols-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz ]]; then + if [[ -e ${{ inputs.path }}/symbols-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz ]]; then echo 'Unpacking symbols bundle...' - mkdir -p bundles/symbols - tar -xf bundles/symbols-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz -C bundles/symbols + mkdir -p ${{ inputs.path }}/symbols + tar -xf ${{ inputs.path }}/symbols-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz -C ${{ inputs.path }}/symbols fi - if [[ -e bundles/tests-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz ]]; then + if [[ -e ${{ inputs.path }}/tests-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz ]]; then echo 'Unpacking tests bundle...' - mkdir -p bundles/tests - tar -xf bundles/tests-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz -C bundles/tests + mkdir -p ${{ inputs.path }}/tests + tar -xf ${{ inputs.path }}/tests-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz -C ${{ inputs.path }}/tests fi shell: bash @@ -93,9 +97,9 @@ runs: run: | # Export the paths - jdk_dir="$GITHUB_WORKSPACE/$(dirname $(find bundles/jdk -name bin -type d))" - symbols_dir="$GITHUB_WORKSPACE/$(dirname $(find bundles/symbols -name bin -type d))" - tests_dir="$GITHUB_WORKSPACE/bundles/tests" + jdk_dir="$GITHUB_WORKSPACE/$(dirname $(find ${{ inputs.path }}/jdk -name bin -type d))" + symbols_dir="$GITHUB_WORKSPACE/$(dirname $(find ${{ inputs.path }}/symbols -name bin -type d))" + tests_dir="$GITHUB_WORKSPACE/${{ inputs.path }}/tests" if [[ '${{ runner.os }}' == 'Windows' ]]; then jdk_dir="$(cygpath $jdk_dir)" diff --git a/.github/actions/init-platform-variables/action.yml b/.github/actions/init-platform-variables/action.yml new file mode 100644 index 00000000000..7aecc37f959 --- /dev/null +++ b/.github/actions/init-platform-variables/action.yml @@ -0,0 +1,94 @@ +# +# Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +name: 'Initialize Platform Variables' +description: 'Initialize the platform-specific variables used for cross-compilation' +inputs: + platform: + description: 'Target Platform' + required: true +outputs: + target-cpu: + description: 'Target CPU Archictecture' + value: ${{ steps.platform-variables.outputs.target-cpu }} + gnu-arch: + description: 'Target GNU Architecture' + value: ${{ steps.platform-variables.outputs.gnu-arch }} + debian-arch: + description: 'Target Debian Architecture' + value: ${{ steps.platform-variables.outputs.debian-arch }} + debian-repository: + description: 'Target Debian Repository' + value: ${{ steps.platform-variables.outputs.debian-repository }} + debian-version: + description: 'Target Debian Version' + value: ${{ steps.platform-variables.outputs.debian-version }} + gnu-abi: + description: 'Target GNU ABI' + value: ${{ steps.platform-variables.outputs.gnu-abi }} + +runs: + using: composite + steps: + - name: 'Initialize platform variables' + id: platform-variables + run: | + if [[ '${{ inputs.platform }}' == 'linux-aarch64' ]]; then + echo "target-cpu=aarch64" >> $GITHUB_OUTPUT + echo "gnu-arch=aarch64" >> $GITHUB_OUTPUT + echo "debian-arch=arm64" >> $GITHUB_OUTPUT + echo "debian-repository=https://httpredir.debian.org/debian/" >> $GITHUB_OUTPUT + echo "debian-version=bullseye" >> $GITHUB_OUTPUT + elif [[ '${{ inputs.platform }}' == 'linux-arm' ]]; then + echo "target-cpu=arm" >> $GITHUB_OUTPUT + echo "gnu-arch=arm" >> $GITHUB_OUTPUT + echo "gnu-abi=eabihf" >> $GITHUB_OUTPUT + echo "debian-arch=armhf" >> $GITHUB_OUTPUT + echo "debian-repository=https://httpredir.debian.org/debian/" >> $GITHUB_OUTPUT + echo "debian-version=bullseye" >> $GITHUB_OUTPUT + elif [[ '${{ inputs.platform }}' == 'linux-s390x' ]]; then + echo "target-cpu=s390x" >> $GITHUB_OUTPUT + echo "gnu-arch=s390x" >> $GITHUB_OUTPUT + echo "debian-arch=s390x" >> $GITHUB_OUTPUT + echo "debian-repository=https://httpredir.debian.org/debian/" >> $GITHUB_OUTPUT + echo "debian-version=bullseye" >> $GITHUB_OUTPUT + elif [[ '${{ inputs.platform }}' == 'linux-ppc64le' ]]; then + echo "target-cpu=ppc64le" >> $GITHUB_OUTPUT + echo "gnu-arch=powerpc64le" >> $GITHUB_OUTPUT + echo "debian-arch=ppc64el" >> $GITHUB_OUTPUT + echo "debian-repository=https://httpredir.debian.org/debian/" >> $GITHUB_OUTPUT + echo "debian-version=bullseye" >> $GITHUB_OUTPUT + elif [[ '${{ inputs.platform }}' == 'linux-riscv64' ]]; then + echo "target-cpu=riscv64" >> $GITHUB_OUTPUT + echo "gnu-arch=riscv64" >> $GITHUB_OUTPUT + echo "debian-arch=riscv64" >> $GITHUB_OUTPUT + echo "debian-repository=https://deb.debian.org/debian-ports" >> $GITHUB_OUTPUT + echo "debian-keyring=/usr/share/keyrings/debian-ports-archive-keyring.gpg" >> $GITHUB_OUTPUT + echo "debian-version=sid" >> $GITHUB_OUTPUT + else + echo "Unknown platform ${{ inputs.platform }}" + exit 1 + fi + shell: bash diff --git a/.github/workflows/build-cross-compile.yml b/.github/workflows/build-cross-compile.yml index eae3fd9157b..752d51ce668 100644 --- a/.github/workflows/build-cross-compile.yml +++ b/.github/workflows/build-cross-compile.yml @@ -28,6 +28,9 @@ name: 'Build (cross-compile)' on: workflow_call: inputs: + platform: + required: true + type: string gcc-major-version: required: true type: string @@ -46,6 +49,14 @@ on: make-arguments: required: false type: string + make-target: + required: false + type: string + default: 'product-bundles test-bundles' + debug-levels: + required: false + type: string + default: '[ "debug", "release" ]' jobs: build-cross-compile: @@ -55,40 +66,11 @@ jobs: strategy: fail-fast: false matrix: - target-cpu: - - aarch64 - - arm - - s390x - - ppc64le - - riscv64 + debug-level: ${{ fromJSON(inputs.debug-levels) }} include: - - target-cpu: aarch64 - gnu-arch: aarch64 - debian-arch: arm64 - debian-repository: https://httpredir.debian.org/debian/ - debian-version: bullseye - - target-cpu: arm - gnu-arch: arm - debian-arch: armhf - debian-repository: https://httpredir.debian.org/debian/ - debian-version: bullseye - gnu-abi: eabihf - - target-cpu: s390x - gnu-arch: s390x - debian-arch: s390x - debian-repository: https://httpredir.debian.org/debian/ - debian-version: bullseye - - target-cpu: ppc64le - gnu-arch: powerpc64le - debian-arch: ppc64el - debian-repository: https://httpredir.debian.org/debian/ - debian-version: bullseye - - target-cpu: riscv64 - gnu-arch: riscv64 - debian-arch: riscv64 - debian-repository: https://deb.debian.org/debian-ports - debian-keyring: /usr/share/keyrings/debian-ports-archive-keyring.gpg - debian-version: sid + - debug-level: debug + flags: --with-debug-level=fastdebug + suffix: -debug steps: - name: 'Checkout the JDK source' @@ -100,12 +82,27 @@ jobs: with: platform: linux-x64 + - name: 'Get JTReg' + id: jtreg + uses: ./.github/actions/get-jtreg + + - name: 'Get GTest' + id: gtest + uses: ./.github/actions/get-gtest + # Use linux-x64 JDK bundle as build JDK - name: 'Get build JDK' id: buildjdk uses: ./.github/actions/get-bundles with: platform: linux-x64 + path: buildjdk + + - name: 'Initialize platform variables' + id: platform-variables + uses: ./.github/actions/init-platform-variables + with: + platform: ${{ inputs.platform }} # Upgrading apt to solve libc6 installation bugs, see JDK-8260460. - name: 'Install toolchain and dependencies' @@ -116,61 +113,40 @@ jobs: sudo apt-get install \ gcc-${{ inputs.gcc-major-version }}=${{ inputs.apt-gcc-version }} \ g++-${{ inputs.gcc-major-version }}=${{ inputs.apt-gcc-version }} \ - gcc-${{ inputs.gcc-major-version }}-${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}=${{ inputs.apt-gcc-cross-version }} \ - g++-${{ inputs.gcc-major-version }}-${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}=${{ inputs.apt-gcc-cross-version }} \ + gcc-${{ inputs.gcc-major-version }}-${{ steps.platform-variables.outputs.gnu-arch }}-linux-gnu${{ steps.platform-variables.outputs.gnu-abi }}=${{ inputs.apt-gcc-cross-version }} \ + g++-${{ inputs.gcc-major-version }}-${{ steps.platform-variables.outputs.gnu-arch }}-linux-gnu${{ steps.platform-variables.outputs.gnu-abi }}=${{ inputs.apt-gcc-cross-version }} \ libxrandr-dev libxtst-dev libcups2-dev libasound2-dev \ debian-ports-archive-keyring sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ inputs.gcc-major-version }} 100 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ inputs.gcc-major-version }} - - name: 'Check cache for sysroot' - id: get-cached-sysroot - uses: actions/cache@v3 - with: - path: sysroot - key: sysroot-${{ matrix.debian-arch }}-${{ hashFiles('./.github/workflows/build-cross-compile.yml') }} - - - name: 'Install sysroot dependencies' - run: sudo apt-get install debootstrap qemu-user-static - if: steps.get-cached-sysroot.outputs.cache-hit != 'true' - - name: 'Create sysroot' - run: > - sudo debootstrap - --arch=${{ matrix.debian-arch }} - --verbose - --include=fakeroot,symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype6-dev,libpng-dev - --resolve-deps - $(test -n "${{ matrix.debian-keyring }}" && echo "--keyring=${{ matrix.debian-keyring }}") - ${{ matrix.debian-version }} - sysroot - ${{ matrix.debian-repository }} - if: steps.get-cached-sysroot.outputs.cache-hit != 'true' - - - name: 'Prepare sysroot' - run: | - # Prepare sysroot and remove unused files to minimize cache - sudo chroot sysroot symlinks -cr . - sudo chown ${USER} -R sysroot - rm -rf sysroot/{dev,proc,run,sys,var} - rm -rf sysroot/usr/{sbin,bin,share} - rm -rf sysroot/usr/lib/{apt,udev,systemd} - if: steps.get-cached-sysroot.outputs.cache-hit != 'true' + uses: ./.github/actions/create-sysroot + with: + target-cpu: ${{ steps.platform-variables.outputs.target-cpu }} + gnu-arch: ${{ steps.platform-variables.outputs.gnu-arch }} + debian-arch: ${{ steps.platform-variables.outputs.debian-arch }} + debian-repository: ${{ steps.platform-variables.outputs.debian-repository }} + debian-version: ${{ steps.platform-variables.outputs.debian-version }} + debian-keyring: ${{ steps.platform-variables.outputs.debian-keyring }} - name: 'Configure' run: > bash configure - --with-conf-name=linux-${{ matrix.target-cpu }} + --with-conf-name=linux-${{ steps.platform-variables.outputs.target-cpu }} + ${{ matrix.flags }} --with-version-opt=${GITHUB_ACTOR}-${GITHUB_SHA} --with-boot-jdk=${{ steps.bootjdk.outputs.path }} + --with-jtreg=${{ steps.jtreg.outputs.path }} + --with-gtest=${{ steps.gtest.outputs.path }} + --enable-jtreg-failure-handler --with-zlib=system - --enable-debug --disable-precompiled-headers - --openjdk-target=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}} + --openjdk-target=${{ steps.platform-variables.outputs.gnu-arch }}-linux-gnu${{ steps.platform-variables.outputs.gnu-abi }} --with-sysroot=sysroot --with-build-jdk=${{ steps.buildjdk.outputs.jdk-path }} --with-jmod-compress=zip-1 - CC=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}-gcc-${{ inputs.gcc-major-version }} - CXX=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}-g++-${{ inputs.gcc-major-version }} + CC=${{ steps.platform-variables.outputs.gnu-arch }}-linux-gnu${{ steps.platform-variables.outputs.gnu-abi }}-gcc-${{ inputs.gcc-major-version }} + CXX=${{ steps.platform-variables.outputs.gnu-arch }}-linux-gnu${{ steps.platform-variables.outputs.gnu-abi }}-g++-${{ inputs.gcc-major-version }} ${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || ( echo "Dumping config.log:" && cat config.log && @@ -180,5 +156,12 @@ jobs: id: build uses: ./.github/actions/do-build with: - make-target: 'hotspot ${{ inputs.make-arguments }}' - platform: linux-${{ matrix.target-cpu }} + make-target: '${{ inputs.make-target }} ${{ inputs.make-arguments }}' + platform: '${{ inputs.platform }}' + debug-suffix: '${{ matrix.suffix }}' + + - name: 'Upload bundles' + uses: ./.github/actions/upload-bundles + with: + platform: '${{ inputs.platform }}' + debug-suffix: '${{ matrix.suffix }}' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 04cea1293ee..7816ce1b970 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,10 +26,12 @@ name: 'OpenJDK GHA Sanity Checks' on: + pull_request: + branches: + - rivos/main push: - branches-ignore: - - master - - pr/* + branches: + - rivos/main workflow_dispatch: inputs: platforms: @@ -80,7 +82,7 @@ jobs: function check_platform() { if [[ $GITHUB_EVENT_NAME == workflow_dispatch ]]; then input='${{ github.event.inputs.platforms }}' - elif [[ $GITHUB_EVENT_NAME == push ]]; then + elif [[ $GITHUB_EVENT_NAME == push || $GITHUB_EVENT_NAME == pull_request ]]; then if [[ '${{ !secrets.JDK_SUBMIT_FILTER || startsWith(github.ref, 'refs/heads/submit/') }}' == 'false' ]]; then # If JDK_SUBMIT_FILTER is set, and this is not a "submit/" branch, don't run anything >&2 echo 'JDK_SUBMIT_FILTER is set and not a "submit/" branch' @@ -89,6 +91,10 @@ jobs: else input='${{ secrets.JDK_SUBMIT_PLATFORMS }}' fi + else + >&2 echo 'Internal error in GHA' + echo 'false' + return fi normalized_input="$(echo ,$input, | tr -d ' ')" @@ -215,13 +221,72 @@ jobs: make-arguments: ${{ github.event.inputs.make-arguments }} if: needs.select.outputs.linux-x64-variants == 'true' - build-linux-cross-compile: - name: linux-cross-compile + build-linux-aarch64: + name: linux-aarch64 + needs: + - select + - build-linux-x64 + uses: ./.github/workflows/build-cross-compile.yml + with: + platform: linux-aarch64 + gcc-major-version: '10' + apt-gcc-version: '10.4.0-4ubuntu1~22.04' + apt-gcc-cross-version: '10.4.0-4ubuntu1~22.04cross1' + configure-arguments: ${{ github.event.inputs.configure-arguments }} + make-arguments: ${{ github.event.inputs.make-arguments }} + if: needs.select.outputs.linux-cross-compile == 'true' + + build-linux-arm: + name: linux-arm + needs: + - select + - build-linux-x64 + uses: ./.github/workflows/build-cross-compile.yml + with: + platform: linux-arm + gcc-major-version: '10' + apt-gcc-version: '10.4.0-4ubuntu1~22.04' + apt-gcc-cross-version: '10.4.0-4ubuntu1~22.04cross1' + configure-arguments: ${{ github.event.inputs.configure-arguments }} + make-arguments: ${{ github.event.inputs.make-arguments }} + if: needs.select.outputs.linux-cross-compile == 'true' + + build-linux-ppc64le: + name: linux-ppc64le + needs: + - select + - build-linux-x64 + uses: ./.github/workflows/build-cross-compile.yml + with: + platform: linux-ppc64le + gcc-major-version: '10' + apt-gcc-version: '10.4.0-4ubuntu1~22.04' + apt-gcc-cross-version: '10.4.0-4ubuntu1~22.04cross1' + if: needs.select.outputs.linux-cross-compile == 'true' + + build-linux-riscv64: + name: linux-riscv64 needs: - select - build-linux-x64 uses: ./.github/workflows/build-cross-compile.yml with: + platform: linux-riscv64 + gcc-major-version: '10' + apt-gcc-version: '10.4.0-4ubuntu1~22.04' + apt-gcc-cross-version: '10.4.0-4ubuntu1~22.04cross1' + configure-arguments: ${{ github.event.inputs.configure-arguments }} + make-arguments: ${{ github.event.inputs.make-arguments }} + if: needs.select.outputs.linux-cross-compile == 'true' + + build-linux-s390x: + name: linux-s390x + needs: + - select + - build-linux-x64 + uses: ./.github/workflows/build-cross-compile.yml + with: + platform: linux-s390x gcc-major-version: '10' apt-gcc-version: '10.4.0-4ubuntu1~22.04' apt-gcc-cross-version: '10.4.0-4ubuntu1~22.04cross1' @@ -319,6 +384,57 @@ jobs: bootjdk-platform: linux-x64 runs-on: ubuntu-22.04 + # test-linux-aarch64: + # name: linux-aarch64 + # needs: + # - build-linux-aarch64 + # uses: ./.github/workflows/test-cross-compile.yml + # with: + # platform: linux-aarch64 + # bootjdk-platform: linux-x64 + # runs-on: ubuntu-22.04 + + # test-linux-arm: + # name: linux-arm + # needs: + # - build-linux-arm + # uses: ./.github/workflows/test-cross-compile.yml + # with: + # platform: linux-arm + # bootjdk-platform: linux-x64 + # runs-on: ubuntu-22.04 + # if: EXTRA_TEST_PLATFORMS == 'true' + + # test-linux-ppc64le: + # name: linux-ppc64le + # needs: + # - build-linux-ppc64le + # uses: ./.github/workflows/test-cross-compile.yml + # with: + # platform: linux-ppc64le + # bootjdk-platform: linux-x64 + # runs-on: ubuntu-22.04 + + test-linux-riscv64: + name: linux-riscv64 + needs: + - build-linux-riscv64 + uses: ./.github/workflows/test-cross-compile.yml + with: + platform: linux-riscv64 + bootjdk-platform: linux-x64 + runs-on: ubuntu-22.04 + + # test-linux-s390x: + # name: linux-s390x + # needs: + # - build-linux-s390x + # uses: ./.github/workflows/test-cross-compile.yml + # with: + # platform: linux-s390x + # bootjdk-platform: linux-x64 + # runs-on: ubuntu-22.04 + test-macos-x64: name: macos-x64 needs: @@ -351,13 +467,22 @@ jobs: - build-linux-x64-hs-zero - build-linux-x64-hs-minimal - build-linux-x64-hs-optimized - - build-linux-cross-compile + - build-linux-aarch64 + - build-linux-arm + - build-linux-s390x + - build-linux-ppc64le + - build-linux-riscv64 - build-macos-x64 - build-macos-aarch64 - build-windows-x64 - build-windows-aarch64 - test-linux-x64 - test-linux-x86 + # - test-linux-aarch64 + # - test-linux-arm + # - test-linux-ppc64le + - test-linux-riscv64 + # - test-linux-s390x - test-macos-x64 - test-windows-x64 diff --git a/.github/workflows/test-cross-compile.yml b/.github/workflows/test-cross-compile.yml new file mode 100644 index 00000000000..24d2c60f875 --- /dev/null +++ b/.github/workflows/test-cross-compile.yml @@ -0,0 +1,238 @@ +# +# Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +name: 'Run tests (cross-compile)' + +on: + workflow_call: + inputs: + platform: + required: true + type: string + bootjdk-platform: + required: true + type: string + runs-on: + required: true + type: string + +jobs: + test: + name: test + runs-on: ${{ inputs.runs-on }} + defaults: + run: + shell: bash + + strategy: + fail-fast: false + matrix: + test-name: + - 'jdk/tier1 part 1' + - 'jdk/tier1 part 2' + - 'jdk/tier1 part 3' + - 'langtools/tier1' + - 'hs/tier1 common' + - 'hs/tier1 compiler 1' + - 'hs/tier1 compiler 2' + - 'hs/tier1 compiler 3' + - 'hs/tier1 compiler not xcomp' + - 'hs/tier1 gc' + - 'hs/tier1 runtime' + - 'hs/tier1 serviceability' + + include: + - test-name: 'jdk/tier1 part 1' + test-suite: 'test/jdk/:tier1_part1' + + - test-name: 'jdk/tier1 part 2' + test-suite: 'test/jdk/:tier1_part2' + + - test-name: 'jdk/tier1 part 3' + test-suite: 'test/jdk/:tier1_part3' + + - test-name: 'langtools/tier1' + test-suite: 'test/langtools/:tier1' + + - test-name: 'hs/tier1 common' + test-suite: 'test/hotspot/jtreg/:tier1_common' + debug-suffix: -debug + + - test-name: 'hs/tier1 compiler 1' + test-suite: 'test/hotspot/jtreg/:tier1_compiler_1' + debug-suffix: -debug + + - test-name: 'hs/tier1 compiler 2' + test-suite: 'test/hotspot/jtreg/:tier1_compiler_2' + debug-suffix: -debug + + - test-name: 'hs/tier1 compiler 3' + test-suite: 'test/hotspot/jtreg/:tier1_compiler_3' + debug-suffix: -debug + + - test-name: 'hs/tier1 compiler not xcomp' + test-suite: 'test/hotspot/jtreg/:tier1_compiler_not_xcomp' + debug-suffix: -debug + + - test-name: 'hs/tier1 gc' + test-suite: 'test/hotspot/jtreg/:tier1_gc' + debug-suffix: -debug + + - test-name: 'hs/tier1 runtime' + test-suite: 'test/hotspot/jtreg/:tier1_runtime' + debug-suffix: -debug + + - test-name: 'hs/tier1 serviceability' + test-suite: 'test/hotspot/jtreg/:tier1_serviceability' + debug-suffix: -debug + + steps: + - name: 'Checkout the JDK source' + uses: actions/checkout@v3 + + - name: 'Initialize platform variables' + id: platform-variables + uses: ./.github/actions/init-platform-variables + with: + platform: ${{ inputs.platform }} + + - name: 'Get the BootJDK' + id: bootjdk + uses: ./.github/actions/get-bootjdk + with: + platform: ${{ inputs.bootjdk-platform }} + + - name: 'Get JTReg' + id: jtreg + uses: ./.github/actions/get-jtreg + + - name: 'Get bundles' + id: bundles + uses: ./.github/actions/get-bundles + with: + platform: ${{ inputs.platform }} + debug-suffix: ${{ matrix.debug-suffix }} + + - name: 'Install dependencies' + run: | + sudo apt-get update + sudo apt-get install qemu-user-static + + - name: 'Create sysroot' + uses: ./.github/actions/create-sysroot + with: + target-cpu: ${{ steps.platform-variables.outputs.target-cpu }} + gnu-arch: ${{ steps.platform-variables.outputs.gnu-arch }} + debian-arch: ${{ steps.platform-variables.outputs.debian-arch }} + debian-repository: ${{ steps.platform-variables.outputs.debian-repository }} + debian-version: sid # it's necessary to get libc 2.34 + debian-keyring: ${{ steps.platform-variables.outputs.debian-keyring }} + + - name: 'Mount folders in sysroot' + run: | + sudo mkdir -p sysroot/dev sysroot/proc sysroot/run sysroot/sys sysroot/usr/lib64 sysroot/usr/lib/x86_64-linux-gnu sysroot/home/runner + sudo ln -s -r sysroot/usr/lib64 sysroot/lib64 + sudo chown $(id -u):$(id -g) sysroot/home/runner + sudo mount --bind /dev sysroot/dev + sudo mount --bind /proc sysroot/proc + sudo mount --bind /run sysroot/run + sudo mount --bind /sys sysroot/sys + sudo mount --bind /usr/lib64 sysroot/usr/lib64 + sudo mount --bind /usr/lib/x86_64-linux-gnu sysroot/usr/lib/x86_64-linux-gnu + sudo mount --bind /home/runner sysroot/home/runner + + - name: 'Run tests' + id: run-tests + run: > + sudo chroot --userspec=$(id -u):$(id -g) sysroot bash -x -c " + cd $GITHUB_WORKSPACE; + make test-prebuilt + TEST='${{ matrix.test-suite }}' + BOOT_JDK=${{ steps.bootjdk.outputs.path }} + JT_HOME=${{ steps.jtreg.outputs.path }} + JDK_IMAGE_DIR=${{ steps.bundles.outputs.jdk-path }} + SYMBOLS_IMAGE_DIR=${{ steps.bundles.outputs.symbols-path }} + TEST_IMAGE_DIR=${{ steps.bundles.outputs.tests-path }} + JTREG='JAVA_OPTIONS=-XX:-CreateCoredumpOnCrash;VERBOSE=fail,error,time;KEYWORDS=!headful;TIMEOUT_FACTOR=8' + JTREG_EXTRA_PROBLEM_LISTS='ProblemList-GHA.txt' + && bash ./.github/scripts/gen-test-summary.sh "$GITHUB_STEP_SUMMARY" + " + + - name: 'Umount folders in sysroot' + run: | + sudo rm sysroot/lib64 + sudo umount -l sysroot/dev + sudo umount -l sysroot/proc + sudo umount -l sysroot/run + sudo umount -l sysroot/sys + sudo umount -l sysroot/usr/lib64 + sudo umount -l sysroot/usr/lib/x86_64-linux-gnu + sudo umount -l sysroot/home/runner + + # This is a separate step, since if the markdown from a step gets bigger than + # 1024 kB it is skipped, but then the short summary above is still generated + - name: 'Generate test report' + run: bash ./.github/scripts/gen-test-results.sh "$GITHUB_STEP_SUMMARY" + if: always() + + - name: 'Package test results' + id: package + run: | + # Package test-results and relevant parts of test-support + mkdir results + + if [[ -d build/run-test-prebuilt/test-results ]]; then + cd build/run-test-prebuilt/test-results/ + zip -r -9 "$GITHUB_WORKSPACE/results/test-results.zip" . + cd $GITHUB_WORKSPACE + else + echo '::warning ::Missing test-results directory' + fi + + if [[ -d build/run-test-prebuilt/test-support ]]; then + cd build/run-test-prebuilt/test-support/ + zip -r -9 "$GITHUB_WORKSPACE/results/test-support.zip" . -i *.jtr -i */hs_err*.log -i */replay*.log + cd $GITHUB_WORKSPACE + else + echo '::warning ::Missing test-support directory' + fi + + artifact_name="results-${{ inputs.platform }}-$(echo ${{ matrix.test-name }} | tr '/ ' '__')" + echo "artifact-name=$artifact_name" >> $GITHUB_OUTPUT + if: always() + + - name: 'Upload test results' + uses: actions/upload-artifact@v3 + with: + path: results + name: ${{ steps.package.outputs.artifact-name }} + if: always() + + # This is the best way I found to abort the job with an error message + - name: 'Notify about test failures' + uses: actions/github-script@v6 + with: + script: core.setFailed('${{ steps.run-tests.outputs.error-message }}') + if: always() && steps.run-tests.outputs.failure == 'true' diff --git a/test/hotspot/jtreg/ProblemList-GHA.txt b/test/hotspot/jtreg/ProblemList-GHA.txt new file mode 100644 index 00000000000..4192f48a128 --- /dev/null +++ b/test/hotspot/jtreg/ProblemList-GHA.txt @@ -0,0 +1,69 @@ +# +# Copyright (c) 2022, Rivos Inc. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# :tier1_common + +gtest/GTestWrapper.java 0 linux-riscv64 +gtest/LargePageGtests.java#use-large-pages 0 linux-riscv64 +gtest/LargePageGtests.java#use-large-pages-1G 0 linux-riscv64 +gtest/LargePageGtests.java#use-large-pages-sysV 0 linux-riscv64 +gtest/NMTGtests.java#nmt-detail 0 linux-riscv64 +gtest/NMTGtests.java#nmt-off 0 linux-riscv64 +gtest/NMTGtests.java#nmt-summary 0 linux-riscv64 + + +# tier1_compiler_1 + +compiler/c2/irTests/TestAutoVectorization2DArray.java 0 linux-riscv64 +compiler/c2/irTests/TestFPComparison.java 0 linux-riscv64 + +# tier1_compiler_3 + +compiler/loopopts/TestUnreachableInnerLoop.java 0 linux-riscv64 +compiler/vectorization/TestAutoVecIntMinMax.java 0 linux-riscv64 + +# tier1_gc + +gc/arguments/TestUseCompressedOopsFlagsWithUlimit.java 0 linux-riscv64 + +# :tier1_runtime + +runtime/cds/CheckDefaultArchiveFile.java 0 linux-riscv64 +runtime/LoadClass/LongBCP.java 0 linux-riscv64 +runtime/os/TestTracePageSizes.java#compiler-options 0 linux-riscv64 +runtime/os/TestTracePageSizes.java#G1 0 linux-riscv64 +runtime/os/TestTracePageSizes.java#Parallel 0 linux-riscv64 +runtime/os/TestTracePageSizes.java#Serial 0 linux-riscv64 + +# tier1_serviceability + +serviceability/dcmd/framework/HelpTest.java 0 linux-riscv64 +serviceability/dcmd/framework/InvalidCommandTest.java 0 linux-riscv64 +serviceability/dcmd/framework/VMVersionTest.java 0 linux-riscv64 +serviceability/tmtools/jstat/GcCapacityTest.java 0 linux-riscv64 +serviceability/tmtools/jstat/GcCauseTest01.java 0 linux-riscv64 +serviceability/tmtools/jstat/GcCauseTest02.java 0 linux-riscv64 +serviceability/tmtools/jstat/GcCauseTest03.java 0 linux-riscv64 +serviceability/tmtools/jstat/GcNewTest.java 0 linux-riscv64 +serviceability/tmtools/jstat/GcTest01.java 0 linux-riscv64 +serviceability/tmtools/jstat/GcTest02.java 0 linux-riscv64 \ No newline at end of file diff --git a/test/jdk/ProblemList-GHA.txt b/test/jdk/ProblemList-GHA.txt new file mode 100644 index 00000000000..e93af7dbc3b --- /dev/null +++ b/test/jdk/ProblemList-GHA.txt @@ -0,0 +1,31 @@ +# +# Copyright (c) 2022, Rivos Inc. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# jdk / tier1_part_1 + +java/lang/ProcessHandle/InfoTest.java 0 linux-riscv64 +java/lang/invoke/lambda/LogGeneratedClassesTest.java 0 linux-riscv64 + +# jdk / tier1_part_2 + +java/util/concurrent/locks/Lock/TimedAcquireLeak.java 0 linux-riscv64 diff --git a/test/langtools/ProblemList-GHA.txt b/test/langtools/ProblemList-GHA.txt new file mode 100644 index 00000000000..e88cfebbc06 --- /dev/null +++ b/test/langtools/ProblemList-GHA.txt @@ -0,0 +1,28 @@ +# +# Copyright (c) 2022, Rivos Inc. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +jdk/jshell/CommandCompletionTest.java 0 linux-riscv64 +jdk/jshell/ForwardReferenceImportTest.java 0 linux-riscv64 +jdk/jshell/ToolProviderTest.java 0 linux-riscv64 +jdk/jshell/ToolTabSnippetTest.java 0 linux-riscv64 +tools/javac/ClassPathTest/ClassPathTest.java 0 linux-riscv64