commit: 00deeedd67abde6417a9fc8b4baf1daba84093d3
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 27 09:31:54 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Mar 27 10:59:10 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=00deeedd
dev-ruby/liquid-c: enable ruby32, wire up tests
Signed-off-by: Sam James <sam <AT> gentoo.org>
dev-ruby/liquid-c/liquid-c-4.1.0.ebuild | 37 +++++++++++++++++++++++++++++----
1 file changed, 33 insertions(+), 4 deletions(-)
diff --git a/dev-ruby/liquid-c/liquid-c-4.1.0.ebuild
b/dev-ruby/liquid-c/liquid-c-4.1.0.ebuild
index 9aa91c95add5..ba74574a276c 100644
--- a/dev-ruby/liquid-c/liquid-c-4.1.0.ebuild
+++ b/dev-ruby/liquid-c/liquid-c-4.1.0.ebuild
@@ -1,10 +1,10 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
-USE_RUBY="ruby26 ruby27 ruby30 ruby31"
+USE_RUBY="ruby27 ruby30 ruby31 ruby32"
-RUBY_FAKEGEM_TASK_TEST=""
+RUBY_FAKEGEM_TASK_TEST="test:unit"
RUBY_FAKEGEM_EXTRADOC="README.md"
MY_PN=${PN/-/_}
@@ -24,5 +24,34 @@ ruby_add_rdepend ">=dev-ruby/liquid-5.0.1:*"
all_ruby_prepare() {
sed -i -e "s/-Werror//" ext/${MY_PN}/extconf.rb || die
- sed -i -e "/[Bb]undler/d" Rakefile || die
+
+ sed -i \
+ -e "/[Bb]undler/d" \
+ -e "/memcheck/Id" \
+ Rakefile || die
+
+ # ruby_memcheck is a gem just for running w/ valgrind.
+ # We don't run tests in ebuilds with Valgrind because it's
+ # non-portable and sometimes flaky under sandbox.
+ rm rakelib/integration_test.rake || die
+ sed -i -e '/memcheck/Id' rakelib/unit_test.rake || die
+}
+
+each_ruby_test() {
+ # Backup the original extension and hide it away
+ # The tests won't build if they detect an already-built ext
+ mkdir -p "${T}"/${RUBY}.orig || die
+ mv ext "${T}"/${RUBY}.orig/ext || die
+ cp -r "${WORKDIR}"/all/${P}/ext ext || die
+
+ nonfatal each_fakegem_test --trace || failed_tests=1
+
+ # Always restore the original extension we built, even if
+ # tests failed, as FEATURES=test-fail-continue may be enabled.
+ rm -rf ext || die
+ mv "${T}"/${RUBY}.orig/ext ext || die
+
+ if [[ ${failed_tests} == 1 ]] ; then
+ die "Tests failed with ${RUBY}!"
+ fi
}