aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Woodcroft <donttrustben@gmail.com>2018-02-05 11:42:19 +0100
committerChristopher Baines <mail@cbaines.net>2018-08-05 17:15:44 +0100
commit0350be340ac4220d1df89472af3dd4efd3bfb062 (patch)
tree81417ea64128b98618277957b890399ab954ade1
parent0b74aaa6e0eb923a085f703fe98ff54342e2412b (diff)
downloadguix-0350be340ac4220d1df89472af3dd4efd3bfb062.tar
guix-0350be340ac4220d1df89472af3dd4efd3bfb062.tar.gz
gnu: Enable tests for ruby-childprocess.
-rw-r--r--gnu/packages/ruby.scm35
1 files changed, 34 insertions, 1 deletions
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)))