summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2015-09-15 16:48:33 +0000
committerintrigeri <intrigeri@boum.org>2015-09-15 16:48:33 +0000
commit4ddbc9da61fd6a6109a311da753fe9f4c1f93aeb (patch)
tree1c6ee0f7996c57655d5ff7daf6ff8db61ec14714
parent9d016567a048f1daf93f95b080ffb18e54aa15b5 (diff)
parent43b65f0eccbfff08f53a6469c940bbeab3e36ee9 (diff)
Merge remote-tracking branch 'origin/test/9491-debug-cucumber-formatter' into stable
Fix-committed: #9491
-rw-r--r--features/support/helpers/sikuli_helper.rb8
-rw-r--r--features/support/hooks.rb36
2 files changed, 24 insertions, 20 deletions
diff --git a/features/support/helpers/sikuli_helper.rb b/features/support/helpers/sikuli_helper.rb
index 72e41eb..f83ec8d 100644
--- a/features/support/helpers/sikuli_helper.rb
+++ b/features/support/helpers/sikuli_helper.rb
@@ -43,9 +43,11 @@ end
# Bind Java's stdout to debug_log() via our magical pseudo fifo
# logger.
-file_output_stream = Java::Io::FileOutputStream.new(DEBUG_LOG_PSEUDO_FIFO)
-print_stream = Java::Io::PrintStream.new(file_output_stream)
-Java::Lang::System.setOut(print_stream)
+def bind_java_to_pseudo_fifo_logger
+ file_output_stream = Java::Io::FileOutputStream.new(DEBUG_LOG_PSEUDO_FIFO)
+ print_stream = Java::Io::PrintStream.new(file_output_stream)
+ Java::Lang::System.setOut(print_stream)
+end
def findfailed_hook(pic)
STDERR.puts ""
diff --git a/features/support/hooks.rb b/features/support/hooks.rb
index b98ef63..718c81a 100644
--- a/features/support/hooks.rb
+++ b/features/support/hooks.rb
@@ -5,6 +5,23 @@ require 'tmpdir'
# Run once, before any feature
AfterConfiguration do |config|
+ if File.exist?($config["TMPDIR"])
+ if !File.directory?($config["TMPDIR"])
+ raise "Temporary directory '#{$config["TMPDIR"]}' exists but is not a " +
+ "directory"
+ end
+ if !File.owned?($config["TMPDIR"])
+ raise "Temporary directory '#{$config["TMPDIR"]}' must be owned by the " +
+ "current user"
+ end
+ FileUtils.chmod(0755, $config["TMPDIR"])
+ else
+ begin
+ FileUtils.mkdir_p($config["TMPDIR"])
+ rescue Errno::EACCES => e
+ raise "Cannot create temporary directory: #{e.to_s}"
+ end
+ end
# Start a thread that monitors a pseudo fifo file and debug_log():s
# anything written to it "immediately" (well, as fast as inotify
# detects it). We're forced to a convoluted solution like this
@@ -25,6 +42,8 @@ AfterConfiguration do |config|
watcher.run
end
end
+ # Fix Sikuli's debug_log():ing.
+ bind_java_to_pseudo_fifo_logger
end
# For @product tests
@@ -50,23 +69,6 @@ def add_after_scenario_hook(&block)
end
BeforeFeature('@product') do |feature|
- if File.exist?($config["TMPDIR"])
- if !File.directory?($config["TMPDIR"])
- raise "Temporary directory '#{$config["TMPDIR"]}' exists but is not a " +
- "directory"
- end
- if !File.owned?($config["TMPDIR"])
- raise "Temporary directory '#{$config["TMPDIR"]}' must be owned by the " +
- "current user"
- end
- FileUtils.chmod(0755, $config["TMPDIR"])
- else
- begin
- Dir.mkdir($config["TMPDIR"])
- rescue Errno::EACCES => e
- raise "Cannot create temporary directory: #{e.to_s}"
- end
- end
delete_all_snapshots if !KEEP_SNAPSHOTS
if TAILS_ISO.nil?
raise "No Tails ISO image specified, and none could be found in the " +