Commit 8cb5a45f authored by Laine Stump's avatar Laine Stump

fix selinux/100-static-relabel-no test

This test disables auto-relabeling so that it can test if setting a
user-defined label in the config will work. The problem is that the
disk image used to boot is then not labelled correctly, and qemu can't
open it.

To circumvent this failure (which is *not* of the functionality we're
testing), this patch just temporarily sets SELinux to permissive mode
during the test, then sets it back during cleanup.
Signed-off-by: 's avatarLaine Stump <>
Reviewed-by: 's avatarDaniel P. Berrangé <>
parent 123cf0fb
......@@ -32,10 +32,14 @@ use Test::More tests => 6;
use Sys::Virt::TCK;
use Sys::Virt::TCK::SELinux;
my $selinux_status = "";
my $tck = Sys::Virt::TCK->new();
my $conn = eval { $tck->setup(); };
BAIL_OUT "failed to setup test harness: $@" if $@;
END { $tck->cleanup if $tck; }
system("setenforce", "1") if ($selinux_status eq "Enforcing");
$tck->cleanup if $tck;
my $info;
eval {
......@@ -58,6 +62,13 @@ SKIP: {
->disk(src => $disk, dst => "vdb", type => "file")
chomp($selinux_status = `getenforce`);
diag "selinux is $selinux_status";
if ($selinux_status eq "Enforcing") {
diag "Temporarily setting SELinux to Permissive mode";
system("setenforce", "0");
diag "Creating a new transient domain";
my $dom;
ok_domain(sub { $dom = $conn->create_domain($xml) }, "created transient domain object");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment