aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorYasuo Honda <yasuo.honda@gmail.com>2018-07-30 09:11:02 +0000
committerYasuo Honda <yasuo.honda@gmail.com>2018-07-30 15:10:30 +0000
commitd35b06e2f09683c6cf0a15b2fa9c399da7e5819d (patch)
treed9e43fd7fe2b4afa37e5843b00f2f37b0fa031cf /activesupport
parentcfee9feee423947cf9e6d2508a85507cca6f75f3 (diff)
downloadrails-d35b06e2f09683c6cf0a15b2fa9c399da7e5819d.tar.gz
rails-d35b06e2f09683c6cf0a15b2fa9c399da7e5819d.tar.bz2
rails-d35b06e2f09683c6cf0a15b2fa9c399da7e5819d.zip
cpu_time and allocations are 0 when JRuby is used
According to #33449 and #33468, cpu_time and allocations are 0 when JRuby is used. ```ruby $ ruby -v jruby 9.2.1.0-SNAPSHOT (2.5.0) 2018-07-27 13b2df5 Java HotSpot(TM) 64-Bit Server VM 25.181-b13 on 1.8.0_181-b13 [linux-x86_64] $ bundle exec ruby -w -Itest test/log_subscriber_test.rb -n test_event_attributes Run options: -n test_event_attributes --seed 6231 F Failure: SyncLogSubscriberTest#test_event_attributes [test/log_subscriber_test.rb:84]: Expected 0 to be > 0. rails test test/log_subscriber_test.rb:78 Finished in 0.018983s, 52.6791 runs/s, 105.3582 assertions/s. 1 runs, 2 assertions, 1 failures, 0 errors, 0 skips ```
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/test/log_subscriber_test.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/activesupport/test/log_subscriber_test.rb b/activesupport/test/log_subscriber_test.rb
index 4f413b9627..7f05459493 100644
--- a/activesupport/test/log_subscriber_test.rb
+++ b/activesupport/test/log_subscriber_test.rb
@@ -80,10 +80,15 @@ class SyncLogSubscriberTest < ActiveSupport::TestCase
instrument "some_event.my_log_subscriber"
wait
event = @log_subscriber.event
+ if defined?(JRUBY_VERSION)
+ assert_equal 0, event.cpu_time
+ assert_equal 0, event.allocations
+ else
+ assert_operator event.cpu_time, :>, 0
+ assert_operator event.allocations, :>, 0
+ end
assert_operator event.duration, :>, 0
- assert_operator event.cpu_time, :>, 0
assert_operator event.idle_time, :>, 0
- assert_operator event.allocations, :>, 0
end
def test_does_not_send_the_event_if_it_doesnt_match_the_class