summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranonym <anonym@riseup.net>2016-11-17 11:16:22 +0100
committeranonym <anonym@riseup.net>2016-11-17 11:37:35 +0100
commit349a5a89df4788017182057efa1fddb27bd9a7a4 (patch)
treef228e18ec38146492ee1947f34188b2cb1520a73
parent30d07ea9f8fcde460d0df847c8851bcba4e82519 (diff)
Replace --pause-on-fail with --interactive-debugging.
It does the same thing, but also offers an interactive Ruby shell via pry in the Cucumber world context.
-rw-r--r--features/config/defaults.yml2
-rw-r--r--features/support/helpers/misc_helpers.rb15
-rw-r--r--features/support/hooks.rb2
-rwxr-xr-xrun_test_suite16
-rw-r--r--wiki/src/contribute/release_process/test/setup.mdwn1
-rw-r--r--wiki/src/contribute/release_process/test/usage.mdwn9
6 files changed, 29 insertions, 16 deletions
diff --git a/features/config/defaults.yml b/features/config/defaults.yml
index 993dfe3..1e7f8ea 100644
--- a/features/config/defaults.yml
+++ b/features/config/defaults.yml
@@ -1,7 +1,7 @@
CAPTURE: false
CAPTURE_ALL: false
+INTERACTIVE_DEBUGGING: false
MAX_NEW_TOR_CIRCUIT_RETRIES: 10
-PAUSE_ON_FAIL: false
SIKULI_RETRY_FINDFAILED: false
TMPDIR: "/tmp/TailsToaster"
diff --git a/features/support/helpers/misc_helpers.rb b/features/support/helpers/misc_helpers.rb
index 8f4bcd8..67957c1 100644
--- a/features/support/helpers/misc_helpers.rb
+++ b/features/support/helpers/misc_helpers.rb
@@ -1,4 +1,6 @@
require 'date'
+require 'io/console'
+require 'pry'
require 'timeout'
require 'test/unit'
@@ -265,7 +267,14 @@ def info_log_artifact_location(type, path)
end
def pause(message = "Paused")
- STDERR.puts
- STDERR.puts "#{message} (Press ENTER to continue!)"
- STDIN.gets
+ loop do
+ STDERR.puts "Return: Continue; d: Debugging REPL"
+ c = STDIN.getch
+ case c
+ when "\r"
+ return
+ when "d"
+ binding.pry(quiet: true)
+ end
+ end
end
diff --git a/features/support/hooks.rb b/features/support/hooks.rb
index 3e2d7e1..6693120 100644
--- a/features/support/hooks.rb
+++ b/features/support/hooks.rb
@@ -253,7 +253,7 @@ After('@product') do |scenario|
info_log
info_log_artifact_location(type, artifact_path)
end
- pause("Scenario failed") if $config["PAUSE_ON_FAIL"]
+ pause("Scenario failed") if $config["INTERACTIVE_DEBUGGING"]
else
if @video_path && File.exist?(@video_path) && not($config['CAPTURE_ALL'])
FileUtils.rm(@video_path)
diff --git a/run_test_suite b/run_test_suite
index 33d9a20..8311e98 100755
--- a/run_test_suite
+++ b/run_test_suite
@@ -23,6 +23,7 @@ libvirt0
obfs4proxy
openssh-server
ovmf
+pry
python-jabberbot
python-potr
qemu-kvm
@@ -60,9 +61,10 @@ Options for '@product' features:
encoding. Requires x264.
--capture-all Keep videos for all scenarios, including those that
succeed (implies --capture).
- --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.
+ --interactive-debugging
+ On failure, pause test suite until pressing Enter. Also
+ offer the option to open an interactive Ruby shell (pry)
+ in the Cucumber world's context.
--keep-snapshots Don't ever delete any snapshots (including ones marked as
temporary). This can be a big time saver when debugging new
features.
@@ -182,13 +184,13 @@ CAPTURE_ALL=
LOG_FILE=
VNC_VIEWER=
VNC_SERVER=
-PAUSE_ON_FAIL=
+INTERACTIVE_DEBUGGING=
KEEP_SNAPSHOTS=
SIKULI_RETRY_FINDFAILED=
TAILS_ISO=
OLD_TAILS_ISO=
-LONGOPTS="artifacts-base-uri:,view,vnc-server-only,capture,capture-all,help,tmpdir:,keep-snapshots,retry-find,iso:,old-iso:,pause-on-fail"
+LONGOPTS="artifacts-base-uri:,view,vnc-server-only,capture,capture-all,help,tmpdir:,keep-snapshots,retry-find,iso:,old-iso:,interactive-debugging"
OPTS=$(getopt -o "" --longoptions $LONGOPTS -n "${NAME}" -- "$@")
eval set -- "$OPTS"
while [ $# -gt 0 ]; do
@@ -214,8 +216,8 @@ while [ $# -gt 0 ]; do
export CAPTURE="yes"
export CAPTURE_ALL="yes"
;;
- --pause-on-fail)
- export PAUSE_ON_FAIL="yes"
+ --interactive-debugging)
+ export INTERACTIVE_DEBUGGING="yes"
;;
--keep-snapshots)
export KEEP_SNAPSHOTS="yes"
diff --git a/wiki/src/contribute/release_process/test/setup.mdwn b/wiki/src/contribute/release_process/test/setup.mdwn
index de395c6..9810e08 100644
--- a/wiki/src/contribute/release_process/test/setup.mdwn
+++ b/wiki/src/contribute/release_process/test/setup.mdwn
@@ -38,6 +38,7 @@ The following packages are necessary on Debian Jessie:
obfs4proxy \
openssh-server \
ovmf \
+ pry \
python-jabberbot \
python-potr/jessie-backports \
qemu-kvm/jessie-backports \
diff --git a/wiki/src/contribute/release_process/test/usage.mdwn b/wiki/src/contribute/release_process/test/usage.mdwn
index 2e92385..d9a2756 100644
--- a/wiki/src/contribute/release_process/test/usage.mdwn
+++ b/wiki/src/contribute/release_process/test/usage.mdwn
@@ -106,10 +106,11 @@ by the local configuration file:
configuration variable limits how many times forcing a circuit will be
attempted. Defaults to `10`.
-* `PAUSE_ON_FAIL`: Boolean value. If set to `true`, the test suite run
- is suspended on failure until ENTER is pressed. This is useful for
- investigating the state of the VM guest to see exactly why a test
- failed. Defaults to `false`.
+* `INTERACTIVE_DEBUGGING`: Boolean value. If set to `true`, the test
+ suite run is suspended on failure until ENTER is pressed, and an
+ interactive Ruby shell (pry) is available. This is useful for
+ investigating the state of Cucumber's world and the VM guest to see
+ exactly why a test failed. Defaults to `false`.
* `SIKULI_RETRY_FINDFAILED`: Boolean value. If set to `true`, print a
warning whenever Sikuli fails to find an image and allow *one* retry