summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTails developers <amnesia@boum.org>2015-02-22 14:58:31 +0100
committerTails developers <amnesia@boum.org>2015-02-22 14:58:31 +0100
commitb9bb245dcca3ec0c6f744fed34c04c8bd86e839d (patch)
treecf07cdef1754b43a8f4db5a828ee6bde928634e8
parent12762a4d95228f4f2f59943e0b2447c61b0d0be0 (diff)
parentff8e2e2f9a7de47f8e4b7a47f1e2f030eb3f12af (diff)
Merge branch 'test/7821-tor' into test/6305-tor-bridgestest/6305-tor-bridges
-rw-r--r--config/chroot_local-includes/usr/share/tails/torbrowser-AppArmor-profile.patch9
-rw-r--r--features/step_definitions/usb.rb2
-rw-r--r--features/support/helpers/exec_helper.rb8
-rw-r--r--features/support/helpers/misc_helpers.rb15
-rw-r--r--features/support/helpers/storage_helper.rb9
5 files changed, 35 insertions, 8 deletions
diff --git a/config/chroot_local-includes/usr/share/tails/torbrowser-AppArmor-profile.patch b/config/chroot_local-includes/usr/share/tails/torbrowser-AppArmor-profile.patch
index d6f8bf6..baef2ba 100644
--- a/config/chroot_local-includes/usr/share/tails/torbrowser-AppArmor-profile.patch
+++ b/config/chroot_local-includes/usr/share/tails/torbrowser-AppArmor-profile.patch
@@ -1,5 +1,5 @@
diff --git a/apparmor/torbrowser.Browser.firefox b/apparmor/torbrowser.Browser.firefox
-index 0df7ad9..ae26e61 100644
+index 0df7ad9..6d1346c 100644
--- a/apparmor/torbrowser.Browser.firefox
+++ b/apparmor/torbrowser.Browser.firefox
@@ -1,13 +1,15 @@
@@ -105,7 +105,7 @@ index 0df7ad9..ae26e61 100644
# Should use abstractions/gstreamer instead once merged upstream
/etc/udev/udev.conf r,
-@@ -72,6 +87,16 @@
+@@ -72,6 +87,21 @@
/sys/devices/pci[0-9]*/**/uevent r,
owner /{dev,run}/shm/shmfd-* rw,
@@ -119,6 +119,11 @@ index 0df7ad9..ae26e61 100644
+ /usr/local/lib/tor-browser/firefox Pix,
+ /usr/bin/seahorse-tool Ux,
+
++ # Spell checking (the "enchant" abstraction includes these rules
++ # too, but it allows way more stuff than what we need)
++ /usr/share/hunspell/ r,
++ /usr/share/hunspell/* r,
++
# KDE 4
owner @{HOME}/.kde/share/config/* r,
diff --git a/features/step_definitions/usb.rb b/features/step_definitions/usb.rb
index 2c657ca..0fbff8a 100644
--- a/features/step_definitions/usb.rb
+++ b/features/step_definitions/usb.rb
@@ -304,7 +304,7 @@ end
def tails_persistence_enabled?
persistence_state_file = "/var/lib/live/config/tails.persistence"
return @vm.execute("test -e '#{persistence_state_file}'").success? &&
- @vm.execute('. #{persistence_state_file} && ' +
+ @vm.execute(". '#{persistence_state_file}' && " +
'test "$TAILS_PERSISTENCE_ENABLED" = true').success?
end
diff --git a/features/support/helpers/exec_helper.rb b/features/support/helpers/exec_helper.rb
index 9a1769d..400b0ae 100644
--- a/features/support/helpers/exec_helper.rb
+++ b/features/support/helpers/exec_helper.rb
@@ -11,12 +11,10 @@ class VMCommand
end
def VMCommand.wait_until_remote_shell_is_up(vm, timeout = 30)
- begin
- Timeout::timeout(timeout) do
- VMCommand.execute(vm, "true", { :user => "root", :spawn => false })
+ try_for(30, :msg => "Remote shell seems to be down") do
+ Timeout::timeout(3) do
+ VMCommand.execute(vm, "echo 'hello?'")
end
- rescue Timeout::Error
- raise "Remote shell seems to be down"
end
end
diff --git a/features/support/helpers/misc_helpers.rb b/features/support/helpers/misc_helpers.rb
index f52e6ce..d315e52 100644
--- a/features/support/helpers/misc_helpers.rb
+++ b/features/support/helpers/misc_helpers.rb
@@ -96,3 +96,18 @@ def get_all_tor_nodes
cmd = 'awk "/^r/ { print \$6 }" /var/lib/tor/cached-microdesc-consensus'
@vm.execute(cmd).stdout.chomp.split("\n") + TOR_AUTHORITIES
end
+
+def get_free_space(machine, path)
+ case machine
+ when 'host'
+ assert(File.exists?(path), "Path '#{path}' not found on #{machine}.")
+ free = cmd_helper("df '#{path}'")
+ when 'guest'
+ assert(@vm.file_exist?(path), "Path '#{path}' not found on #{machine}.")
+ free = @vm.execute_successfully("df '#{path}'")
+ else
+ raise 'Unsupported machine type #{machine} passed.'
+ end
+ output = free.split("\n").last
+ return output.match(/[^\s]\s+[0-9]+\s+[0-9]+\s+([0-9]+)\s+.*/)[1].chomp.to_i
+end
diff --git a/features/support/helpers/storage_helper.rb b/features/support/helpers/storage_helper.rb
index 41240d2..35b6dff 100644
--- a/features/support/helpers/storage_helper.rb
+++ b/features/support/helpers/storage_helper.rb
@@ -68,6 +68,15 @@ class VMStorage
options[:size] ||= 2
options[:unit] ||= "GiB"
options[:type] ||= "qcow2"
+ # Require 'slightly' more space to be available to give a bit more leeway
+ # with rounding, temp file creation, etc.
+ reserved = 500
+ needed = convert_to_MiB(options[:size].to_i, options[:unit])
+ avail = convert_to_MiB(get_free_space('host', @pool_path), "KiB")
+ assert(avail - reserved >= needed,
+ "Error creating disk \"#{name}\" in \"#{@pool_path}\". " \
+ "Need #{needed} MiB but only #{avail} MiB is available of " \
+ "which #{reserved} MiB is reserved for other temporary files.")
begin
old_vol = @pool.lookup_volume_by_name(name)
rescue Libvirt::RetrieveError