From 9f14131b59993059012edfcd62613bca7a874d92 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Tue, 6 Oct 2020 15:09:21 +0200 Subject: [PATCH] Run the libyui tests --- package/yast2-ruby-bindings.spec | 6 +++--- tests/CMakeLists.txt | 16 +++++++++++++--- tests/libyui/README.md | 2 +- tests/libyui/table_sort_wrong_cell_1165388.rb | 9 ++++++++- ...165388 => table_sort_wrong_cell_1165388.test} | 5 +++-- 5 files changed, 28 insertions(+), 10 deletions(-) rename tests/libyui/{table_sort_wrong_cell_1165388 => table_sort_wrong_cell_1165388.test} (81%) diff --git a/package/yast2-ruby-bindings.spec b/package/yast2-ruby-bindings.spec index 236a8e03..1ef1a362 100644 --- a/package/yast2-ruby-bindings.spec +++ b/package/yast2-ruby-bindings.spec @@ -46,9 +46,9 @@ BuildRequires: yast2-ycp-ui-bindings-devel >= 4.3.1 # 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 to check if tmux is there, because tmux is -# needed to execute the test in headless systems -BuildRequires: which +# The mentioned test requires tmux in order to be executed in headless systems +# Also many other lubyui tests to come +BuildRequires: tmux # only a soft dependency, the Ruby debugger is optional Suggests: rubygem(%{rb_default_ruby_abi}:byebug) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a64eade2..5e78dfe4 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,6 +1,11 @@ -# -# CMakeLists.txt for yast2/ruby-bindings/tests/ruby -# +# CMakeLists.txt for yast-ruby-bindings/tests + +# use +# make test +# or, for verbose output, +# make test ARGS=-V +# ARGS is passed to ctest; see also +# man ctest ENABLE_TESTING() @@ -12,3 +17,8 @@ endforeach(test) ADD_TEST("integration" ruby ${CMAKE_CURRENT_SOURCE_DIR}/integration/run.rb) ADD_TEST("translations" rspec --format doc ${CMAKE_CURRENT_SOURCE_DIR}/integration/translations_spec.rb) + +file(GLOB libyui_tests "libyui/*.test") +foreach(test ${libyui_tests}) + ADD_TEST(${test} ${test}) +endforeach() diff --git a/tests/libyui/README.md b/tests/libyui/README.md index d43b50b2..aac945bc 100644 --- a/tests/libyui/README.md +++ b/tests/libyui/README.md @@ -1,3 +1,3 @@ -- `foo` - main script of the test case +- `foo.test` - main script of the test case - `foo.rb` - UI set up diff --git a/tests/libyui/table_sort_wrong_cell_1165388.rb b/tests/libyui/table_sort_wrong_cell_1165388.rb index 013d5802..6e67d190 100755 --- a/tests/libyui/table_sort_wrong_cell_1165388.rb +++ b/tests/libyui/table_sort_wrong_cell_1165388.rb @@ -1,4 +1,11 @@ -#!/usr/sbin/yast +#! /usr/bin/env ruby +require_relative "../test_helper" +require "yast" + +if Yast.ui_component == "" + Yast.ui_component = ARGV[0] || "ncurses" +end + module Yast class TableCellClient < Client def main diff --git a/tests/libyui/table_sort_wrong_cell_1165388 b/tests/libyui/table_sort_wrong_cell_1165388.test similarity index 81% rename from tests/libyui/table_sort_wrong_cell_1165388 rename to tests/libyui/table_sort_wrong_cell_1165388.test index f5006d68..e805465b 100755 --- a/tests/libyui/table_sort_wrong_cell_1165388 +++ b/tests/libyui/table_sort_wrong_cell_1165388.test @@ -1,9 +1,10 @@ #!/bin/sh set -u # unset variables are an error -. ../examples/screenshots-tui/scripts/tmux-uitest.sh +MYDIR=$(dirname $0) +. "$MYDIR"/tmux-uitest.sh BASE=table_sort_wrong_cell_1165388 -tmux_new_session /usr/sbin/yast ./"$BASE".rb || exit +tmux_new_session "$MYDIR"/"$BASE".rb || exit tmux_await "Table sorting test" || exit sleep 0.1 # draw the rest of the screen