Commit 5135d118 authored by kytv's avatar kytv
Browse files

Anti-test: Test that changes to the hardware clock persist across reboots

parent 1e6e7748
......@@ -71,3 +71,29 @@ Then /^the hardware clock was not updated when Tails shut down$/ do
diff = (hwclock_time - host_time).abs
assert(diff <= max_time_drift)
end
When /^I bump the hardware clock's time with "([^"]+)"$/ do |timediff|
next if @skip_steps_while_restoring_background
old_time = DateTime.parse(@vm.execute_successfully("hwclock -r").stdout).to_time
@vm.execute_successfully("hwclock --set --date 'now #{timediff}'")
new_time = DateTime.parse(@vm.execute_successfully("hwclock -r").stdout).to_time
expected_time_lower_bound = DateTime.parse(
cmd_helper(["date", "-d", "#{old_time} #{timediff}"])).to_time
expected_time_upper_bound = expected_time_lower_bound + max_time_drift
assert(expected_time_lower_bound <= new_time &&
new_time <= expected_time_upper_bound,
"The host's hwclock was supposed to be bumped to " \
"'#{expected_time_lower_bound}' but is '#{new_time}'")
end
Then /^the hardware clock is still off by "([^"]+)"$/ do |timediff|
next if @skip_steps_while_restoring_background
hwclock = DateTime.parse(@vm.execute_successfully("hwclock -r").stdout.chomp).to_time
expected_time_lower_bound = DateTime.parse(
cmd_helper(["date", "-d", "now #{timediff}"])).to_time - max_time_drift
expected_time_upper_bound = expected_time_lower_bound + max_time_drift
assert(expected_time_lower_bound <= hwclock &&
hwclock <= expected_time_upper_bound,
"The host's hwclock should be approximately " \
"'#{expected_time_lower_bound}' but is actually '#{hwclock}'")
end
......@@ -38,6 +38,12 @@ Feature: Time syncing
And the computer reboots Tails
Then the hardware clock was not updated when Tails shut down
Scenario: Anti-test: Changes to the hardware clock are kept when rebooting
When I bump the hardware clock's time with "-15 days"
And I warm reboot the computer
And the computer reboots Tails
Then the hardware clock is still off by "-15 days"
# Scenario: Clock vs Tor consensus' valid-{after,until} etc.
Scenario: Create a new snapshot to the same state (w.r.t. Sikuli steps) as the Background except we're now in bridge mode
......
Supports Markdown
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