summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTails developers <amnesia@boum.org>2014-10-03 16:45:40 +0000
committerTails developers <amnesia@boum.org>2014-10-03 16:47:26 +0000
commit9039294b5b5bf93c69ee88793476fb0c04926202 (patch)
tree80e479fda31b65f0abd6ff821bb049f9225f3ef9
parente6c0064c71c3f7432ea63a91208b7a65dbef3fc0 (diff)
Add initial tests for Totem, and its AppArmor profile.
We now need to encode video when running the test suite, so promoted the corresponding (existing and new) needed packages to hard dependencies. Also, have Git ignore the file generated at this stage.
-rw-r--r--.gitignore2
-rw-r--r--features/images/SampleLocalMp4VideoFrame.pngbin0 -> 3760 bytes
-rw-r--r--features/images/TotemUnableToOpen.pngbin0 -> 5527 bytes
-rw-r--r--features/step_definitions/totem.rb31
-rw-r--r--features/totem.feature28
-rwxr-xr-xrun_test_suite6
-rw-r--r--wiki/src/contribute/release_process/test/setup.mdwn4
7 files changed, 65 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
index 7797a05..6daf6cd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -45,3 +45,5 @@
/config/chroot_local-includes/usr/share/desktop-directories/Tails.directory
/tmp/
+# Files generated during the test suite
+/features/misc_files/video.mp4
diff --git a/features/images/SampleLocalMp4VideoFrame.png b/features/images/SampleLocalMp4VideoFrame.png
new file mode 100644
index 0000000..0ed3ee5
--- /dev/null
+++ b/features/images/SampleLocalMp4VideoFrame.png
Binary files differ
diff --git a/features/images/TotemUnableToOpen.png b/features/images/TotemUnableToOpen.png
new file mode 100644
index 0000000..6ac9f84
--- /dev/null
+++ b/features/images/TotemUnableToOpen.png
Binary files differ
diff --git a/features/step_definitions/totem.rb b/features/step_definitions/totem.rb
new file mode 100644
index 0000000..c89e1b4
--- /dev/null
+++ b/features/step_definitions/totem.rb
@@ -0,0 +1,31 @@
+def shared_video_dir_on_guest
+ "/tmp/shared_video_dir"
+end
+
+Given /^I create a sample MP4 video$/ do
+ next if @skip_steps_while_restoring_background
+ fatal_system("ffmpeg -loop 1 -t 30 -f image2 " +
+ "-i 'features/images/TailsBootSplash.png' " +
+ "-an -vcodec libx264 -y " +
+ "'#{$misc_files_dir}/video.mp4' >/dev/null 2>&1")
+end
+
+Given /^I setup a filesystem share containing sample videos$/ do
+ next if @skip_steps_while_restoring_background
+ @vm.add_share($misc_files_dir, shared_video_dir_on_guest)
+end
+
+Given /^I copy the sample videos to "([^"]+)" as user "([^"]+)"$/ do |destination, user|
+ next if @skip_steps_while_restoring_background
+ for video_on_host in Dir.glob("#{$misc_files_dir}/*.mp4") do
+ video_name = File.basename(video_on_host)
+ video_on_guest = "/home/#{$live_user}/#{video_name}"
+ step "I copy \"#{shared_video_dir_on_guest}/#{video_name}\" to \"#{video_on_guest}\" as user \"amnesia\""
+ end
+end
+
+When /^I(?:| try to) open "([^"]+)" with Totem$/ do |filename|
+ next if @skip_steps_while_restoring_background
+ puts @vm.execute("ls -l /home/amnesia").stdout
+ step "I run \"totem #{filename}\" in GNOME Terminal"
+end
diff --git a/features/totem.feature b/features/totem.feature
new file mode 100644
index 0000000..617d281
--- /dev/null
+++ b/features/totem.feature
@@ -0,0 +1,28 @@
+@product
+Feature: Using Totem
+ As a Tails user
+ I want to watch local and remote videos in Totem
+ And AppArmor should prevent Totem from doing dangerous things
+
+ # We cannot use Background to save a snapshot of an already booted
+ # Tails here, due to bugs with filesystem shares vs. snapshots, as
+ # explained in checks.feature.
+
+ Background:
+ Given I create a sample MP4 video
+
+ Scenario: I can watch an MP4 video stored in non-persistent /home/amnesia
+ Given a computer
+ And I setup a filesystem share containing sample videos
+ And I start Tails from DVD with network unplugged and I login
+ And I copy the sample videos to "/home/amnesia" as user "amnesia"
+ When I open "/home/amnesia/video.mp4" with Totem
+ Then I see "SampleLocalMp4VideoFrame.png" after at most 10 seconds
+
+ Scenario: I cannot watch an MP4 video stored in non-persistent /home/amnesia/.gnupg
+ Given a computer
+ And I setup a filesystem share containing sample videos
+ And I start Tails from DVD with network unplugged and I login
+ 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
diff --git a/run_test_suite b/run_test_suite
index e9a2854..4522008 100755
--- a/run_test_suite
+++ b/run_test_suite
@@ -92,8 +92,6 @@ start_vnc_viewer() {
}
capture_session() {
- check_dependency ffmpeg
- check_dependency libvpx1
echo "Capturing guest display into ${CAPTURE_FILE}"
ffmpeg -f x11grab -s 1024x768 -r 15 -i ${TARGET_DISPLAY}.0 -an \
-vcodec libvpx -y "${CAPTURE_FILE}" >/dev/null 2>&1 &
@@ -161,8 +159,8 @@ while [ $# -gt 0 ]; do
shift
done
-for dep in git libvirt-bin libvirt-dev virt-viewer libsikuli-script-java ovmf \
- tcpdump xvfb; do
+for dep in ffmpeg git libvirt-bin libvirt-dev libavcodec-extra-53 libvpx1 \
+ virt-viewer libsikuli-script-java ovmf tcpdump xvfb; do
check_dependency "${dep}"
done
diff --git a/wiki/src/contribute/release_process/test/setup.mdwn b/wiki/src/contribute/release_process/test/setup.mdwn
index 0052426..25f3894 100644
--- a/wiki/src/contribute/release_process/test/setup.mdwn
+++ b/wiki/src/contribute/release_process/test/setup.mdwn
@@ -21,8 +21,8 @@ wheezy-backports sources added:
apt-get install git xvfb virt-viewer libsikuli-script-java \
libxslt1-dev tcpdump unclutter radvd x11-apps syslinux \
libcap2-bin devscripts libvirt-ruby ruby-rspec gawk ntp ovmf/testing \
- ruby-json x11vnc xtightvncviewer ffmpeg libvpx1 dnsmasq-base \
- openjdk-7-jre && \
+ ruby-json x11vnc xtightvncviewer ffmpeg libavcodec-extra-53 \
+ libvpx1 dnsmasq-base openjdk-7-jre && \
apt-get -t wheezy-backports install qemu-kvm qemu-system-x86 libvirt0 \
libvirt-dev libvirt-bin seabios ruby-rjb ruby-packetfu cucumber && \
service libvirt-bin restart