Difficulty in switching JDK versions in one aqa-tests clone due to stale openjdk/openjdk-jdk source tree
- Dominant language
- HTML
- Stars
- 155
- Forks
- 346
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 36
Description
**Summary:**
When running OpenJDK tests locally in a single 'aqa-tests' clone and switching between JDK versions, the staged OpenJDK source tree under:
'openjdk/openjdk-jdk'
stays on the previously staged version even after changing the 'TEST_JDK_HOME', running make clean, and rerunning make compile.
**Scenario:**
I reproduced this locally on macOS Apple Silicon while switching between:
- JDK 8/OpenJ9/IBM Semeru
- JDK 25/HotSpot/Temurin
The workflow would be like:
1. `export TEST_JDK_HOME=`
2. `export BUILD_LIST=openjdk`
3. `cd TKG`
4. `make compile`
5. `make _jdk_math`
This works when the staged `openjdk/openjdk-jdk` tree matches the selected runtime. The problem appears when switching between major versions in the same clone.
When switching from JDK 8 to JDK 25 in the same clone, `openjdk/openjdk-jdk` remained on the previously staged tree until I manually removed it.
At that point, rerunning `make compile` staged the correct JDK 25 tree and the OpenJDK target passed.
Example failure before manual removal:
Error: Group spec does not specify a valid test suite: .../openjdk/openjdk-jdk/test/jdk:jdk_math
**Why this might be happening:**
In openjdk/build.xml, get Openjdk is only checks if the direct exists.
```xml
```
So the decision to reuse rather than re-fetch the staged source tree is based on whether openjdk/openjdk-jdk exists, not whether it matches the currently selected JDK version
**Current Workaround:**
To run the tests like make _jdk_math_0, etc. I've just been
rm -rf openjdk/openjdk-jdk
cd TKG
make compile
after switching TEST_JDK_HOME to a different JDK version -> it switches the TEST_JDK_HOME to a different JDK version -> forces the getOpenjdk to stage the right source tree because the unless="jdkdir.exists" no longer applies because I deleted it
I also built a local script that just swaps or caches the version-specific openjdk/openjdk-jdk trees but it felt more like a local work around and it was still simpler to just delete the directory and rerun make compile.
**Why make clean doesn't solve it:**
From checking through the current TKG makefiles:
- compile runs clean.mk cleanBuild before compile.mk compile
- clean runs makeGen.mk MODE=clean and then clean.mk clean
- clean.mk removes $(BUILD_ROOT), TKG/output_*, failed-target artifacts, and tool-build outputs
- BUILD_ROOT resolves to .../jvmtest
- but openjdk/openjdk-jdk is not removed
I also re-ran make clean successfully with a valid TEST_JDK_HOME and confirmed that openjdk/openjdk-jdk still existed afterward with the same repo remote and same commit as before clean.
So while make clean does clean generated output/artifacts, it does not appear to refresh or remove the staged OpenJDK source tree under openjdk/openjdk-jdk. That matters because getOpenjdk later reuses that tree based only on directory existence.
**Potential Solutions**
A couple of ideas came up while debugging
**Option 1:**
have make clean also clean the trees fetched during compile, which would make switching JDK versions in one clone more intuitive.
**Option 2:**
keep make clean as is, but make getOpenjdk version-aware so that it doesn't just reuse openjdk/openjdk-jdk when the staged tree doesn't match the current JDK version I select.
welcome any opinions!
Contributor guide
Research direction
Start with openjdk/build.xml, especially getOpenjdk and openjdk-jdk.check, then trace the clean and compile paths in clean.mk, compile.mk, and makeGen.mk. Reproduce the switch between the JDK 8 and JDK 25 workflows using TEST_JDK_HOME and make _jdk_math. Done means switching versions in one clone stages the matching tree without manual removal and the OpenJDK target passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100