Skip to content

Commit

Permalink
Finish/fix SKIP_JCK_GIT_UPDATE variable in JCK (adoptium#5740)
Browse files Browse the repository at this point in the history
* Do not enforce JCK_GIT_REPO if SKIP_JCK_GIT_UPDATE is set

* Skipping all git checks when SKIP_JCK_GIT_UPDATE is set

* Adding SKIP_JCK_GIT_UPDATE to readme

* Updated usage of SKIP_JCK_GIT_UPDATE so it needs to be true, not just set
  • Loading branch information
judovana authored and sophia-guo committed Nov 15, 2024
1 parent b3b9839 commit e06d684
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 39 deletions.
1 change: 1 addition & 0 deletions jck/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

3. Export `JCK_ROOT=/jck/<test_material_folder>` as an environment variable or pass it in when run as a make command. For example `export JCK_ROOT=/jck/jck8d`.
* Optional. The default value is `<openjdk-test>/../../../jck_root/JCK$(JDK_VERSION)-unzipped`.
* if you export `SKIP_JCK_GIT_UPDATE=true`, then the `JCK_GIT_REPO` is not used at all, and `JCK_ROOT` is used directly, without needing to be a repo.

4. Export `TEST_JDK_HOME=<your_JDK_root>` as an environment variable.

Expand Down
93 changes: 54 additions & 39 deletions jck/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,41 +119,47 @@
<if>
<available file="${JCK_ROOT_USED}" type="dir" />
<then>
<!--Obtain local and remote SHA to figure out if local materials are up-to-date-->
<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="false" outputproperty="localSHA" resultproperty="return.code">
<arg line="rev-parse"/>
<arg line="HEAD"/>
</exec>
<if>
<not>
<equals arg1="${return.code}" arg2="0"/>
</not>
<equals arg1="${env.SKIP_JCK_GIT_UPDATE}" arg2="true"/>
<then>
<echo message="Error: Git command failed with return code ${return.code}. Delete the directory and continue." />
<delete dir="${JCK_ROOT_USED}" failonerror="true" />
<echo message="env.SKIP_JCK_GIT_UPDATE is set to true. Skip Running git checks at ${JCK_ROOT_USED}. Continue." />
</then>
<else>
<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="true" outputproperty="remoteSHA">
<arg line="ls-remote"/>
<arg line="${JCK_GIT_REPO_USED}"/>
<arg line="${jck_branch}"/>
<!--Obtain local and remote SHA to figure out if local materials are up-to-date-->
<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="false" outputproperty="localSHA" resultproperty="return.code">
<arg line="rev-parse"/>
<arg line="HEAD"/>
</exec>
<loadresource property="localSHATrimmed">
<propertyresource name="localSHA"/>
<filterchain>
<tokenfilter>
<trim/>
</tokenfilter>
<striplinebreaks/>
</filterchain>
</loadresource>

<echo message="LocalSHA = --${localSHATrimmed}--"/>
<echo message="RemoteSHA= --${remoteSHA}--"/>

<condition property="local-material-uptodate">
<contains string="${remoteSHA}" substring="${localSHATrimmed}" />
</condition>
<if>
<not>
<equals arg1="${return.code}" arg2="0"/>
</not>
<then>
<echo message="Error: Git command failed with return code ${return.code}. Delete the directory and continue." />
<delete dir="${JCK_ROOT_USED}" failonerror="true" />
</then>
<else>
<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="true" outputproperty="remoteSHA">
<arg line="ls-remote"/>
<arg line="${JCK_GIT_REPO_USED}"/>
<arg line="${jck_branch}"/>
</exec>
<loadresource property="localSHATrimmed">
<propertyresource name="localSHA"/>
<filterchain>
<tokenfilter>
<trim/>
</tokenfilter>
<striplinebreaks/>
</filterchain>
</loadresource>
<echo message="LocalSHA = --${localSHATrimmed}--"/>
<echo message="RemoteSHA= --${remoteSHA}--"/>
<condition property="local-material-uptodate">
<contains string="${remoteSHA}" substring="${localSHATrimmed}" />
</condition>
</else>
</if>
</else>
</if>
</then>
Expand All @@ -179,10 +185,10 @@
<!-- jck materials exist, update jck materials if needed-->
<else>
<if>
<isset property="env.SKIP_JCK_GIT_UPDATE" />
<equals arg1="${env.SKIP_JCK_GIT_UPDATE}" arg2="true"/>
<!-- don't want to update local JCK materials -->
<then>
<echo message="env.SKIP_JCK_GIT_UPDATE is set. Skip Running git update at ${JCK_ROOT_USED}. Continue." />
<echo message="env.SKIP_JCK_GIT_UPDATE is set to true. Skip Running git update at ${JCK_ROOT_USED}. Continue." />
</then>
<else>
<if>
Expand Down Expand Up @@ -313,14 +319,23 @@
</target>

<target name="build">
<fail message="env.JCK_GIT_REPO: ${env.JCK_GIT_REPO} was not correctly set for running JCK tests. If you do not want to compile JCK tests,
<if>
<equals arg1="${env.SKIP_JCK_GIT_UPDATE}" arg2="true"/>
<then>
<echo message="=== SKIP_JCK_GIT_UPDATE set to true, not enforcing existence of env.JCK_GIT_REPO ===" />
</then>
<else>
<fail message="env.JCK_GIT_REPO: ${env.JCK_GIT_REPO} was not correctly set for running JCK tests. If you do not want to compile JCK tests,
please use BUILD_LIST to include test folders you want to test.">
<condition>
<not>
<isset property="env.JCK_GIT_REPO"/>
</not>
</condition>
</fail>
<condition>
<not>
<isset property="env.JCK_GIT_REPO"/>
</not>
</condition>
</fail>

</else>
</if>
<propertyregex property="JCK_GIT_REPO_USED" input="${env.JCK_GIT_REPO}" regexp="JCKnext-unzipped.git" replace="JCK${JDK_VERSION}-unzipped.git" casesensitive="false" defaultValue="${env.JCK_GIT_REPO}"/>
<echo>=== JCK_GIT_REPO_USED is set to ${JCK_GIT_REPO_USED} ===</echo>

Expand Down

0 comments on commit e06d684

Please sign in to comment.