Skip to content

Commit f2b9a1a

Browse files
committed
Fix CI scripts for OpenJDK 21
This changes paths build options, etc., to make the CI scripts work with OpenJDK 21. We now use a single source of truth for the OpenJDK path instead of defining OPENJDK_PATH in multiple scripts.
1 parent 711d5de commit f2b9a1a

13 files changed

+59
-55
lines changed

.github/scripts/ci-build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ build_target=$1
1313
# Build product bundle
1414
cd $OPENJDK_PATH
1515
sh configure --disable-warnings-as-errors --with-debug-level=$DEBUG_LEVEL
16-
make CONF=linux-x86_64-normal-server-$DEBUG_LEVEL THIRD_PARTY_HEAP=$BINDING_PATH/openjdk $OPENJDK_BUILD_TARGET
16+
make CONF=linux-x86_64-server-$DEBUG_LEVEL THIRD_PARTY_HEAP=$BINDING_PATH/openjdk $OPENJDK_BUILD_TARGET

.github/scripts/ci-checkout.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
# ci-checkout.sh
21
set -ex
32

43
. $(dirname "$0")/common.sh
54

65
OPENJDK_URL=`cargo read-manifest --manifest-path=$BINDING_PATH/mmtk/Cargo.toml | python3 -c 'import json,sys; print(json.load(sys.stdin)["metadata"]["openjdk"]["openjdk_repo"])'`
76
OPENJDK_VERSION=`cargo read-manifest --manifest-path=$BINDING_PATH/mmtk/Cargo.toml | python3 -c 'import json,sys; print(json.load(sys.stdin)["metadata"]["openjdk"]["openjdk_version"])'`
87

9-
# Use default openjdk path if it is not set (this is only need when MMTk core calls the script)
10-
OPENJDK_PATH=${OPENJDK_PATH:="$BINDING_PATH/repos/openjdk"}
11-
128
rm -rf $OPENJDK_PATH
139
git clone $OPENJDK_URL $OPENJDK_PATH
1410
git -C $OPENJDK_PATH checkout $OPENJDK_VERSION

.github/scripts/ci-setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ set -xe
22

33
. $(dirname "$0")/common.sh
44

5-
# Install nightly rust
5+
# Install the appropriate Rust toolchain
66
rustup toolchain install $RUSTUP_TOOLCHAIN
77
rustup target add i686-unknown-linux-gnu --toolchain $RUSTUP_TOOLCHAIN
88
rustup component add clippy --toolchain $RUSTUP_TOOLCHAIN

.github/scripts/ci-test-extended.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ set -ex
33
. $(dirname "$0")/common.sh
44
cur=$BINDING_PATH/.github/scripts
55

6+
# This script runs against a specific pre-built java binary, not OpenJDK source code.
7+
ensure_env TEST_JAVA_BIN
8+
unset OPENJDK_PATH
9+
610
# This script is only used by MMTk core.
7-
# OPENJDK_PATH is the default path set in ci-checkout.sh
8-
export OPENJDK_PATH=$BINDING_PATH/repos/openjdk
911
export DEBUG_LEVEL=fastdebug
10-
export TEST_JAVA_BIN=$OPENJDK_PATH/build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java
12+
export TEST_JAVA_BIN=$OPENJDK_PATH/build/linux-x86_64-server-$DEBUG_LEVEL/jdk/bin/java
1113

1214
# Download dacapo
1315
export DACAPO_PATH=$BINDING_PATH/dacapo

.github/scripts/ci-test-minimal.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ set -ex
44
cur=$BINDING_PATH/.github/scripts
55

66
# This script is only used by MMTk core.
7-
# OPENJDK_PATH is the default path set in ci-checkout.sh
8-
export OPENJDK_PATH=$BINDING_PATH/repos/openjdk
97
export DEBUG_LEVEL=fastdebug
10-
export TEST_JAVA_BIN=$OPENJDK_PATH/build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java
8+
export TEST_JAVA_BIN=$OPENJDK_PATH/build/linux-x86_64-server-$DEBUG_LEVEL/jdk/bin/java
119

