Commit fb906a39 authored by Daniel P. Berrangé's avatar Daniel P. Berrangé

scripts: cope with multiple seclabels in live XML

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.
Reviewed-by: 's avatarLaine Stump <laine@laine.org>
Signed-off-by: 's avatarDaniel P. Berrangé <berrange@redhat.com>
parent 2b1ef5b0
......@@ -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");
......
......@@ -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);
......
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