Libvirt may report two seclabels, one for SELinux and one for DAC. Make sure we grab the right one from the XML. Also fix the number of tests. Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> --- scripts/selinux/100-static-relabel-no.t | 4 ++-- scripts/selinux/110-static-relabel-yes.t | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/selinux/100-static-relabel-no.t b/scripts/selinux/100-static-relabel-no.t index 8d9fda8..ab52534 100644 --- a/scripts/selinux/100-static-relabel-no.t +++ b/scripts/selinux/100-static-relabel-no.t @@ -62,9 +62,9 @@ SKIP: { my $dom; ok_domain(sub { $dom = $conn->create_domain($xml) }, "created transient domain object"); - my $domainlabel = xpath($dom, "string(/domain/seclabel/label)"); + my $domainlabel = xpath($dom, "string(/domain/seclabel[\@model='selinux']/label)"); diag "domainlabel $domainlabel"; - my $imagelabel = xpath($dom, "string(/domain/seclabel/imagelabel)"); + my $imagelabel = xpath($dom, "string(/domain/seclabel[\@model='selinux']/imagelabel)"); diag "imagelabel $imagelabel"; is($origdomainlabel, $domainlabel, "static label is $domainlabel"); diff --git a/scripts/selinux/110-static-relabel-yes.t b/scripts/selinux/110-static-relabel-yes.t index 76781ca..18350cf 100644 --- a/scripts/selinux/110-static-relabel-yes.t +++ b/scripts/selinux/110-static-relabel-yes.t @@ -28,7 +28,7 @@ and files can be relabelled use strict; use warnings; -use Test::More tests => 5; +use Test::More tests => 6; use Sys::Virt::TCK; use Sys::Virt::TCK::SELinux; @@ -62,9 +62,9 @@ SKIP: { ok_domain(sub { $dom = $conn->create_domain($xml) }, "created transient domain object"); diag $dom->get_xml_description(); - my $domainlabel = xpath($dom, "string(/domain/seclabel/label)"); + my $domainlabel = xpath($dom, "string(/domain/seclabel[\@model='selinux']/label)"); diag "domainlabel $domainlabel"; - my $imagelabel = xpath($dom, "string(/domain/seclabel/imagelabel)"); + my $imagelabel = xpath($dom, "string(/domain/seclabel[\@model='selinux']/imagelabel)"); diag "imagelabel $imagelabel"; my $imagetype = selinux_get_type($imagelabel); my $imagemcs = selinux_get_mcs($imagelabel); -- 2.17.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list