mirror of
https://github.com/xcat2/xcat-dep.git
synced 2026-09-12 12:36:23 +00:00
test(genesis): cover publisher compatibility gates
This commit is contained in:
+21
-5
@@ -119,9 +119,8 @@ SPEC
|
||||
return $FIXTURE;
|
||||
}
|
||||
|
||||
# run_publish($release_dir) -> ($exit, $output, $common_dir)
|
||||
sub run_publish {
|
||||
my ($release, $tag, $mutate_common) = @_;
|
||||
my ($release, $tag, $mutate_common, $skip_repo_verification) = @_;
|
||||
my $out = "$tmp/$tag";
|
||||
make_path("$out/root", "$out/collect");
|
||||
# Something to collect, so the run gets past the "built nothing" guard. It must NOT be an
|
||||
@@ -137,13 +136,16 @@ sub run_publish {
|
||||
print $fh "\n[common]\n";
|
||||
print $fh "$_=$m{common}{$_}\n" for sort keys %{ $m{common} // {} };
|
||||
close $fh;
|
||||
my $cmd = join(' ', map { my $x = $_; $x =~ s/'/'"'"'/g; "'$x'" }
|
||||
my @command =
|
||||
($^X, $SCRIPT, '--repo-root', "$out/root", '--output', "$out/build",
|
||||
'--repo-dep', "$out/repo", '--target', $target, '--run-id', $tag,
|
||||
'--build-timestamp', '1787672536',
|
||||
'--skip-build', '--skip-genesis', '--skip-xcat-dep', '--skip-perl',
|
||||
'--skip-tarball',
|
||||
'--collect-dir', "$out/collect", '--genesis-release', $release)) . ' 2>&1';
|
||||
'--collect-dir', "$out/collect", '--genesis-release', $release);
|
||||
push @command, '--no-verify-repo' if $skip_repo_verification;
|
||||
my $cmd = join(' ', map { my $x = $_; $x =~ s/'/'"'"'/g; "'$x'" } @command)
|
||||
. ' 2>&1';
|
||||
my $log = `$cmd`;
|
||||
return ($? >> 8, $log, "$out/repo/common");
|
||||
}
|
||||
@@ -200,13 +202,27 @@ sub run_publish {
|
||||
'missing-current-package',
|
||||
sub { delete $_[0]->{ rpm_package_name('s390x') } },
|
||||
);
|
||||
isnt($rc, 0, 'a version 1 release does not hide an incomplete current manifest');
|
||||
isnt($rc, 0, 'a current release does not hide an incomplete manifest');
|
||||
like($out, qr/\[common\] is missing supported packages: .*s390x/,
|
||||
'the manifest failure identifies the missing current package');
|
||||
ok(!-d $common || !glob("$common/*.rpm"),
|
||||
'an incomplete current manifest publishes nothing');
|
||||
}
|
||||
|
||||
{
|
||||
my ($rc, $out, $common) = run_publish(
|
||||
$RELEASE,
|
||||
'missing-current-package-without-repo-verification',
|
||||
sub { delete $_[0]->{ rpm_package_name('s390x') } },
|
||||
1,
|
||||
);
|
||||
isnt($rc, 0, 'repository verification cannot disable the common manifest gate');
|
||||
like($out, qr/\[common\] is missing supported packages: .*s390x/,
|
||||
'the mandatory manifest gate identifies the missing package');
|
||||
ok(!-d $common || !glob("$common/*.rpm"),
|
||||
'the mandatory manifest gate publishes nothing');
|
||||
}
|
||||
|
||||
{
|
||||
my ($rc, $out, $common) = run_publish(
|
||||
$RELEASE,
|
||||
|
||||
@@ -103,9 +103,13 @@ done_testing();
|
||||
sub write_target_manifest {
|
||||
my ($root, $target) = @_;
|
||||
make_path($root);
|
||||
my %manifest = read_manifest("$repo_root/packages-manifest.conf");
|
||||
my $common = join('', map { "$_=$manifest{common}{$_}\n" }
|
||||
sort keys %{ $manifest{common} // {} });
|
||||
write_binary(
|
||||
"$root/packages-manifest.conf",
|
||||
"[$target]\n" . rpm_package_name(capture_command('uname', '-m')) . "=*\n",
|
||||
"[$target]\n" . rpm_package_name(capture_command('uname', '-m'))
|
||||
. "=*\n\n[common]\n$common",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -583,7 +587,7 @@ sub test_version_1_deb_consumer {
|
||||
extra => [ '--genesis-release', $current_release ],
|
||||
);
|
||||
isnt($missing_status, 0,
|
||||
'a version 1 release does not hide an incomplete current shared manifest');
|
||||
'a current release does not hide an incomplete shared manifest');
|
||||
like(read_binary($missing_log), qr/\[shared\] is missing supported packages: .*s390x/,
|
||||
'the shared manifest failure identifies the missing current package');
|
||||
ok(!-d "$missing_apt/pool/main/xcat-genesis-openembedded",
|
||||
|
||||
@@ -214,7 +214,7 @@ write_release_manifest(
|
||||
);
|
||||
write_checksums($legacy_release);
|
||||
ok(validate_complete_release($legacy_release),
|
||||
'complete version 1 releases remain publishable');
|
||||
'complete version 1 releases remain readable');
|
||||
|
||||
my $invalid_legacy_release = "$tmp/invalid-legacy-release";
|
||||
copy_tree($complete_release, $invalid_legacy_release);
|
||||
@@ -272,14 +272,16 @@ dies_like(sub { validate_release($missing_release) }, qr/Genesis release is miss
|
||||
'incomplete architecture set fails');
|
||||
|
||||
SKIP: {
|
||||
skip 'git is not installed', 4 unless command_exists('git');
|
||||
skip 'git is not installed', 9 unless command_exists('git');
|
||||
my $source = "$tmp/dirty-xcat-core";
|
||||
make_path("$source/xCAT-genesis-builder/oe");
|
||||
my $oe = "$source/xCAT-genesis-builder/oe";
|
||||
make_path($oe);
|
||||
write_binary("$source/Version", "$version\n");
|
||||
write_binary(
|
||||
"$source/xCAT-genesis-builder/oe/build",
|
||||
"#!/bin/sh\n"
|
||||
. "if [ \"\${1-}\" = --list-architectures ]; then\n"
|
||||
. " mkdir -p \"\${XCAT_GENESIS_WORK_DIR:?}\"\n"
|
||||
. " printf '%s\\n' x86_64\n"
|
||||
. " exit 0\n"
|
||||
. "fi\n"
|
||||
@@ -322,6 +324,38 @@ SKIP: {
|
||||
);
|
||||
like(read_binary($target_log), qr/does not support Genesis architecture s390x/,
|
||||
'missing target failure identifies the required xcat-core support');
|
||||
ok(!-d "$oe/.work",
|
||||
'the capability query does not create a work directory in xcat-core');
|
||||
|
||||
write_binary("$oe/build", "#!/bin/sh\nexit 23\n");
|
||||
chmod(0755, "$oe/build") or die "Cannot update fixture build executable: $!";
|
||||
my $failed_log = "$tmp/failed-query.log";
|
||||
isnt(
|
||||
run_capture(
|
||||
$failed_log, $builder, '--xcat-source', $source,
|
||||
'--architecture', 's390x',
|
||||
'--output-dir', "$tmp/failed-query-output",
|
||||
),
|
||||
0,
|
||||
'release builder rejects a failed architecture query',
|
||||
);
|
||||
like(read_binary($failed_log), qr/does not report supported Genesis architectures/,
|
||||
'failed architecture queries are reported');
|
||||
|
||||
write_binary("$oe/build", "#!/bin/sh\nexit 0\n");
|
||||
chmod(0755, "$oe/build") or die "Cannot update fixture build executable: $!";
|
||||
my $empty_log = "$tmp/empty-query.log";
|
||||
isnt(
|
||||
run_capture(
|
||||
$empty_log, $builder, '--xcat-source', $source,
|
||||
'--architecture', 's390x',
|
||||
'--output-dir', "$tmp/empty-query-output",
|
||||
),
|
||||
0,
|
||||
'release builder rejects an empty architecture query',
|
||||
);
|
||||
like(read_binary($empty_log), qr/reported no supported Genesis architectures/,
|
||||
'empty architecture queries are reported');
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
@@ -528,7 +562,7 @@ sub exercise_builder_tmpdir {
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
if [ "${1-}" = --list-architectures ]; then
|
||||
printf '%s\n' x86_64
|
||||
printf '%s\n' x86_64 s390x
|
||||
exit 0
|
||||
fi
|
||||
expected=$XCAT_GENESIS_WORK_DIR/build/tmp
|
||||
@@ -582,7 +616,7 @@ EXPORT
|
||||
$status = run_capture(
|
||||
$log, $builder, '--xcat-source', $source,
|
||||
'--output-dir', $output, '--work-dir', $persistent_work,
|
||||
'--format', 'deb',
|
||||
'--format', 'deb', '--architecture', 's390x',
|
||||
);
|
||||
}
|
||||
is($status, 0, 'release builder isolates the OpenEmbedded tmpdir');
|
||||
@@ -593,6 +627,6 @@ EXPORT
|
||||
is((stat($output))[2] & oct('07777'), oct('0755'),
|
||||
'release directory is readable by other users');
|
||||
my $built = validate_release($output);
|
||||
is($built->{architectures}, 'x86_64', 'isolated build keeps the target architecture');
|
||||
is($built->{architectures}, 's390x', 'isolated build keeps the target architecture');
|
||||
is($built->{formats}, 'deb', 'isolated build keeps the requested format');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user