summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranonym <anonym@riseup.net>2016-12-27 20:41:21 +0100
committeranonym <anonym@riseup.net>2016-12-27 20:41:21 +0100
commit2f0609e41019b400fa8cd9d85973fbaeabb6c1c6 (patch)
tree46d1308d4271fa82e9862460e110a3420ef47ee2
parent2986dbc7b2f2d63a93b4cc150fc1e8a33dce79fd (diff)
Make the memory wipe wait reliable again.
I've seen it take longer than the 10m sleep imposed by `debug=wipemem` => the domain is not running when we try to dump the memory and a Libvirt::Error is thrown. Refs: #12067
-rw-r--r--features/step_definitions/erase_memory.rb25
1 files changed, 6 insertions, 19 deletions
diff --git a/features/step_definitions/erase_memory.rb b/features/step_definitions/erase_memory.rb
index c2b684b..6e446ff 100644
--- a/features/step_definitions/erase_memory.rb
+++ b/features/step_definitions/erase_memory.rb
@@ -179,28 +179,15 @@ end
When /^I shutdown and wait for Tails to finish wiping the memory$/ do
$vm.spawn("halt")
-
- check_if_memory_wipe_finished = Proc.new do
- # Ideally we would want this proc to run in exactly 1s, so that retry_action
- # would take exactly memory_wipe_timeout seconds. But it takes some time
- # to run @screen.type and @screen.find, that depends on the host system,
- # so we can't simply "sleep X".
+ try_for(memory_wipe_timeout, msg: "memory wipe didn't finish, probably the VM crashed") do
# We spam keypresses to prevent console blanking from hiding the
# image we're waiting for
@screen.type(" ")
@screen.find('MemoryWipeCompleted.png')
end
-
- begin
- retry_action(
- memory_wipe_timeout,
- :operation_name => "Checking if memory wipe has finished",
- &check_if_memory_wipe_finished
- )
- rescue MaxRetriesFailure
- puts "Cannot tell if memory wipe completed."
- puts "One possible reason for this is a garbled display,"
- puts "so let's go on and rely on the next steps to check"
- puts "how well memory was wiped."
- end
+rescue Timeout::Error
+ puts "Cannot tell if memory wipe completed. " +
+ "One possible reason for this is a garbled display, " +
+ "so let's go on and rely on the next steps to check " +
+ "how well memory was wiped."
end