From 7a1d0ca62dacde1b620210e098628b73c2b9afda Mon Sep 17 00:00:00 2001 From: Anna Babu Palathingal <148897727+annaibm@users.noreply.github.com> Date: Mon, 15 Apr 2024 17:17:12 -0400 Subject: [PATCH] Added system test prestage jars - Enables to avoid system test prerequisite zip file being empty. related: https://github.com/adoptium/aqa-tests/issues/4912 Signed-off-by: Anna Babu Palathingal --- scripts/getDependencies.pl | 97 ++++++++++++++++++++++++++++++-------- 1 file changed, 78 insertions(+), 19 deletions(-) diff --git a/scripts/getDependencies.pl b/scripts/getDependencies.pl index 45a4d031..5c79e03d 100644 --- a/scripts/getDependencies.pl +++ b/scripts/getDependencies.pl @@ -175,14 +175,68 @@ sha1 => '2cc971b6c20949c1ff98d1a4bc741ee848a09523' }); +my %system_jars = ( + 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' + }, + ant_launcher => { + url => 'https://repo1.maven.org/maven2/org/apache/ant/ant-launcher/1.8.1/ant-launcher-1.8.1.jar', + fname => 'ant-launcher.jar', + sha1 => 'c99d018fcc43a1540e465b9a097508b19075198c' + }, + asm => { + url => 'https://repository.ow2.org/nexus/content/repositories/releases/org/ow2/asm/asm/9.0/asm-9.0.jar', + fname => 'asm.jar', + sha1 => 'af582ff60bc567c42d931500c3fdc20e0141ddf9' + }, + cvsclient => { + url => 'https://repo1.maven.org/maven2/org/netbeans/lib/cvsclient/20060125/cvsclient-20060125.jar', + fname => 'cvsclient.jar', + sha1 => 'cc80bd0085c79be7ed332cbdc1db77498bff1fda' + }, + hamcrest_core => { + url => 'https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar', + fname => 'hamcrest-core.jar', + sha1 => '42a25dc3219429f0e5d060061f71acb49bf010a0' + }, + junit => { + url => 'https://repo1.maven.org/maven2/junit/junit/4.12/junit-4.12.jar', + fname => 'junit.jar', + sha1 => '2973d150c0dc1fefe998f834810d68f278ea58ec' + }, + log4j_api => { + url => 'https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-api/2.15.0/log4j-api-2.15.0.jar', + fname => 'log4j-api.jar', + sha1 => '4a5aa7e55a29391c6f66e0b259d5189aa11e45d0' + }, + log4j_core => { + url => 'https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-core/2.15.0/log4j-core-2.15.0.jar', + fname => 'log4j-core.jar', + sha1 => 'ba55c13d7ac2fd44df9cc8074455719a33f375b9' + }, + mauve => { + url => 'https://ci.adoptium.net/job/systemtest.getDependency/lastSuccessfulBuild/artifact/systemtest_prereqs/mauve/mauve.jar', + fname => 'mauve.jar', + sha1 => '8ed5b172be6a8885b72d0015f44e2a0b6c172d47' + }, + tools => { + url => 'https://ci.adoptium.net/job/systemtest.getDependency/lastSuccessfulBuild/artifact/systemtest_prereqs/tools/tools.jar', + fname => 'tools.jar', + sha1 => '6f3219b1f8b346380664c525bf97018fc1420159' + }); + my @dependencies = split(',', $dependencyList); # Put all dependent jars hash to array to prepare downloading +my %jars_to_use = $path =~ /system_prereq_lib/ ? %system_jars : %base; + my @jars_info; -foreach my $dependency (keys %base) { +foreach my $dependency (keys %jars_to_use) { foreach my $i (@dependencies) { - if ($i eq "all" || $dependency eq $i) { - push(@jars_info, $base{$dependency}); + if ($i eq "all" || exists $jars_to_use{$dependency}) { + push(@jars_info, $jars_to_use{$dependency}); } } } @@ -244,30 +298,35 @@ next; } + my $ignoreChecksum = ($url =~ /systemtest.getDependency/); # 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 (!$ignoreChecksum) { + if ($shaurl) { + downloadFile($shaurl, $shafn); + $expectedsha = getShaFromFile($shafn, $fn); + } - if (!$expectedsha) { - die "ERROR: cannot get the expected sha for file $fn.\n"; - } + 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; + # 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"; + 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"; + } + } else { + print "Checksum verification skipped for $filename\n"; } } print "downloaded dependent third party jars successfully\n";