1210
# Download dacapo
1311
export DACAPO_PATH=$BINDING_PATH/dacapo

.github/scripts/ci-test-only-normal.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ set -xe
44

55
unset JAVA_TOOL_OPTIONS
66

7+
# This script runs against a specific pre-built java binary, not OpenJDK source code.
8+
ensure_env TEST_JAVA_BIN
9+
unset OPENJDK_PATH
10+
711
run_all() {
812
heap_multiplier=$1
913

.github/scripts/ci-test-only-weak-ref.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ set -xe
33
. $(dirname "$0")/common.sh
44

55
unset JAVA_TOOL_OPTIONS
6-
cd $OPENJDK_PATH
6+
7+
# This script runs against a specific pre-built java binary, not OpenJDK source code.
8+
ensure_env TEST_JAVA_BIN
9+
unset OPENJDK_PATH
710

811
export MMTK_NO_REFERENCE_TYPES=false
912
# Just test Immix and MarkCompact

.github/scripts/common.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
BINDING_PATH=$(realpath $(dirname "$0"))/../..
22
RUSTUP_TOOLCHAIN=`cat $BINDING_PATH/mmtk/rust-toolchain`
33

4+
# build.yml specifies the OPENJDK_PATH env var when calling ci-build.sh
5+
# But other scripts expect a default path for OpenJDK.
6+
OPENJDK_PATH=${OPENJDK_PATH:="$BINDING_PATH/repos/jdk"}
7+
48
# dacapo2006 min heap for mark compact
59
MINHEAP_ANTLR=5
610
MINHEAP_FOP=13

.github/scripts/pgo-build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ cargo clean
1111
popd
1212

1313
# Compile with profiling support
14-
RUSTFLAGS="-Cprofile-generate=/tmp/$USER/pgo-data" make CONF=linux-x86_64-normal-server-release THIRD_PARTY_HEAP=$PWD/../mmtk-openjdk/openjdk images
14+
RUSTFLAGS="-Cprofile-generate=/tmp/$USER/pgo-data" make CONF=linux-x86_64-server-release THIRD_PARTY_HEAP=$PWD/../mmtk-openjdk/openjdk images
1515

1616
# Remove extraneous profiling data
1717
rm -rf /tmp/$USER/pgo-data/*
1818

1919
# Profile using fop
20-
MMTK_PLAN=GenImmix MMTK_STRESS_FACTOR=16777216 MMTK_PRECISE_STRESS=false ./build/linux-x86_64-normal-server-release/images/jdk/bin/java -XX:MetaspaceSize=500M -XX:+DisableExplicitGC -XX:-TieredCompilation -Xcomp -XX:+UseThirdPartyHeap -Xms60M -Xmx60M -jar /usr/share/benchmarks/dacapo/dacapo-23.9-RC3-chopin.jar -n 5 fop
20+
MMTK_PLAN=GenImmix MMTK_STRESS_FACTOR=16777216 MMTK_PRECISE_STRESS=false ./build/linux-x86_64-server-release/images/jdk/bin/java -XX:MetaspaceSize=500M -XX:+DisableExplicitGC -XX:-TieredCompilation -Xcomp -XX:+UseThirdPartyHeap -Xms60M -Xmx60M -jar /usr/share/benchmarks/dacapo/dacapo-23.9-RC3-chopin.jar -n 5 fop
2121

2222
# Merge profiling data
2323
/opt/rust/toolchains/1.71.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata merge -o /tmp/$USER/pgo-data/merged.profdata /tmp/$USER/pgo-data
@@ -27,4 +27,4 @@ cargo clean
2727
popd
2828

2929
# Compile using profiling data
30-
RUSTFLAGS="-Cprofile-use=/tmp/$USER/pgo-data/merged.profdata -Cllvm-args=-pgo-warn-missing-function" make CONF=linux-x86_64-normal-server-release THIRD_PARTY_HEAP=$PWD/../mmtk-openjdk/openjdk images
30+
RUSTFLAGS="-Cprofile-use=/tmp/$USER/pgo-data/merged.profdata -Cllvm-args=-pgo-warn-missing-function" make CONF=linux-x86_64-server-release THIRD_PARTY_HEAP=$PWD/../mmtk-openjdk/openjdk images

.github/workflows/build.yml

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,19 @@ jobs:
2020
build-linux-x64:
2121
name: linux-x64
2222
runs-on: ubuntu-22.04
23+
env:
24+
# This overrides OPENJDK_PATH in ci-common.sh
25+
# Note: We cannot use default environment variables (GITHUB_*) in the "env" context. Use github.* instead.
26+
# See: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables
27+
OPENJDK_PATH: ${{ github.workspace }}/git/openjdk
2328
steps:
2429
- name: Checkout MMTk OpenJDK binding
2530
uses: actions/checkout@v4
2631
with:
2732
path: ./git/mmtk-openjdk
28-
- name: Extract OpenJDK revision
29-
id: extract-openjdk-revision
30-
run: |
31-
OPENJDK_VERSION=`sed -n 's/^openjdk_version.=."\(.*\)"$/\1/p' < git/mmtk-openjdk/mmtk/Cargo.toml`
32-
echo "openjdk-revision=$OPENJDK_VERSION" >> $GITHUB_OUTPUT
3333
- name: Checkout OpenJDK
34-
uses: actions/checkout@v4
35-
with:
36-
repository: mmtk/openjdk
37-
path: ./git/openjdk
38-
ref: ${{ steps.extract-openjdk-revision.outputs.openjdk-revision }}
39-
# Patch mmtk-core version if needed
40-
- name: Patch mmtk-core version
34+
run: ./git/mmtk-openjdk/.github/scripts/ci-checkout.sh
35+
- name: Patch mmtk-core version if needed
4136
if: ${{ inputs.mmtk-core-repo != '' || inputs.mmtk-core-ref != '' }}
4237
run: |
4338
pip3 install tomlkit
@@ -60,14 +55,16 @@ jobs:
6055
echo "BUILD_SUFFIX=$escaped_build" >> $GITHUB_ENV
6156
fi
6257
- name: Build MMTk OpenJDK ${{ inputs.debug-level }}
63-
run: |
64-
OPENJDK_PATH=$GITHUB_WORKSPACE/git/openjdk DEBUG_LEVEL=${{ inputs.debug-level }} OPENJDK_BUILD_TARGET=product-bundles ./.github/scripts/ci-build.sh
58+
env:
59+
DEBUG_LEVEL: ${{ inputs.debug-level }}
60+
OPENJDK_BUILD_TARGET: product-bundles
61+
run: ./.github/scripts/ci-build.sh
6562
working-directory: ./git/mmtk-openjdk
6663
- name: Upload bundles
6764
uses: actions/upload-artifact@v4
6865
with:
6966
name: linux-x86_64-server-${{ inputs.debug-level }}-bundles-${{ env.BUILD_SUFFIX }}
7067
path: |
71-
./git/openjdk/build/linux-x86_64-normal-server-${{ inputs.debug-level }}/bundles/*_bin.tar.gz
72-
./git/openjdk/build/linux-x86_64-normal-server-${{ inputs.debug-level }}/bundles/*_bin-debug.tar.gz
68+
./git/openjdk/build/linux-x86_64-server-${{ inputs.debug-level }}/bundles/*_bin.tar.gz
69+
./git/openjdk/build/linux-x86_64-server-${{ inputs.debug-level }}/bundles/*_bin-debug.tar.gz
7370
retention-days: 2

0 commit comments

Comments
 (0)