Commit 914f0271 authored by anonym's avatar anonym
Browse files

Add a helper to easily share files from the host to the guest.

It's an alternative to filesystem shares, which cannot be used together
with snapshots.

Will-fix: #5571
parent c8861575
......@@ -136,7 +136,7 @@ Given /^the computer is set to boot from (.+?) drive "(.+?)"$/ do |type, name|
$vm.set_disk_boot(name, type.downcase)
Given /^I (temporarily )?create a (\d+) ([[:alpha:]]+) disk named "([^"]+)"$/ do |temporary, size, unit, name|
Given /^I (temporarily )?create an? (\d+) ([[:alpha:]]+) disk named "([^"]+)"$/ do |temporary, size, unit, name|
$, {:size => size, :unit => unit,
:type => "qcow2"})
add_after_scenario_hook { $ } if temporary
......@@ -985,3 +985,24 @@ Then /^Tails is running version (.+)$/ do |version|
assert_equal(version, v2, "The version doesn't match /etc/os-release")
def share_host_files(files)
files = [files] if files.class == String
assert_equal(Array, files.class)
disk = random_alpha_string(10)
step "I temporarily create an 2 GiB disk named \"#{disk}\""
step "I create a gpt partition labeled \"#{disk}\" with an ext4 " +
"filesystem on disk \"#{disk}\""
$ do |g, _|
partition = g.list_partitions().first
g.mount(partition, "/")
files.each { |f| g.upload(f, "/" + File.basename(f)) }
step "I plug USB drive \"#{disk}\""
mount_dir = $vm.execute_successfully('mktemp -d').stdout.chomp
dev = $vm.disk_dev(disk)
partition = dev + '1'
$vm.execute_successfully("mount #{partition} #{mount_dir}")
$vm.execute_successfully("chmod -R a+rX '#{mount_dir}'")
return mount_dir
Markdown is supported
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