Skip to content

Commit

Permalink
Added system test prestage jars
Browse files Browse the repository at this point in the history
- Enables to avoid system test prerequisite zip file being empty.

Signed-off-by: Anna Babu Palathingal <[email protected]>
  • Loading branch information
annaibm committed Apr 24, 2024
1 parent 41c3581 commit 30ac418
Showing 1 changed file with 94 additions and 39 deletions.
133 changes: 94 additions & 39 deletions scripts/getDependencies.pl
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,6 @@
fname => 'asm.jar',
sha1 => 'a0f58cad836a410f6ba133aaa209aea7e54aaf8a'
},
byte_buddy => {
url => 'https://repo1.maven.org/maven2/net/bytebuddy/byte-buddy/1.14.12/byte-buddy-1.14.12.jar',
fname => 'byte-buddy.jar',
sha1 => '6e37f743dc15a8d7a4feb3eb0025cbc612d5b9e1'
},
byte_buddy_agent => {
url => 'https://repo1.maven.org/maven2/net/bytebuddy/byte-buddy-agent/1.14.12/byte-buddy-agent-1.14.12.jar',
fname => 'byte-buddy-agent.jar',
sha1 => 'be4984cb6fd1ef1d11f218a648889dfda44b8a15'
},
objenesis => {
url => 'https://repo1.maven.org/maven2/org/objenesis/objenesis/3.3/objenesis-3.3.jar',
fname => 'objenesis.jar',
sha1 => '1049c09f1de4331e8193e579448d0916d75b7631'
},
commons_cli => {
url => 'https://repo1.maven.org/maven2/commons-cli/commons-cli/1.2/commons-cli-1.2.jar',
fname => 'commons-cli.jar',
Expand All @@ -109,11 +94,6 @@
fname => 'junit4.jar',
sha1 => 'e4f1766ce7404a08f45d859fb9c226fc9e41a861'
},
mockito_core => {
url => 'https://repo1.maven.org/maven2/org/mockito/mockito-core/5.11.0/mockito-core-5.11.0.jar',
fname => 'mockito-core.jar',
sha1 => 'e4069fa4f4ff2c94322cfec5f2e45341c6c70aff'
},
testng => {
url => 'https://repo1.maven.org/maven2/org/testng/testng/6.14.2/testng-6.14.2.jar',
fname => 'testng.jar',
Expand Down Expand Up @@ -195,14 +175,76 @@
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',
dir => 'asm',
fname => 'asm.jar',
sha1 => 'af582ff60bc567c42d931500c3fdc20e0141ddf9'
},
cvsclient => {
url => 'https://repo1.maven.org/maven2/org/netbeans/lib/cvsclient/20060125/cvsclient-20060125.jar',
dir => 'cvsclient',
fname => 'cvsclient.jar',
sha1 => 'cc80bd0085c79be7ed332cbdc1db77498bff1fda'
},
hamcrest_core => {
url => 'https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar',
dir => 'junit',
fname => 'hamcrest-core.jar',
sha1 => '42a25dc3219429f0e5d060061f71acb49bf010a0'
},
junit => {
url => 'https://repo1.maven.org/maven2/junit/junit/4.12/junit-4.12.jar',
dir => 'junit',
fname => 'junit.jar',
sha1 => '2973d150c0dc1fefe998f834810d68f278ea58ec'
},
log4j_api => {
url => 'https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-api/2.16.0/log4j-api-2.16.0.jar',
dir => 'log4j',
fname => 'log4j-api.jar',
sha1 => '4727d93a76616ffc4149dffac5801827c0f4ac71'
},
log4j_core => {
url => 'https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-core/2.16.0/log4j-core-2.16.0.jar',
dir => 'log4j',
fname => 'log4j-core.jar',
sha1 => 'ca12fb3902ecfcba1e1357ebfc55407acec30ede'
},
mauve => {
url => 'https://ci.adoptium.net/job/systemtest.getDependency/lastSuccessfulBuild/artifact/systemtest_prereqs/mauve/mauve.jar',
dir => 'mauve',
fname => 'mauve.jar',
sha1 => '8ed5b172be6a8885b72d0015f44e2a0b6c172d47'
},
tools => {
url => 'https://ci.adoptium.net/job/systemtest.getDependency/lastSuccessfulBuild/artifact/systemtest_prereqs/tools/tools.jar',
dir => 'tools',
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_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});
push(@jars_info, $jars_to_use{$dependency});
}
}
}
Expand All @@ -219,7 +261,15 @@
for my $i (0 .. $#jars_info) {
my $url = $jars_info[$i]{url};
my $fn = $jars_info[$i]{fname};
my $filename = $path . $sep . $fn;
my $dir = $jars_info[$i]{dir} // "";
my $full_dir_path = File::Spec->catdir($path, $dir);

if (!-d $full_dir_path) {
make_path($full_dir_path, {chmod => 0777, verbose => 1}) or die "Failed to create directory: $full_dir_path: $!";
print "Directory created: $full_dir_path\n";
}

my $filename = $full_dir_path . $sep . $fn;
my $shaurl = $jars_info[$i]{shaurl};
my $shafn = $jars_info[$i]{shafn};

Expand Down Expand Up @@ -264,30 +314,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";
Expand Down

0 comments on commit 30ac418

Please sign in to comment.