summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranonym <anonym@riseup.net>2016-11-08 20:12:59 +0100
committeranonym <anonym@riseup.net>2016-11-08 20:18:56 +0100
commita11c39b6d2efbb2d6df68c5f9f90a1a77f1405ba (patch)
tree678b67b6670ce7f40990fe9f73eeee77c044f141
parent914f02718890dc932ac9f89bc5f192521fc6ebaf (diff)
Share files with the guest without using filesystem shares.
So now we can use snapshots in the affected scenarios, which this commit also implements. Will-fix: #5571
-rw-r--r--features/mat.feature8
-rw-r--r--features/step_definitions/checks.rb17
-rw-r--r--features/step_definitions/totem.rb19
-rw-r--r--features/step_definitions/usb.rb16
-rw-r--r--features/totem.feature19
-rw-r--r--features/usb_upgrade.feature17
6 files changed, 34 insertions, 62 deletions
diff --git a/features/mat.feature b/features/mat.feature
index e492b0f..76cd147 100644
--- a/features/mat.feature
+++ b/features/mat.feature
@@ -3,11 +3,7 @@ Feature: Metadata Anonymization Toolkit
As a Tails user
I want to be able to remove leaky metadata from documents and media files
- # In this feature we cannot restore from snapshots since it's
- # incompatible with filesystem shares.
-
Scenario: MAT can clean a PDF file
- Given a computer
- And I setup a filesystem share containing a sample PDF
- And I start Tails from DVD with network unplugged and I login
+ Given I have started Tails from DVD without network and logged in
+ And I plug and mount a USB drive containing a sample PDF
Then MAT can clean some sample PDF file
diff --git a/features/step_definitions/checks.rb b/features/step_definitions/checks.rb
index 06824b3..f0bf7ab 100644
--- a/features/step_definitions/checks.rb
+++ b/features/step_definitions/checks.rb
@@ -128,26 +128,19 @@ Then /^the VirtualBox guest modules are available$/ do
"The vboxguest module is not available.")
end
-Given /^I setup a filesystem share containing a sample PDF$/ do
- shared_pdf_dir_on_host = "#{$config["TMPDIR"]}/shared_pdf_dir"
- @shared_pdf_dir_on_guest = "/tmp/shared_pdf_dir"
- FileUtils.mkdir_p(shared_pdf_dir_on_host)
- Dir.glob("#{MISC_FILES_DIR}/*.pdf") do |pdf_file|
- FileUtils.cp(pdf_file, shared_pdf_dir_on_host)
- end
- add_after_scenario_hook { FileUtils.rm_r(shared_pdf_dir_on_host) }
- $vm.add_share(shared_pdf_dir_on_host, @shared_pdf_dir_on_guest)
-end
-
Then /^the support documentation page opens in Tor Browser$/ do
@screen.wait("SupportDocumentation#{@language}.png", 120)
end
+Given /^I plug and mount a USB drive containing a sample PDF$/ do
+ @pdf_dir = share_host_files(Dir.glob("#{MISC_FILES_DIR}/*.pdf"))
+end
+
Then /^MAT can clean some sample PDF file$/ do
for pdf_on_host in Dir.glob("#{MISC_FILES_DIR}/*.pdf") do
pdf_name = File.basename(pdf_on_host)
pdf_on_guest = "/home/#{LIVE_USER}/#{pdf_name}"
- step "I copy \"#{@shared_pdf_dir_on_guest}/#{pdf_name}\" to \"#{pdf_on_guest}\" as user \"#{LIVE_USER}\""
+ step "I copy \"#{@pdf_dir}/#{pdf_name}\" to \"#{pdf_on_guest}\" as user \"#{LIVE_USER}\""
check_before = $vm.execute_successfully("mat --check '#{pdf_on_guest}'",
:user => LIVE_USER).stdout
assert(check_before.include?("#{pdf_on_guest} is not clean"),
diff --git a/features/step_definitions/totem.rb b/features/step_definitions/totem.rb
index 520e7d6..a5b88d1 100644
--- a/features/step_definitions/totem.rb
+++ b/features/step_definitions/totem.rb
@@ -1,23 +1,24 @@
Given /^I create sample videos$/ do
- @shared_video_dir_on_host = "#{$config["TMPDIR"]}/shared_video_dir"
- @shared_video_dir_on_guest = "/tmp/shared_video_dir"
- FileUtils.mkdir_p(@shared_video_dir_on_host)
- add_after_scenario_hook { FileUtils.rm_r(@shared_video_dir_on_host) }
+ @video_dir_on_host = "#{$config["TMPDIR"]}/video_dir"
+ FileUtils.mkdir_p(@video_dir_on_host)
+ add_after_scenario_hook { FileUtils.rm_r(@video_dir_on_host) }
fatal_system("avconv -loop 1 -t 30 -f image2 " +
"-i 'features/images/USBTailsLogo.png' " +
"-an -vcodec libx264 -y " +
'-filter:v "crop=in_w-mod(in_w\,2):in_h-mod(in_h\,2)" ' +
- "'#{@shared_video_dir_on_host}/video.mp4' >/dev/null 2>&1")
+ "'#{@video_dir_on_host}/video.mp4' >/dev/null 2>&1")
end
-Given /^I setup a filesystem share containing sample videos$/ do
- $vm.add_share(@shared_video_dir_on_host, @shared_video_dir_on_guest)
+Given /^I plug and mount a USB drive containing sample videos$/ do
+ @video_dir_on_guest = share_host_files(
+ Dir.glob("#{@video_dir_on_host}/*")
+ )
end
Given /^I copy the sample videos to "([^"]+)" as user "([^"]+)"$/ do |destination, user|
- for video_on_host in Dir.glob("#{@shared_video_dir_on_host}/*.mp4") do
+ for video_on_host in Dir.glob("#{@video_dir_on_host}/*.mp4") do
video_name = File.basename(video_on_host)
- src_on_guest = "#{@shared_video_dir_on_guest}/#{video_name}"
+ src_on_guest = "#{@video_dir_on_guest}/#{video_name}"
dst_on_guest = "#{destination}/#{video_name}"
step "I copy \"#{src_on_guest}\" to \"#{dst_on_guest}\" as user \"amnesia\""
end
diff --git a/features/step_definitions/usb.rb b/features/step_definitions/usb.rb
index ce46916..9a58653 100644
--- a/features/step_definitions/usb.rb
+++ b/features/step_definitions/usb.rb
@@ -153,13 +153,9 @@ When /^I am told that the destination device cannot be upgraded$/ do
@screen.find("USBCannotUpgrade.png")
end
-Given /^I setup a filesystem share containing the Tails ISO$/ do
- shared_iso_dir_on_host = "#{$config["TMPDIR"]}/shared_iso_dir"
- @shared_iso_dir_on_guest = "/tmp/shared_iso_dir"
- FileUtils.mkdir_p(shared_iso_dir_on_host)
- FileUtils.cp(TAILS_ISO, shared_iso_dir_on_host)
- add_after_scenario_hook { FileUtils.rm_r(shared_iso_dir_on_host) }
- $vm.add_share(shared_iso_dir_on_host, @shared_iso_dir_on_guest)
+Given /^I plug and mount a USB drive containing the Tails ISO$/ do
+ iso_dir = share_host_files(TAILS_ISO)
+ @iso_path = "#{@iso_dir}/#{File.basename(TAILS_ISO)}"
end
When /^I do a "Upgrade from ISO" on USB drive "([^"]+)"$/ do |name|
@@ -171,8 +167,7 @@ When /^I do a "Upgrade from ISO" on USB drive "([^"]+)"$/ do |name|
@screen.wait_and_click('GnomeFileDiagHome.png', 10)
@screen.type("l", Sikuli::KeyModifier.CTRL)
@screen.wait('GnomeFileDiagTypeFilename.png', 10)
- iso = "#{@shared_iso_dir_on_guest}/#{File.basename(TAILS_ISO)}"
- @screen.type(iso)
+ @screen.type(@iso_path)
@screen.wait_and_click('GnomeFileDiagOpenButton.png', 10)
usb_install_helper(name)
end
@@ -276,10 +271,9 @@ Then /^the running Tails is installed on USB drive "([^"]+)"$/ do |target_name|
end
Then /^the ISO's Tails is installed on USB drive "([^"]+)"$/ do |target_name|
- iso = "#{@shared_iso_dir_on_guest}/#{File.basename(TAILS_ISO)}"
iso_root = "/mnt/iso"
$vm.execute("mkdir -p #{iso_root}")
- $vm.execute("mount -o loop #{iso} #{iso_root}")
+ $vm.execute("mount -o loop #{@iso_path} #{iso_root}")
tails_is_installed_helper(target_name, iso_root, "isolinux")
$vm.execute("umount #{iso_root}")
end
diff --git a/features/totem.feature b/features/totem.feature
index 2b55d73..930d5f1 100644
--- a/features/totem.feature
+++ b/features/totem.feature
@@ -9,9 +9,8 @@ Feature: Using Totem
Given I create sample videos
Scenario: Watching a MP4 video stored on the non-persistent filesystem
- Given a computer
- And I setup a filesystem share containing sample videos
- And I start Tails from DVD with network unplugged and I login
+ Given I have started Tails from DVD without network and logged in
+ And I plug and mount a USB drive containing sample videos
And I copy the sample videos to "/home/amnesia" as user "amnesia"
And the file "/home/amnesia/video.mp4" exists
Given I start monitoring the AppArmor log of "/usr/bin/totem"
@@ -46,22 +45,14 @@ Feature: Using Totem
Then I can watch a WebM video over HTTPs
Scenario: Watching MP4 videos stored on the persistent volume should work as expected given our AppArmor confinement
- Given I have started Tails without network from a USB drive with a persistent partition and stopped at Tails Greeter's login screen
- # Due to bug #5571 we have to reboot to be able to use
- # filesystem shares.
- And I shutdown Tails and wait for the computer to power off
- And I setup a filesystem share containing sample videos
- And I start Tails from USB drive "__internal" with network unplugged and I login with persistence enabled
+ Given I have started Tails without network from a USB drive with a persistent partition enabled and logged in
+ And I plug and mount a USB drive containing sample videos
And I copy the sample videos to "/home/amnesia/Persistent" as user "amnesia"
- And I copy the sample videos to "/home/amnesia/.gnupg" as user "amnesia"
- And I shutdown Tails and wait for the computer to power off
- And I start Tails from USB drive "__internal" with network unplugged and I login with persistence enabled
- And the file "/home/amnesia/Persistent/video.mp4" exists
When I open "/home/amnesia/Persistent/video.mp4" with Totem
Then I see "SampleLocalMp4VideoFrame.png" after at most 40 seconds
Given I close Totem
- And the file "/home/amnesia/.gnupg/video.mp4" exists
And I start monitoring the AppArmor log of "/usr/bin/totem"
+ And I copy the sample videos to "/home/amnesia/.gnupg" as user "amnesia"
When I try to open "/home/amnesia/.gnupg/video.mp4" with Totem
Then I see "TotemUnableToOpen.png" after at most 10 seconds
And AppArmor has denied "/usr/bin/totem" from opening "/home/amnesia/.gnupg/video.mp4"
diff --git a/features/usb_upgrade.feature b/features/usb_upgrade.feature
index 0aa9a95..33cc0da 100644
--- a/features/usb_upgrade.feature
+++ b/features/usb_upgrade.feature
@@ -11,9 +11,8 @@ Feature: Upgrading an old Tails USB installation
# dependencies (which are documented below).
Scenario: Try to "Upgrade from ISO" Tails to a pristine USB drive
- Given a computer
- And I setup a filesystem share containing the Tails ISO
- And I start Tails from DVD with network unplugged and I login
+ Given I have started Tails from DVD without network and logged in
+ And I plug and mount a USB drive containing the Tails ISO
And I temporarily create a 4 GiB disk named "pristine"
And I plug USB drive "pristine"
And I start Tails Installer in "Upgrade from ISO" mode
@@ -29,9 +28,8 @@ Feature: Upgrading an old Tails USB installation
And I am told that the destination device cannot be upgraded
Scenario: Try to "Upgrade from ISO" Tails to a USB drive with GPT and a FAT partition
- Given a computer
- And I setup a filesystem share containing the Tails ISO
- And I start Tails from DVD with network unplugged and I login
+ Given I have started Tails from DVD without network and logged in
+ And I plug and mount a USB drive containing the Tails ISO
And I temporarily create a 4 GiB disk named "gptfat"
And I create a gpt partition with a vfat filesystem on disk "gptfat"
And I plug USB drive "gptfat"
@@ -132,8 +130,8 @@ Feature: Upgrading an old Tails USB installation
Scenario: Upgrading an old Tails USB installation from an ISO image, running on the old version
Given a computer
And I clone USB drive "old" to a new USB drive "to_upgrade"
- And I setup a filesystem share containing the Tails ISO
When I start Tails from USB drive "old" with network unplugged and I login
+ And I plug and mount a USB drive containing the Tails ISO
And I plug USB drive "to_upgrade"
And I do a "Upgrade from ISO" on USB drive "to_upgrade"
Then the ISO's Tails is installed on USB drive "to_upgrade"
@@ -141,10 +139,9 @@ Feature: Upgrading an old Tails USB installation
# Depends on scenario: Writing files to a read/write-enabled persistent partition with the old Tails USB installation
Scenario: Upgrading an old Tails USB installation from an ISO image, running on the new version
- Given a computer
+ Given I have started Tails from DVD without network and logged in
+ And I plug and mount a USB drive containing the Tails ISO
And I clone USB drive "old" to a new USB drive "to_upgrade"
- And I setup a filesystem share containing the Tails ISO
- And I start Tails from DVD with network unplugged and I login
And I plug USB drive "to_upgrade"
And I do a "Upgrade from ISO" on USB drive "to_upgrade"
Then the ISO's Tails is installed on USB drive "to_upgrade"