From 0350be340ac4220d1df89472af3dd4efd3bfb062 Mon Sep 17 00:00:00 2001 From: Ben Woodcroft Date: Mon, 5 Feb 2018 11:42:19 +0100 Subject: gnu: Enable tests for ruby-childprocess. --- gnu/packages/ruby.scm | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm index 370a9a7954..1e497a8777 100644 --- a/gnu/packages/ruby.scm +++ b/gnu/packages/ruby.scm @@ -7015,7 +7015,40 @@ in standard Ruby syntax.") "1p3f43scdzx9zxmy2kw5zsc3az6v46nq4brwcxmnscjy4w4racbv")))) (build-system ruby-build-system) (arguments - `(#:tests? #f)) + `(#:tests? #f + #:test-target "spec" + #:phases + (modify-phases %standard-phases + (add-before 'check 'remove-dependency-and-patch-path + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "spec/spec_helper.rb" + ;; cannot require coveralls otherwise there is a dependency cycle + ;; childprocess, coveralls, rest-client, webmock, addressable, + ;; rspec-its, aruba, childprocess. + ((".*coveralls.*") "") + ((".*Coveralls.*") "") + ;; patch path to /bin/sh + (("/bin/sh") (which "sh")) + ;; testing + (("; sleep") "; puts \"before_sleep\"; sleep; puts \"after_sleep\"") + ) + (substitute* "lib/childprocess/unix/process.rb" + (("send_signal 'TERM'") "puts 'terming'; send_signal 'TERM'") + (("send_signal 'KILL'") "puts 'killing'; send_signal 'KILL'") + (("return true if @exit_code") + "puts \"exit_code: #{@exit_code}\"; p self; return true if @exit_code")) + ;; sleep POLL_INTERVAL + (substitute* "lib/childprocess/abstract_process.rb" + (("sleep POLL_INTERVAL") + "puts 'sleeping'; sleep POLL_INTERVAL; puts 'awake'") + (("unless ok") "puts \"ok was #{ok} and exited? was #{exited?}\"; unless ok")) + #t)) + ;(replace 'check + ; ;; for testing for ben only + ; (lambda _ + ; (zero? (system* "rspec" "spec/childprocess_spec.rb" "-e" "kills + ; the full process tree")))) + ))) (native-inputs `(("bundler" ,bundler) ("ruby-rspec" ,ruby-rspec))) -- cgit v1.2.3