public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH v2 1/3] ruby-ng.eclass: allow non-fatal use of test functions
@ 2023-03-18 23:12 Sam James
  2023-03-18 23:12 ` [gentoo-dev] [PATCH v2 2/3] ruby-ng.eclass: use eqawarn for test dependency warning Sam James
  2023-03-18 23:12 ` [gentoo-dev] [PATCH v2 3/3] ruby-fakegem.eclass: allow non-fatal use of test functions Sam James
  0 siblings, 2 replies; 3+ messages in thread
From: Sam James @ 2023-03-18 23:12 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby, Sam James

die -n will make die become non-fatal if run under 'nonfatal',
this is useful if e.g. need to do cleanup.

For example, in an ebuild, I need to setup a database, run tests,
then always cleanup, which looks like:
```
db_setup
nonfatal each_fakegem_test || tests_failed=1
db_cleanup

if [[ ${tests_failed} == 1 ]] ; then
	die "Tests failed! Please see ..."
fi
```

Just like we do with e.g. virtualx. This also brings us into line
with the Python eclasses.

Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/ruby-ng.eclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index 67c22d518a313..aa8a15170cf80 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -721,7 +721,7 @@ ruby-ng_rspec() {
 			;;
 	esac
 
-	${RUBY} -S rspec-${version} ${rspec_params} ${files} || die "rspec failed"
+	${RUBY} -S rspec-${version} ${rspec_params} ${files} || die -n "rspec failed"
 }
 
 # @FUNCTION: ruby-ng_cucumber
@@ -754,7 +754,7 @@ ruby-ng_cucumber() {
 			;;
 	esac
 
-	CUCUMBER_PUBLISH_QUIET=true ${RUBY} -S cucumber ${cucumber_params} "$@" || die "cucumber failed"
+	CUCUMBER_PUBLISH_QUIET=true ${RUBY} -S cucumber ${cucumber_params} "$@" || die -n "cucumber failed"
 }
 
 # @FUNCTION: ruby-ng_testrb-2
-- 
2.40.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-dev] [PATCH v2 2/3] ruby-ng.eclass: use eqawarn for test dependency warning
  2023-03-18 23:12 [gentoo-dev] [PATCH v2 1/3] ruby-ng.eclass: allow non-fatal use of test functions Sam James
@ 2023-03-18 23:12 ` Sam James
  2023-03-18 23:12 ` [gentoo-dev] [PATCH v2 3/3] ruby-fakegem.eclass: allow non-fatal use of test functions Sam James
  1 sibling, 0 replies; 3+ messages in thread
From: Sam James @ 2023-03-18 23:12 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby, Sam James

We already inherit the eqawarn eclass and use it elsewhere
in this eclass, so it's available & this then fits the rest
of our use.

Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/ruby-ng.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index aa8a15170cf80..f85a933f81d97 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -699,7 +699,7 @@ ruby-ng_rspec() {
 	fi
 
 	if [[ "${DEPEND}${BDEPEND}" != *"dev-ruby/rspec"* ]]; then
-		ewarn "Missing test dependency dev-ruby/rspec"
+		eqawarn "Missing test dependency dev-ruby/rspec"
 	fi
 
 	local rspec_params=
-- 
2.40.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-dev] [PATCH v2 3/3] ruby-fakegem.eclass: allow non-fatal use of test functions
  2023-03-18 23:12 [gentoo-dev] [PATCH v2 1/3] ruby-ng.eclass: allow non-fatal use of test functions Sam James
  2023-03-18 23:12 ` [gentoo-dev] [PATCH v2 2/3] ruby-ng.eclass: use eqawarn for test dependency warning Sam James
@ 2023-03-18 23:12 ` Sam James
  1 sibling, 0 replies; 3+ messages in thread
From: Sam James @ 2023-03-18 23:12 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby, Sam James

die -n will make die become non-fatal if run under 'nonfatal',
this is useful if e.g. need to do cleanup.

For example, in an ebuild, I need to setup a database, run tests,
then always cleanup, which looks like:
```
db_setup
nonfatal each_fakegem_test || tests_failed=1
db_cleanup

if [[ ${tests_failed} == 1 ]] ; then
    die "Tests failed! Please see ..."
fi
```

Just like we do with e.g. virtualx. This also brings us into line
with the Python eclasses.

Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/ruby-fakegem.eclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/eclass/ruby-fakegem.eclass b/eclass/ruby-fakegem.eclass
index 8cf5dd70f8646..9ef5e1f098d11 100644
--- a/eclass/ruby-fakegem.eclass
+++ b/eclass/ruby-fakegem.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: ruby-fakegem.eclass
@@ -552,7 +552,7 @@ each_fakegem_test() {
 
 	case ${RUBY_FAKEGEM_RECIPE_TEST} in
 		rake)
-			MT_NO_PLUGINS=true ${RUBY} --disable=did_you_mean -S rake ${RUBY_FAKEGEM_TASK_TEST} || die "tests failed"
+			MT_NO_PLUGINS=true ${RUBY} --disable=did_you_mean -S rake ${RUBY_FAKEGEM_TASK_TEST} || die -n "tests failed"
 			;;
 		rspec)
 			RSPEC_VERSION=2 ruby-ng_rspec
-- 
2.40.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-18 23:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-18 23:12 [gentoo-dev] [PATCH v2 1/3] ruby-ng.eclass: allow non-fatal use of test functions Sam James
2023-03-18 23:12 ` [gentoo-dev] [PATCH v2 2/3] ruby-ng.eclass: use eqawarn for test dependency warning Sam James
2023-03-18 23:12 ` [gentoo-dev] [PATCH v2 3/3] ruby-fakegem.eclass: allow non-fatal use of test functions Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox