commit:     5da3d4422152bc5867264ee99c0952b03b6a966f
Author:     Naohiro Aota <naota <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 15 04:34:08 2020 +0000
Commit:     Naohiro Aota <naota <AT> gentoo <DOT> org>
CommitDate: Thu Jul 30 07:21:27 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5da3d442

ruby-ng-gnome2.eclass: implement common test code

Fold common test code from runy-gnome2 ebuild to this eclass.

To support test under virtx, introduce RUBY_GNOME2_NEED_VIRTX variable.

Signed-off-by: Naohiro Aota <naota <AT> gentoo.org>

 eclass/ruby-ng-gnome2.eclass | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/eclass/ruby-ng-gnome2.eclass b/eclass/ruby-ng-gnome2.eclass
index df14f40d83a..fd9f23492a9 100644
--- a/eclass/ruby-ng-gnome2.eclass
+++ b/eclass/ruby-ng-gnome2.eclass
@@ -24,7 +24,17 @@ RUBY_FAKEGEM_NAME="${RUBY_FAKEGEM_NAME:-${PN#ruby-}}"
 RUBY_FAKEGEM_TASK_TEST=""
 RUBY_FAKEGEM_TASK_DOC=""
 
+# @ECLASS-VARIABLE: RUBY_GNOME2_NEED_VIRTX
+# @PRE_INHERIT
+# @DESCRIPTION:
+# If set to 'yes', the test is run with virtx. Set before inheriting this
+# eclass.
+: ${RUBY_GNOME2_NEED_VIRTX:="no"}
+
 inherit ruby-fakegem
+if [[ ${RUBY_GNOME2_NEED_VIRTX} == yes ]]; then
+       inherit virtualx
+fi
 
 IUSE="test"
 RESTRICT+=" !test? ( test )"
@@ -89,3 +99,16 @@ all_ruby_install() {
 
        all_fakegem_install
 }
+
+# @FUNCTION: each_ruby_test
+# @DESCRIPTION:
+# Run the tests for this package.
+each_ruby_test() {
+       [[ -e test/run-test.rb ]] || return
+
+       if [[ ${RUBY_GNOME2_NEED_VIRTX} == yes ]]; then
+               virtx ${RUBY} test/run-test.rb
+       else
+               ${RUBY} test/run-test.rb || die
+       fi
+}

Reply via email to