1 # Redefining CHECKPOINTS is probably not a good idea, so let's guard against it
2 unless defined? CHECKPOINTS
6 description: "I have started Tails from DVD without network and stopped at Tails Greeter's login screen",
7 parent_checkpoint: nil,
9 'I start the computer',
10 'the computer boots Tails',
14 'no-network-logged-in' => {
15 description: 'I have started Tails from DVD without network and logged in',
16 parent_checkpoint: 'tails-greeter',
18 'I log in to a new session',
19 'all notifications have disappeared',
23 'with-network-logged-in' => {
24 description: 'I have started Tails from DVD and logged in and the network is connected',
25 parent_checkpoint: 'no-network-logged-in',
27 'the network is plugged',
29 'all notifications have disappeared',
30 'available upgrades have been checked',
34 'no-network-logged-in-sudo-passwd' => {
36 description: 'I have started Tails from DVD without network and logged in with an administration password',
37 parent_checkpoint: 'tails-greeter',
39 'I set an administration password',
40 'I log in to a new session',
41 'all notifications have disappeared',
45 'with-network-logged-in-sudo-passwd' => {
47 description: 'I have started Tails from DVD and logged in with an administration password and the network is connected',
48 parent_checkpoint: 'no-network-logged-in-sudo-passwd',
50 'the network is plugged',
52 'all notifications have disappeared',
53 'available upgrades have been checked',
57 'usb-install-tails-greeter' => {
58 description: "I have started Tails without network from a USB drive without a persistent partition and stopped at Tails Greeter's login screen",
59 parent_checkpoint: nil,
61 'I create a 7200 MiB disk named "__internal"',
62 'I plug USB drive "__internal"',
63 'I write the Tails USB image to disk "__internal"',
64 'I start Tails from USB drive "__internal" with network unplugged',
65 'the boot device has safe access rights',
66 'the USB drive "__internal" has a valid partition table',
67 'Tails is running from USB drive "__internal"',
68 'there is no persistence partition on USB drive "__internal"',
69 'process "udev-watchdog" is running',
70 'udev-watchdog is monitoring the correct device',
74 'usb-install-logged-in' => {
75 description: 'I have started Tails without network from a USB drive without a persistent partition and logged in',
76 parent_checkpoint: 'usb-install-tails-greeter',
78 'I log in to a new session',
79 'all notifications have disappeared',
83 'usb-install-with-persistence-tails-greeter' => {
84 description: "I have started Tails without network from a USB drive with a persistent partition and stopped at Tails Greeter's login screen",
85 parent_checkpoint: 'usb-install-logged-in',
87 'I create a persistent partition',
88 'a Tails persistence partition exists on USB drive "__internal"',
89 'I cold reboot the computer',
90 'the computer reboots Tails',
91 'the boot device has safe access rights',
92 'Tails is running from USB drive "__internal"',
93 'process "udev-watchdog" is running',
94 'udev-watchdog is monitoring the correct device',
98 'usb-install-with-persistence-logged-in' => {
99 description: 'I have started Tails without network from a USB drive with a persistent partition enabled and logged in',
100 parent_checkpoint: 'usb-install-with-persistence-tails-greeter',
102 'I enable persistence',
103 'I log in to a new session',
104 'all tps features are active',
105 'all persistent filesystems have safe access rights',
106 'all persistence configuration files have safe access rights',
107 'all persistent directories have safe access rights',
108 'all notifications have disappeared',
112 'usb-install-with-persistence-luks-1-tails-greeter' => {
113 description: "I have started Tails without network from a USB drive with a LUKS 1 persistent partition and stopped at Tails Greeter's login screen",
114 parent_checkpoint: 'usb-install-with-persistence-tails-greeter',
116 'the persistence partition on USB drive "__internal" uses LUKS version 1',
117 'I reload tails-persistent-storage.service',
123 def reach_checkpoint(name, num_try = 0)
125 if VM.snapshot_exists?(name)
126 $vm.restore_snapshot(name)
128 checkpoint = CHECKPOINTS[name]
129 checkpoint_description = checkpoint[:description]
130 parent_checkpoint = checkpoint[:parent_checkpoint]
131 steps = checkpoint[:steps]
132 # rubocop:disable Metrics/BlockNesting
134 if VM.snapshot_exists?(parent_checkpoint)
135 $vm.restore_snapshot(parent_checkpoint)
137 reach_checkpoint(parent_checkpoint)
139 post_snapshot_restore_hook(parent_checkpoint, num_try)
141 # rubocop:enable Metrics/BlockNesting
142 log_scenario("Checkpoint: #{checkpoint_description}")
143 step_action = 'Given'
145 parent_description = CHECKPOINTS[parent_checkpoint][:description]
146 step_name = "#{step_action} #{parent_description}"
147 log_step_succeeded(step_name)
151 step_name = "#{step_action} #{s}"
154 rescue StandardError => e
155 log_step_failed(step_name)
158 log_step_succeeded(step_name)
161 $vm.save_snapshot(name)
163 # VM#save_snapshot restores the RAM-only snapshot immediately
164 # after saving it, in which case post_snapshot_restore_hook is
165 # useful to ensure we've reached a good starting point, so we run
166 # it in all cases, including even when've just saved a new snapshot.
167 post_snapshot_restore_hook(name, num_try)
169 # For each checkpoint we generate a step to reach it.
170 CHECKPOINTS.each do |name, desc|
171 step_regex = Regexp.new("^#{Regexp.escape(desc[:description])}$")
173 reach_checkpoint(name)
174 rescue StandardError => e
175 debug_log(" Generated snapshot step failed with exception:\n" \
176 " #{e.class}: #{e}\n", color: :red, timestamp: false)