-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fail test run when QEMU fails too quickly #266
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Process#success?
.
Also, can't we just always raise an error when the exit status is not 0?
No. QEMU can crash, but after a restart, HLK tests will continue working. |
What about only checking the elapsed time then? |
dd7178c
to
72d6126
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added comments for a few things I missed in the last review.
@@ -99,7 +113,7 @@ def run_vm | |||
@machine.run_pre_start_commands | |||
|
|||
qemu = run_qemu(scope) | |||
qemu.wait_no_fail | |||
@fails_quickly = check_fails_too_quickly(qemu.wait_no_fail&.exitstatus) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you raise immediately after qemu = nil
?
You can also @fails_quickly
turn into a local variable by doing so. It is better to have fewer states (instance variables).
It is also better to use .
instead of &.
; AutoHCK::CmdRun::wait_no_fail
returns nil
if the process does not terminate, but such a situation should not happen since Process::WNOHANG
is not passed to AutoHCK::CmdRun::wait_no_fail
. If AutoHCK::CmdRun::wait_no_fail
returns nil
despite that, it only implies the program has a bug. Assuming the process either succeeded or failed is wrong in that case, and we should raise an error instead.
end | ||
|
||
if @first_fail_time.nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end | |
if @first_fail_time.nil? | |
elsif @first_fail_time.nil? |
@first_fail_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) | ||
false | ||
else | ||
(Process.clock_gettime(Process::CLOCK_MONOTONIC) - @first_fail_time) <= 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Process.clock_gettime(Process::CLOCK_MONOTONIC) - @first_fail_time) <= 10 | |
Process.clock_gettime(Process::CLOCK_MONOTONIC) - @first_fail_time <= 10 |
Signed-off-by: Kostiantyn Kostiuk <[email protected]>
72d6126
to
28a0754
Compare
No description provided.