[libvirt] [tck PATCH] Fix runtime "undefined global" error in 100-disk-encryption.t

Commit 3836a38c added a $secret-undefine call at the end of 100-disk-encryption.t because the presence of the secret was reportedly causing an error when the test was run a 2nd time. Unfortunately the definition of "my $secret" was inside a SKIP: { ... } block, but the $secret->undefine was added just outside that block, so the test failed when it was run. Signed-off-by: Laine Stump <laine@laine.org> --- NB: this test is disabled unconditionally at the start of the SKIP block anyway, so I'm not sure how Jim encountered the error leading to the original patch. scripts/qemu/100-disk-encryption.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/qemu/100-disk-encryption.t b/scripts/qemu/100-disk-encryption.t index 1a36650..12386ae 100644 --- a/scripts/qemu/100-disk-encryption.t +++ b/scripts/qemu/100-disk-encryption.t @@ -117,6 +117,6 @@ diag "Undefining the inactive domain config"; $dom->undefine; ok_error(sub { $conn->get_domain_by_name("tck") }, "NO_DOMAIN error raised from missing domain", 42); -} $secret->undefine; +} -- 2.17.1

On 10/01/2018 04:07 PM, Laine Stump wrote:
Commit 3836a38c added a $secret-undefine call at the end of 100-disk-encryption.t because the presence of the secret was reportedly causing an error when the test was run a 2nd time. Unfortunately the definition of "my $secret" was inside a SKIP: { ... } block, but the $secret->undefine was added just outside that block, so the test failed when it was run.
Signed-off-by: Laine Stump <laine@laine.org> ---
NB: this test is disabled unconditionally at the start of the SKIP block anyway, so I'm not sure how Jim encountered the error leading to the original patch.
scripts/qemu/100-disk-encryption.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/qemu/100-disk-encryption.t b/scripts/qemu/100-disk-encryption.t index 1a36650..12386ae 100644 --- a/scripts/qemu/100-disk-encryption.t +++ b/scripts/qemu/100-disk-encryption.t @@ -117,6 +117,6 @@ diag "Undefining the inactive domain config"; $dom->undefine;
ok_error(sub { $conn->get_domain_by_name("tck") }, "NO_DOMAIN error raised from missing domain", 42); -}
$secret->undefine; +}
Reviewed-by: Yash Mankad <ymankad@redhat.com>

On 10/1/18 2:07 PM, Laine Stump wrote:
Commit 3836a38c added a $secret-undefine call at the end of 100-disk-encryption.t because the presence of the secret was reportedly causing an error when the test was run a 2nd time. Unfortunately the definition of "my $secret" was inside a SKIP: { ... } block, but the $secret->undefine was added just outside that block, so the test failed when it was run.
Signed-off-by: Laine Stump <laine@laine.org> ---
NB: this test is disabled unconditionally at the start of the SKIP block anyway, so I'm not sure how Jim encountered the error leading to the original patch.
Grrrr, because I have an old, downstream patch that tweaked this test and it wasn't rebased properly. FYI the relevant hunks look like this --- Sys-Virt-TCK-v1.0.0.orig/scripts/qemu/100-disk-encryption.t +++ Sys-Virt-TCK-v1.0.0/scripts/qemu/100-disk-encryption.t @@ -29,7 +29,7 @@ configuration enabling it to be tracked use strict; use warnings; -use Test::More tests => 8; +use Test::More; use Sys::Virt::TCK; use Test::Exception; @@ -40,9 +40,12 @@ my $conn = eval { $tck->setup(); }; BAIL_OUT "failed to setup test harness: $@" if $@; END { $tck->cleanup if $tck; } -SKIP: { - skip "Only relevant to QEMU driver", 8 unless $conn->get_type() eq "QEMU"; - skip "Libvirt LUKS support isn't ready", 8; +if ( $conn->get_type() ne "QEMU") { + $tck->cleanup if $tck; + eval "use Test::More skip_all => \"Only relevant to QEMU driver\";"; +} else { + eval "use Test::More tests => 8"; +} my $dir = $tck->bucket_dir("300-disk-encryption"); my $disk = catfile($dir, "demo.qcow2"); So in my setup the test was being run. And sadly there is yet another patch that changes the test to use raw format for luks encryption, which I suppose makes the test pass :-/. I've slowly been upstreaming or dropping these types of downstream hacks. Sorry for letting them get in the way of "fixing" this test. Regards, Jim
participants (3)
-
Jim Fehlig
-
Laine Stump
-
Yash Mankad