Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into read_scr_root
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Mar 22, 2017
2 parents b34d0af + 878170b commit 7de1682
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 12 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
@@ -1,2 +1,5 @@
FROM yastdevel/cpp
# Install tmux to make sure the libyui+YaST integration tests are run
RUN zypper --non-interactive in tmux

COPY . /usr/src/app
17 changes: 17 additions & 0 deletions package/yast2-ruby-bindings.changes
@@ -1,3 +1,20 @@
-------------------------------------------------------------------
Tue Mar 14 16:25:59 UTC 2017 - ancor@suse.com

- Use tmux instead of screen to run the Ncurses integration test
in headless systems (skip the test if tmux is not available).
The version of screen introduced to fix bsc#1021743 was causing
the test to fail.
- 3.2.7

-------------------------------------------------------------------
Thu Mar 9 15:57:00 UTC 2017 - ancor@suse.com

- Display standard output and error channels in case of failure
running the Ncurses integration tests in a headless system.
Needed to debug the error produced by the fix to bsc#1021743
- 3.2.6

-------------------------------------------------------------------
Mon Jan 9 14:18:30 UTC 2017 - jreidinger@suse.com

Expand Down
7 changes: 4 additions & 3 deletions package/yast2-ruby-bindings.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-ruby-bindings
Version: 3.2.5
Version: 3.2.7
Url: https://github.com/yast/yast-ruby-bindings
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down Expand Up @@ -46,8 +46,9 @@ BuildRequires: yast2-ycp-ui-bindings-devel >= 2.21.9
# The test suite includes a regression test (std_streams_spec.rb) for a
# libyui-ncurses bug fixed in 2.47.3
BuildRequires: libyui-ncurses >= 2.47.3
# The mentioned test requires screen in order to be executed in headless systems
BuildRequires: screen
# The mentioned test requires to check if tmux is there, because tmux is
# needed to execute the test in headless systems
BuildRequires: which

# only a soft dependency, the Ruby debugger is optional
Suggests: rubygem(%{rb_default_ruby_abi}:byebug)
Expand Down
37 changes: 31 additions & 6 deletions tests/integration/run.rb
Expand Up @@ -7,14 +7,39 @@
# rspec std_streams_spec.rb
# but headless systems like jenkins need this script to fake the screen

def tmux_available?
system "which tmux >/dev/null 2>&1"
end

# If tmux is not available, just skip this without failing
if !tmux_available?
puts "Test skipped."
exit true
end

RESULT = "/tmp/exit".freeze
OUTPUT = "/tmp/test_cmd_output".freeze

def cleanup
[RESULT, OUTPUT].each do |file|
File.delete(file) if File.exist?(file)
end
end

test = File.dirname(__FILE__) + "/std_streams_spec.rb"
cmd = "rspec #{test}"
cmd = "rspec #{test} >#{OUTPUT} 2>&1"

`screen -D -m sh -c '#{cmd}; echo \$? > /tmp/exit'`
if File.read("/tmp/exit") != "0\n"
puts "Test failed: '#{cmd}'. Rerun manually to see the cause."
exit false
else
`tmux -c '#{cmd}; echo \$? > #{RESULT}'`
if File.exist?(RESULT) && File.read(RESULT) == "0\n"
puts "Test succeeded."
cleanup
exit true
else
puts "Test failed: '#{cmd}'."
if File.exist?(OUTPUT)
puts "Output was:"
puts File.read(OUTPUT)
end
cleanup
exit false
end
3 changes: 0 additions & 3 deletions tests/integration/std_streams_spec.rb
@@ -1,8 +1,5 @@
#! /usr/bin/env rspec

# We do not have a proper ncurses in travis at the moment
exit 0 if ENV["TRAVIS"]

require_relative "../test_helper"
require "yast/ui_shortcuts"

Expand Down

0 comments on commit 7de1682

Please sign in to comment.