summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--features/support/config.rb1
-rw-r--r--features/support/helpers/storage_helper.rb18
-rw-r--r--features/support/hooks.rb8
-rwxr-xr-xrun_test_suite8
4 files changed, 24 insertions, 11 deletions
diff --git a/features/support/config.rb b/features/support/config.rb
index 4acab72..7c69c73 100644
--- a/features/support/config.rb
+++ b/features/support/config.rb
@@ -38,6 +38,7 @@ ENV['TMPDIR'] = $config['TMPDIR']
# configuration files.
DISPLAY = ENV['DISPLAY']
GIT_DIR = ENV['PWD']
+KEEP_SNAPSHOTS = !ENV['KEEP_SNAPSHOTS'].nil?
LIVE_USER = cmd_helper(". config/chroot_local-includes/etc/live/config.d/username.conf; echo ${LIVE_USERNAME}").chomp
OLD_TAILS_ISO = ENV['OLD_TAILS_ISO']
TAILS_ISO = ENV['TAILS_ISO']
diff --git a/features/support/helpers/storage_helper.rb b/features/support/helpers/storage_helper.rb
index 9a32db5..65e007b 100644
--- a/features/support/helpers/storage_helper.rb
+++ b/features/support/helpers/storage_helper.rb
@@ -18,18 +18,22 @@ class VMStorage
@xml_path = xml_path
pool_xml = REXML::Document.new(File.read("#{@xml_path}/storage_pool.xml"))
pool_name = pool_xml.elements['pool/name'].text
+ @pool_path = "#{$config["TMPDIR"]}/#{pool_name}"
begin
@pool = @virt.lookup_storage_pool_by_name(pool_name)
rescue Libvirt::RetrieveError
- # There's no pool with that name, so we don't have to clear it
- else
+ @pool = nil
+ end
+ if @pool and not(KEEP_SNAPSHOTS)
VMStorage.clear_storage_pool(@pool)
+ @pool = nil
end
- @pool_path = "#{$config["TMPDIR"]}/#{pool_name}"
- pool_xml.elements['pool/target/path'].text = @pool_path
- @pool = @virt.define_storage_pool_xml(pool_xml.to_s)
- @pool.build unless Dir.exists?(@pool_path)
- @pool.create
+ unless @pool
+ pool_xml.elements['pool/target/path'].text = @pool_path
+ @pool = @virt.define_storage_pool_xml(pool_xml.to_s)
+ @pool.build unless Dir.exists?(@pool_path)
+ end
+ @pool.create unless @pool.active?
@pool.refresh
end
diff --git a/features/support/hooks.rb b/features/support/hooks.rb
index 4b26b71..f1b69f2 100644
--- a/features/support/hooks.rb
+++ b/features/support/hooks.rb
@@ -61,7 +61,7 @@ BeforeFeature('@product') do |feature|
$background_snapshot = "#{base}_background"
if not($started_first_product_feature)
$virt = Libvirt::open("qemu:///system")
- VM.remove_all_snapshots
+ VM.remove_all_snapshots if !KEEP_SNAPSHOTS
$vmnet = VMNet.new($virt, VM_XML_PATH)
$vmstorage = VMStorage.new($virt, VM_XML_PATH)
$started_first_product_feature = true
@@ -169,8 +169,10 @@ end
at_exit do
if $virt
- VM.remove_all_snapshots
- $vmstorage.clear_pool
+ unless KEEP_SNAPSHOTS
+ VM.remove_all_snapshots
+ $vmstorage.clear_pool
+ end
$vmnet.destroy_and_undefine
$virt.close
end
diff --git a/run_test_suite b/run_test_suite
index fc808f3..76b2f80 100755
--- a/run_test_suite
+++ b/run_test_suite
@@ -58,6 +58,8 @@ Options for '@product' features:
--pause-on-fail On failure, pause test suite until pressing Enter. This is
useful for investigating the state of the VM guest to see
exactly why a test failed.
+ --keep-snapshots Don't ever delete the background snapshots. This can a big
+ time saver when debugging new features.
--retry-find Print a warning whenever Sikuli fails to find an image
and allow *one* retry after pressing ENTER. This is useful
for updating outdated images.
@@ -193,11 +195,12 @@ VNC_VIEWER=
VNC_SERVER=
DEBUG=
PAUSE_ON_FAIL=
+KEEP_SNAPSHOTS=
SIKULI_RETRY_FINDFAILED=
TAILS_ISO=
OLD_TAILS_ISO=
-LONGOPTS="view,vnc-server-only,capture:,help,tmpdir:,retry-find,iso:,old-iso:,debug,pause-on-fail,log-to-file:"
+LONGOPTS="view,vnc-server-only,capture:,help,tmpdir:,keep-snapshots,retry-find,iso:,old-iso:,debug,pause-on-fail,log-to-file:"
OPTS=$(getopt -o "" --longoptions $LONGOPTS -n "${NAME}" -- "$@")
eval set -- "$OPTS"
while [ $# -gt 0 ]; do
@@ -224,6 +227,9 @@ while [ $# -gt 0 ]; do
--pause-on-fail)
export PAUSE_ON_FAIL="yes"
;;
+ --keep-snapshots)
+ export KEEP_SNAPSHOTS="yes"
+ ;;
--retry-find)
export SIKULI_RETRY_FINDFAILED="yes"
;;