ts-livepatch-run: Treat (just) falseish from OutputCheck as fail
PATCH 1/3 ts-livepatch-run: Treat (just) falseish from OutputCheck as fail
This is more idiomatic. All existing OutputChecks return booleans, so no functional change.
--- ts-livepatch-run | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
ts-livepatch-run +2 -2
@@ -147,8 +147,8 @@ sub livepatch_test () { } if (defined($test->{OutputCheck})) { $_ = $output; - $rc=$test->{OutputCheck}->(); - if ($rc ne 1) { + my $ok = $test->{OutputCheck}->(); + if (!$ok) { die "FAILED! OutputCheck=$test->{OutputCheck}, input=$output\n"; } }
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 2/3 ts-livepatch-run: Print a message about expected failures
target_cmd_output_root_status prints the command exit status. If that was a failure and the failure was as expected, this can be confusing to readers who do not know that this is a possibility. So print a message about it.
--- ts-livepatch-run | 3 +++ 1 file changed, 3 insertions(+)
ts-livepatch-run +3 -0
@@ -152,6 +152,9 @@ sub livepatch_test () { die "FAILED! OutputCheck=$test->{OutputCheck}, input=$output\n"; } } + if ($expected_rc) { + logm "... that failure ($rc) was as required; all is well."; + } } return 0; }
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [OSSTEST PATCH 2/3] ts-livepatch-run: Print a message about expected failures
Quoted 7 lines · Ian Jackson
target_cmd_output_root_statusprints the command exit status. If that was a failure and the failure was as expected, this can be confusing to readers who do not know that this is a possibility. So print a message about it.Signed-off-by Ian Jackson <[email protected]>CC Konrad Rzeszutek Wilk <[email protected]>
Thank you!
Quoted 21 lines
--- ts-livepatch-run | 3 +++ 1 file changed, 3 insertions(+)ts-livepatch-run +3
-0@@ -152,6 +152,9 @@ sub livepatch_test () { die "FAILED! OutputCheck=$test->{OutputCheck}, input=$output\n"; } } + if ($expected_rc) { + logm "... that failure ($rc) was as required; all is well."; + } } return 0; }Signature · 1 line
2.11.0
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 3/3 ts-livepatch-run: Fix erroneous $$ in double-check
In reply to Ian JacksonThe doubled $s here are simply a mistake. The result is to make this test ineffective, since $$file' means the value of the variable whose name is in the variable $file', which here will never exist. This produces a `Use of uninitialized value' warning and substitutes the empty string, so overall we test the existence of the directory.
The missing check is not of much consequence since this check is not really expected ever to fail, and if it does, some actual test execution would fail due to the missing file.
So overall I think the only change is to log output.
--- ts-livepatch-run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ts-livepatch-run +1 -1
@@ -161,7 +161,7 @@ sub livepatch_test () { sub livepatch_check () { foreach my $file (@livepatch_files) { - if (!target_file_exists($ho, "/usr/lib/debug/xen-livepatch/$$file")) { + if (!target_file_exists($ho, "/usr/lib/debug/xen-livepatch/$file")) { die "$file is missing!\n"; } }
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [OSSTEST PATCH 3/3] ts-livepatch-run: Fix erroneous $$ in double-check
Quoted 6 lines · Ian Jackson
The doubled $s here are simply a mistake. The result is to make this test ineffective, since
$$file' meansthe value of the variable whose name is in the variable $file', which here will never exist. This produces a `Use of uninitialized value' warning and substitutes the empty string, so overall we test the existence of the directory.
Quoted 8 lines
The missing check is not of much consequence since this check is not really expected ever to fail, and if it does, some actual test execution would fail due to the missing file.
So overall I think the only change is to log output.
Signed-off-by Ian Jackson <[email protected]>CC Konrad Rzeszutek Wilk <[email protected]>
Thank you!
Quoted 20 lines
--- ts-livepatch-run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)ts-livepatch-run +1
-1@@ -161,7 +161,7 @@ sub livepatch_test () { sub livepatch_check () { foreach my $file (@livepatch_files) { - if (!target_file_exists($ho, "/usr/lib/debug/xen-livepatch/$$file")) { + if (!target_file_exists($ho, "/usr/lib/debug/xen-livepatch/$file")) { die "$file is missing!\n"; } }Signature · 1 line
2.11.0
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 5 lines · Ian Jackson
This is more idiomatic. All existing OutputChecks return booleans, so no functional change.
Signed-off-by Ian Jackson <[email protected]>CC Konrad Rzeszutek Wilk <[email protected]>
Thank you!
Quoted 22 lines
--- ts-livepatch-run | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)ts-livepatch-run +2
-2@@ -147,8 +147,8 @@ sub livepatch_test () { } if (defined($test->{OutputCheck})) { $_ = $output; - $rc=$test->{OutputCheck}->(); - if ($rc ne 1) { + my $ok = $test->{OutputCheck}->(); + if (!$ok) { die "FAILED! OutputCheck=$test->{OutputCheck}, input=$output\n"; } }Signature · 1 line
2.11.0
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel