diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index dde2bf5a..644c664c 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -42,7 +42,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/runAqa.yml b/.github/workflows/runAqa.yml index 6b44c068..1208fa5d 100644 --- a/.github/workflows/runAqa.yml +++ b/.github/workflows/runAqa.yml @@ -19,7 +19,7 @@ jobs: id: workflow_run_info # Checkout current (TKG) repo to access the repo-specific config file `.github/workflows/runAqaConfig.json` and the shared script `scripts/testRepo/runAqaArgParse.py` - name: Checkout current repo - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: path: 'main' - name: Parse parameters @@ -40,7 +40,7 @@ jobs: id: output_log - name: Create error comment if: failure() - uses: actions/github-script@v6 + uses: actions/github-script@v7.0.1 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | @@ -62,7 +62,7 @@ jobs: run: echo ::set-output name=failed::true id: failure_report - name: Create success comment - uses: actions/github-script@v6 + uses: actions/github-script@v7.0.1 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | @@ -107,7 +107,7 @@ jobs: sourceType: 'buildType' impl: ${{ matrix.jdk_impl }} - name: Checkout PR Ref - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 if: matrix.sdk_resource == 'build-jdk' with: repository: ${{ matrix.build_repo_branch.repo }} @@ -129,7 +129,7 @@ jobs: sourceType: 'url' impl: ${{ matrix.jdk_impl }} # get-pr step by @Simran-B https://github.com/actions/checkout/issues/331#issuecomment-707103442 - - uses: actions/github-script@v6 + - uses: actions/github-script@v7.0.1 id: get-pr with: script: | @@ -168,7 +168,7 @@ jobs: openjdk_testRepo: ${{ matrix.openjdk_testrepo }} openj9_repo: ${{ matrix.openj9_repo }} tkg_Repo: '${{ fromJSON(steps.get-pr.outputs.result).head.repo.full_name }}:${{ fromJSON(steps.get-pr.outputs.result).head.ref }}' - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: failure() with: name: test_output @@ -180,7 +180,7 @@ jobs: if: failure() && !needs.parseComment.outputs.failed steps: - name: Create comment - uses: actions/github-script@v6 + uses: actions/github-script@v7.0.1 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | @@ -201,7 +201,7 @@ jobs: if: cancelled() steps: - name: Create comment - uses: actions/github-script@v6 + uses: actions/github-script@v7.0.1 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | @@ -222,7 +222,7 @@ jobs: if: success() steps: - name: Create comment - uses: actions/github-script@v6 + uses: actions/github-script@v7.0.1 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | diff --git a/.github/workflows/testTKG.yml b/.github/workflows/testTKG.yml index a66c6f07..055d1489 100644 --- a/.github/workflows/testTKG.yml +++ b/.github/workflows/testTKG.yml @@ -2,23 +2,31 @@ name: "Run TKG Tests" on: issue_comment: types: [created] +permissions: + contents: write + issues: write + pull-requests: write jobs: testTKG: + permissions: + contents: write + issues: write + pull-requests: write runs-on: ubuntu-latest if: startsWith(github.event.comment.body, 'run tkg-test') steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: ref: refs/pull/${{ github.event.issue.number }}/head - name: Set up JDK - uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0 + uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 with: distribution: 'temurin' java-version: 11 - name: Create success comment - uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | @@ -53,7 +61,7 @@ jobs: if: failure() steps: - name: Create comment - uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | @@ -73,7 +81,7 @@ jobs: if: cancelled() steps: - name: Create comment - uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | @@ -93,7 +101,7 @@ jobs: if: success() steps: - name: Create comment - uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | diff --git a/compile.mk b/compile.mk index 03fcc20a..fd84d520 100644 --- a/compile.mk +++ b/compile.mk @@ -38,7 +38,7 @@ TEST_FLAG_PARAM := -DTEST_FLAG=$(TEST_FLAG) else TEST_FLAG_PARAM := endif -COMPILE_CMD=ant -f scripts$(D)build_test.xml -DTEST_ROOT=$(TEST_ROOT) -DBUILD_ROOT=$(BUILD_ROOT) -DJDK_VERSION=$(JDK_VERSION) -DJDK_IMPL=$(JDK_IMPL) -DJCL_VERSION=$(JCL_VERSION) -DBUILD_LIST=${COMPILE_BUILD_LIST} -DRESOURCES_DIR=${RESOURCES_DIR} -DSPEC=${SPEC} -DTEST_JDK_HOME=${TEST_JDK_HOME} -DJVM_VERSION=$(JVM_VERSION) -DLIB_DIR=$(LIB_DIR) ${TEST_FLAG_PARAM} +COMPILE_CMD=ant -f scripts$(D)build_test.xml -DTEST_ROOT=$(TEST_ROOT) -DBUILD_ROOT=$(BUILD_ROOT) -DJDK_VERSION=$(JDK_VERSION) -DJDK_IMPL=$(JDK_IMPL) -DJDK_VENDOR=$(JDK_VENDOR) -DJCL_VERSION=$(JCL_VERSION) -DBUILD_LIST=${COMPILE_BUILD_LIST} -DRESOURCES_DIR=${RESOURCES_DIR} -DSPEC=${SPEC} -DTEST_JDK_HOME=${TEST_JDK_HOME} -DJVM_VERSION=$(JVM_VERSION) -DLIB_DIR=$(LIB_DIR) ${TEST_FLAG_PARAM} compile: diff --git a/examples/base/playlist.xml b/examples/base/playlist.xml index da66a764..4f78dfc2 100644 --- a/examples/base/playlist.xml +++ b/examples/base/playlist.xml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. --> - + testSuccess echo "success"; \ diff --git a/examples/feature/playlist.xml b/examples/feature/playlist.xml index aa5c72c8..a1853f12 100644 --- a/examples/feature/playlist.xml +++ b/examples/feature/playlist.xml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. --> - + testFeatureFips echo "match FIPS140_3_20220501 and everything else by default"; \ diff --git a/examples/hierarchy/a1/b1/playlist.xml b/examples/hierarchy/a1/b1/playlist.xml index c6c4ec56..edc4270e 100644 --- a/examples/hierarchy/a1/b1/playlist.xml +++ b/examples/hierarchy/a1/b1/playlist.xml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. --> - + test_a1_b1 echo "success"; \ diff --git a/examples/hierarchy/a2/b2/c2/playlist.xml b/examples/hierarchy/a2/b2/c2/playlist.xml index 72498859..139930bf 100644 --- a/examples/hierarchy/a2/b2/c2/playlist.xml +++ b/examples/hierarchy/a2/b2/c2/playlist.xml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. --> - + test_a2_b2_c2 echo "success"; \ diff --git a/examples/hierarchy/a2/b2/playlist.xml b/examples/hierarchy/a2/b2/playlist.xml index c26b141c..121d4089 100644 --- a/examples/hierarchy/a2/b2/playlist.xml +++ b/examples/hierarchy/a2/b2/playlist.xml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. --> - + test_a2_b2 echo "success"; \ diff --git a/examples/hierarchy/a2/d2/playlist.xml b/examples/hierarchy/a2/d2/playlist.xml index 366614bc..5e00d80b 100644 --- a/examples/hierarchy/a2/d2/playlist.xml +++ b/examples/hierarchy/a2/d2/playlist.xml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. --> - + test_a2_d2 echo "success"; \ diff --git a/examples/hierarchy/a2/playlist.xml b/examples/hierarchy/a2/playlist.xml index f1581ec4..94fcbb7e 100644 --- a/examples/hierarchy/a2/playlist.xml +++ b/examples/hierarchy/a2/playlist.xml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. --> - + test_a2 echo "success"; \ diff --git a/examples/hierarchy/a3/b3/playlist.xml b/examples/hierarchy/a3/b3/playlist.xml index 5803f4bb..0e11f93b 100644 --- a/examples/hierarchy/a3/b3/playlist.xml +++ b/examples/hierarchy/a3/b3/playlist.xml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. --> - + test_a3_b3 echo "success"; \ diff --git a/examples/hierarchy/a3/c3/d3/playlist.xml b/examples/hierarchy/a3/c3/d3/playlist.xml index a364099c..9063fb1b 100644 --- a/examples/hierarchy/a3/c3/d3/playlist.xml +++ b/examples/hierarchy/a3/c3/d3/playlist.xml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. --> - + test_a3_b3_c3_d3 echo "success"; \ diff --git a/examples/hierarchy/a3/f3/playlist.xml b/examples/hierarchy/a3/f3/playlist.xml index d443f416..54b26324 100644 --- a/examples/hierarchy/a3/f3/playlist.xml +++ b/examples/hierarchy/a3/f3/playlist.xml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. --> - + test_a3_f3 echo "success"; \ diff --git a/examples/jdkVersion/playlist.xml b/examples/jdkVersion/playlist.xml index daf775cd..1bf5dfed 100644 --- a/examples/jdkVersion/playlist.xml +++ b/examples/jdkVersion/playlist.xml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. --> - + test_ver_11 echo "test for version 11"; \ diff --git a/examples/platformRequirements/playlist.xml b/examples/platformRequirements/playlist.xml index 514369e1..5a309164 100644 --- a/examples/platformRequirements/playlist.xml +++ b/examples/platformRequirements/playlist.xml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. --> - + test_arch_x86 echo "test arch.x86"; \ @@ -107,5 +107,73 @@ $(TEST_STATUS) ^os.linux.ubuntu.20+ + + test_not_arch_390 + echo "test on none arch.390"; \ + $(TEST_STATUS) + ^arch.390 + + + + test_arch_x86_skylake + echo "test arch.x86.skylake"; \ + $(TEST_STATUS) + + arch.x86.skylake + + + + + test_arch_390_z15plus + echo "test arch.390.z15+"; \ + $(TEST_STATUS) + + arch.390.z15+ + + + + + test_arch_390_z15 + echo "test arch.390.z15"; \ + $(TEST_STATUS) + + arch.390.z15 + + + + test_arch_390_z14plus + echo "test arch.390.z14+"; \ + $(TEST_STATUS) + + arch.390.z14+ + + + + + test_arch_390_z14 + echo "test arch.390.z14"; \ + $(TEST_STATUS) + + arch.390.z14 + + + + + test_arch_390_z13plus + echo "test arch.390.z13+"; \ + $(TEST_STATUS) + + arch.390.z13+ + + + + + test_arch_390_z13 + echo "test arch.390.z13"; \ + $(TEST_STATUS) + + arch.390.z13 + + - + \ No newline at end of file diff --git a/examples/rerun/playlist.xml b/examples/rerun/playlist.xml index d3ce6eef..83ec89b7 100644 --- a/examples/rerun/playlist.xml +++ b/examples/rerun/playlist.xml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. --> - + testRerun echo "test rerun"; \ diff --git a/examples/rerun/rerunSub/playlist.xml b/examples/rerun/rerunSub/playlist.xml index 67fbeebe..763b0a0f 100644 --- a/examples/rerun/rerunSub/playlist.xml +++ b/examples/rerun/rerunSub/playlist.xml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. --> - + testRerunSubDir echo "test rerun in sub dir"; \ diff --git a/examples/sliceAndDice/level/playlist.xml b/examples/sliceAndDice/level/playlist.xml index af4eb302..2851f87f 100644 --- a/examples/sliceAndDice/level/playlist.xml +++ b/examples/sliceAndDice/level/playlist.xml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. --> - + testDefault echo "default is extended"; \ diff --git a/makeGen.mk b/makeGen.mk index 1b3fec2e..89ece3ea 100644 --- a/makeGen.mk +++ b/makeGen.mk @@ -28,7 +28,7 @@ P=: Q=" TKG_JAR = .$(D)bin$(D)TestKitGen.jar -JSON_SIMPLE = .$(D)lib$(D)json-simple.jar +JSON_SIMPLE = $(LIB_DIR)$(D)json-simple.jar ifneq (,$(findstring Win,$(OS))) CURRENT_DIR := $(subst \,/,$(CURRENT_DIR)) @@ -42,7 +42,7 @@ autoconfig: perl scripts$(D)configure.pl autogen: autoconfig - ${TEST_JDK_HOME}/bin/java -cp $(Q)$(TKG_JAR)$(P)$(JSON_SIMPLE)$(Q) org.testKitGen.MainRunner --mode=$(MODE) --spec=$(SPEC) --microArch=$(MICROARCH) --osLabel=$(Q)$(OS_LABEL)$(Q) --jdkVersion=$(JDK_VERSION) --impl=$(JDK_IMPL) --vendor=$(Q)$(JDK_VENDOR)$(Q) --buildList=${BUILD_LIST} --iterations=$(TKG_ITERATIONS) --aotIterations=$(AOT_ITERATIONS) --testFlag=$(TEST_FLAG) --testTarget=$(TESTTARGET) --testList=$(TESTLIST) --numOfMachines=$(NUM_MACHINES) --testTime=$(TEST_TIME) --TRSSURL=$(TRSS_URL) $(OPTS) + ${TEST_JDK_HOME}/bin/java -cp $(Q)$(TKG_JAR)$(P)$(JSON_SIMPLE)$(Q) org.testKitGen.MainRunner --mode=$(MODE) --spec=$(SPEC) --microArch=$(Q)$(MICROARCH)$(Q) --osLabel=$(Q)$(OS_LABEL)$(Q) --jdkVersion=$(JDK_VERSION) --impl=$(JDK_IMPL) --vendor=$(Q)$(JDK_VENDOR)$(Q) --buildList=${BUILD_LIST} --iterations=$(TKG_ITERATIONS) --aotIterations=$(AOT_ITERATIONS) --testFlag=$(TEST_FLAG) --testTarget=$(TESTTARGET) --testList=$(TESTLIST) --numOfMachines=$(NUM_MACHINES) --testTime=$(TEST_TIME) --TRSSURL=$(TRSS_URL) $(OPTS) AUTOGEN_FILES = $(wildcard $(CURRENT_DIR)$(D)jvmTest.mk) AUTOGEN_FILES += $(wildcard $(CURRENT_DIR)$(D)machineConfigure.mk) diff --git a/makefile b/makefile index 9a62bf16..789f3107 100644 --- a/makefile +++ b/makefile @@ -32,6 +32,26 @@ SUBDIRS = .. ifndef TEST_ROOT TEST_ROOT := $(shell pwd)$(D).. endif +ifndef LIB_DIR + LIB_DIR:=$(TEST_ROOT)$(D)TKG$(D)lib +endif + +UNAME := uname +UNAME_OS := $(shell $(UNAME) -s | cut -f1 -d_) +$(info UNAME_OS is $(UNAME_OS)) +ifeq ($(findstring CYGWIN,$(UNAME_OS)), CYGWIN) + LIB_DIR:=$(shell cygpath -w $(LIB_DIR)) +else ifeq ($(UNAME_OS),OS/390) +# The issue is still being investigated. See backlog/issues/1424 +# set -Dfile.encoding=IBM-1047 for JDK21+ zOS for now +ifeq ($(shell test $(JDK_VERSION) -ge 21; echo $$?),0) +export IBM_JAVA_OPTIONS="-Dfile.encoding=IBM-1047" +$(info export IBM_JAVA_OPTIONS="-Dfile.encoding=IBM-1047") +endif +endif + +export LIB_DIR:=$(subst \,/,$(LIB_DIR)) +$(info LIB_DIR is set to $(LIB_DIR)) _TESTTARGET = $(firstword $(MAKECMDGOALS)) TESTTARGET = $(patsubst _%,%,$(_TESTTARGET)) @@ -88,7 +108,7 @@ endif # compile tools ####################################### include moveDmp.mk -COMPILE_TOOLS_CMD=ant -f .$(D)scripts$(D)build_tools.xml -DTEST_JDK_HOME=$(TEST_JDK_HOME) -DTEST_ROOT=$(TEST_ROOT) +COMPILE_TOOLS_CMD=ant -f .$(D)scripts$(D)build_tools.xml -DTEST_JDK_HOME=$(TEST_JDK_HOME) -DTEST_ROOT=$(TEST_ROOT) -DLIB_DIR=$(LIB_DIR) compileTools: $(RM) -r $(COMPILATION_OUTPUT); \ @@ -120,7 +140,7 @@ _failed: # generate parallel list ####################################### genParallelList: envDetect - $(MAKE) -f makeGen.mk AUTO_DETECT=$(AUTO_DETECT) MODE=parallelList NUM_MACHINES=$(NUM_MACHINES) TEST_TIME=$(TEST_TIME) TESTTARGET=$(TEST) TESTLIST=$(TESTLIST) TRSS_URL=$(TRSS_URL) + $(MAKE) -f makeGen.mk AUTO_DETECT=$(AUTO_DETECT) MODE=parallelList NUM_MACHINES=$(NUM_MACHINES) TEST_TIME=$(TEST_TIME) TESTTARGET=$(TEST) TESTLIST=$(TESTLIST) TRSS_URL=$(TRSS_URL) LIB_DIR=$(LIB_DIR) ####################################### # clean diff --git a/scripts/build_tools.xml b/scripts/build_tools.xml index 39f529bc..d89b6115 100644 --- a/scripts/build_tools.xml +++ b/scripts/build_tools.xml @@ -21,7 +21,7 @@ - + diff --git a/scripts/getDependencies.pl b/scripts/getDependencies.pl deleted file mode 100644 index b0296af2..00000000 --- a/scripts/getDependencies.pl +++ /dev/null @@ -1,298 +0,0 @@ -#!/usr/bin/perl - -################################################################################ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -################################################################################ - -use strict; -use warnings; -use Digest::SHA; -use Getopt::Long; -use File::Copy; -use File::Spec; -use File::Path qw(make_path); - -# define test src root path -my $path; -# define task -my $task = "default"; -my $dependencyList = "all"; - -GetOptions ("path=s" => \$path, - "task=s" => \$task, - "dependencyList=s" => \$dependencyList) - or die("Error in command line arguments\n"); - -if (not defined $path) { - die "ERROR: Download path not defined!\n" -} - -if (! -d $path) { - print "$path does not exist, creating one.\n"; - my $isCreated = make_path($path, {chmod => 0777, verbose => 1}); -} - -# define directory path separator -my $sep = File::Spec->catfile('', ''); - -print "--------------------------------------------\n"; -print "path is set to $path\n"; -print "task is set to $task\n"; -print "dependencyList is set to $dependencyList\n"; - -# Define a a hash for each dependent jar -# Contents in the hash should be: -# url - required. url to download the dependent jar -# fname - required. the dependent jar name -# sha1 - sha1 value for the dependent jar (can be skipped if both shaurl and shafn are provided) -# shaurl - optional. url to download the sha file -# shafn - optional. sha file name (has to be used with shaurl) -# shaalg - optional. sha is calculated based on shaalg (default value is sha1) - -my %base = ( - asm_all => { - url => 'https://repo1.maven.org/maven2/org/ow2/asm/asm-all/6.0_BETA/asm-all-6.0_BETA.jar', - fname => 'asm-all.jar', - sha1 => '535f141f6c8fc65986a3469839a852a3266d1025' - }, - asm => { - url => 'https://repository.ow2.org/nexus/content/repositories/releases/org/ow2/asm/asm/9.0-beta/asm-9.0-beta.jar', - fname => 'asm.jar', - sha1 => 'a0f58cad836a410f6ba133aaa209aea7e54aaf8a' - }, - commons_cli => { - url => 'https://repo1.maven.org/maven2/commons-cli/commons-cli/1.2/commons-cli-1.2.jar', - fname => 'commons-cli.jar', - sha1 => '2bf96b7aa8b611c177d329452af1dc933e14501c' - }, - commons_exec => { - url => 'https://repo1.maven.org/maven2/org/apache/commons/commons-exec/1.1/commons-exec-1.1.jar', - fname => 'commons-exec.jar', - sha1 => '07dfdf16fade726000564386825ed6d911a44ba1' - }, - javassist => { - url => 'https://repo1.maven.org/maven2/org/javassist/javassist/3.20.0-GA/javassist-3.20.0-GA.jar', - fname => 'javassist.jar', - sha1 => 'a9cbcdfb7e9f86fbc74d3afae65f2248bfbf82a0' - }, - junit4 => { - url => 'https://repo1.maven.org/maven2/junit/junit/4.10/junit-4.10.jar', - fname => 'junit4.jar', - sha1 => 'e4f1766ce7404a08f45d859fb9c226fc9e41a861' - }, - testng => { - url => 'https://repo1.maven.org/maven2/org/testng/testng/6.14.2/testng-6.14.2.jar', - fname => 'testng.jar', - sha1 => '10c93c2c0d165e895a7582dfd8b165f108658db5' - }, - jcommander => { - url => 'https://repo1.maven.org/maven2/com/beust/jcommander/1.48/jcommander-1.48.jar', - fname => 'jcommander.jar', - sha1 => 'bfcb96281ea3b59d626704f74bc6d625ff51cbce' - }, - asmtools => { - url => 'https://ci.adoptium.net/view/Dependencies/job/dependency_pipeline/lastSuccessfulBuild/artifact/asmtools/asmtools-core-7.0.b10-ea.jar', - fname => 'asmtools.jar', - shaurl => 'https://ci.adoptium.net/view/Dependencies/job/dependency_pipeline/lastSuccessfulBuild/artifact/asmtools/asmtools-core-7.0.b10-ea.jar.sha256sum.txt', - shafn => 'asmtools.jar.sha256sum.txt', - shaalg => '256' - }, - jaxb_api => { - url => 'https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api/2.3.0/jaxb-api-2.3.0.jar', - fname => 'jaxb-api.jar', - sha1 => '99f802e0cb3e953ba3d6e698795c4aeb98d37c48' - }, - json_simple => { - url => 'https://repo1.maven.org/maven2/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar', - fname => 'json-simple.jar', - sha1 => 'c9ad4a0850ab676c5c64461a05ca524cdfff59f1' - }, - tohandler_simple => { - url => 'https://openj9-jenkins.osuosl.org/job/Build_JDK_Timeout_Handler/lastSuccessfulBuild/artifact/openj9jtregtimeouthandler.jar', - fname => 'openj9jtregtimeouthandler.jar', - shaurl => 'https://openj9-jenkins.osuosl.org/job/Build_JDK_Timeout_Handler/lastSuccessfulBuild/artifact/openj9jtregtimeouthandler.jar.sha256sum.txt', - shafn => 'openj9jtregtimeouthandler.jar.sha256sum.txt', - shaalg => '256' - }, - osgi => { - url => 'https://repo1.maven.org/maven2/org/eclipse/platform/org.eclipse.osgi/3.16.100/org.eclipse.osgi-3.16.100.jar', - fname => 'org.eclipse.osgi-3.16.100.jar', - sha1 => '7ddb312f386b799d6e004d193a01c50169bf69f3' - }, - jtreg_5_1_b01 => { - url => 'https://ci.adoptium.net/job/dependency_pipeline/lastSuccessfulBuild/artifact/jtreg/jtreg5.1-b01.tar.gz', - fname => 'jtreg_5_1_b01.tar.gz', - shaurl => 'https://ci.adoptium.net/job/dependency_pipeline/lastSuccessfulBuild/artifact/jtreg/jtreg5.1-b01.tar.gz.sha256sum.txt', - shafn => 'jtreg_5_1_b01.tar.gz.sha256sum.txt', - shaalg => '256' - }, - jtreg_6_1 => { - url => 'https://ci.adoptium.net/job/dependency_pipeline/lastSuccessfulBuild/artifact/jtreg/jtreg-6+1.tar.gz', - fname => 'jtreg_6_1.tar.gz', - shaurl => 'https://ci.adoptium.net/job/dependency_pipeline/lastSuccessfulBuild/artifact/jtreg/jtreg-6+1.tar.gz.sha256sum.txt', - shafn => 'jtreg_6_1.tar.gz.sha256sum.txt', - shaalg => '256' - }, - jtreg_7_3_1_1 => { - url => 'https://ci.adoptium.net/job/dependency_pipeline/lastSuccessfulBuild/artifact/jtreg/jtreg-7.3.1+1.tar.gz', - fname => 'jtreg_7_3_1_1.tar.gz', - shaurl => 'https://ci.adoptium.net/job/dependency_pipeline/lastSuccessfulBuild/artifact/jtreg/jtreg-7.3.1+1.tar.gz.sha256sum.txt', - shafn => 'jtreg_7_3_1_1.tar.gz.sha256sum.txt', - shaalg => '256' - }, - jython => { - url => 'https://repo1.maven.org/maven2/org/python/jython-standalone/2.7.2/jython-standalone-2.7.2.jar', - fname => 'jython-standalone.jar', - sha1 => '15592c29538abd36d15570eda9fa055ed1a618ba' - }, - jcstress => { - url => 'https://builds.shipilev.net/jcstress/jcstress-tests-all-20220908.jar', - fname => 'jcstress-tests-all-20220908.jar', - sha1 => '8cf348be49b8af939a3ce03216e3df53aa0f9ef2' - }); - -my @dependencies = split(',', $dependencyList); - -# Put all dependent jars hash to array to prepare downloading -my @jars_info; -foreach my $dependency (keys %base) { - foreach my $i (@dependencies) { - if ($i eq "all" || $dependency eq $i) { - push(@jars_info, $base{$dependency}); - } - } -} - -print "--------------------------------------------\n"; -print "Starting download third party dependent jars\n"; -print "--------------------------------------------\n"; - -if ($task eq "clean") { - my $output = `rm $path/*.jar`; - print "cleaning jar task completed.\n" -} elsif ($task eq "default") { - print "downloading dependent third party jars to $path\n"; - for my $i (0 .. $#jars_info) { - my $url = $jars_info[$i]{url}; - my $fn = $jars_info[$i]{fname}; - my $filename = $path . $sep . $fn; - my $shaurl = $jars_info[$i]{shaurl}; - my $shafn = $jars_info[$i]{shafn}; - my $shaalg = $jars_info[$i]{shaalg}; - if (!$shaalg) { - $shaalg = "sha1"; - } - my $sha = Digest::SHA->new($shaalg); - my $digest = ""; - - if (-e $filename) { - $sha->addfile($filename); - $digest = $sha->hexdigest; - } - - my $expectedsha = $jars_info[$i]{sha1}; - if (!$expectedsha) { - $shafn = $path . $sep . $shafn; - # if the sha file exists, parse the file and get the expected sha - if (-e $shafn) { - $expectedsha = getShaFromFile($shafn, $fn); - } - - # if expectedsha is not set above and shaurl is provided, download the sha file - # and parse the file to get the expected sha - if (!$expectedsha && $shaurl) { - downloadFile($shaurl, $shafn); - $expectedsha = getShaFromFile($shafn, $fn); - } - } - - if ($expectedsha && $digest eq $expectedsha) { - print "$filename exists with correct hash, not downloading\n"; - next; - } - - # download the dependent third party jar - downloadFile($url, $filename); - - # if shaurl is provided, re-download the sha file and reset the expectedsha value - # as the dependent third party jar is newly downloadeded - if ($shaurl) { - downloadFile($shaurl, $shafn); - $expectedsha = getShaFromFile($shafn, $fn); - } - - if (!$expectedsha) { - die "ERROR: cannot get the expected sha for file $fn.\n"; - } - - # validate dependencies sha sum - $sha = Digest::SHA->new($shaalg); - $sha->addfile($filename); - $digest = $sha->hexdigest; - - if ($digest ne $expectedsha) { - print "Expected sha is: $expectedsha,\n"; - print "Actual sha is : $digest.\n"; - print "Please delete $filename and rerun the program!"; - die "ERROR: sha checksum error.\n"; - } - } - print "downloaded dependent third party jars successfully\n"; -} else { - die "ERROR: task unsatisfied!\n"; -} - -sub getShaFromFile { - my ( $shafile, $fn ) = @_; - my $sha = ""; - open my $fh, '<', $shafile or print "Can't open file $!"; - my $content = do { local $/; <$fh> }; - my @token = split / /, $content; - if (@token > 1) { - $sha = $token[0]; - } else { - print "WARNING: cannot get the sha from $shafile.\nFile content: $content\n"; - } - return $sha; -} - -sub downloadFile { - my ( $url, $filename ) = @_; - print "downloading $url\n"; - my $output; - - # Delete existing file in case it is tagged incorrectly which curl would then honour.. - if (-e $filename) { - qx(rm $filename); - } - - # .txt SHA files are in ISO8859-1 - # note _ENCODE_FILE_NEW flag is set for zos - if ('.txt' eq substr $filename, -length('.txt')) { - $output = qx{_ENCODE_FILE_NEW=ISO8859-1 curl -k -o $filename $url 2>&1}; - } else { - $output = qx{_ENCODE_FILE_NEW=UNTAGGED curl -k -o $filename $url 2>&1}; - } - my $returnCode = $?; - if ($returnCode == 0) { - print "--> file downloaded to $filename\n"; - } else { - if ($output) { - print $output; - } - if (-e $filename) { - unlink $filename or die "Can't delete '$filename': $!\n"; - } - die "ERROR: downloading $url failed, return code: $returnCode\n"; - } -}