From 2ba2950d20e82f82017a52da9b09fdf1291479a2 Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Tue, 3 Feb 2026 17:37:05 +0900 Subject: show loadavg if the test fails to survey the following failure: ``` 1) Failure: TestFile#test_stat [/tmp/ruby/src/trunk-repeat20/test/ruby/test_file.rb:412]: Expected |1770056232.744032 - 1770056230.6465776| (2.097454309463501) to be <= 1. ``` BTW I found that `test/ruby/test_file.rb:412` `assert_in_delta atime, stat.atime.to_f, delta` only fails (mtime, ctime doesn't fail on 100 days). --- tool/lib/test/unit/assertions.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tool/lib') diff --git a/tool/lib/test/unit/assertions.rb b/tool/lib/test/unit/assertions.rb index 19581fc3ab..0908666166 100644 --- a/tool/lib/test/unit/assertions.rb +++ b/tool/lib/test/unit/assertions.rb @@ -128,8 +128,16 @@ module Test def assert_in_delta exp, act, delta = 0.001, msg = nil n = (exp - act).abs + loadavg = begin + if File.readable?("/proc/loadavg") + " (/proc/loadavg=#{File.read("/proc/loadavg").strip})" + end + rescue StandardError + nil + end + loadavg ||= "" msg = message(msg) { - "Expected |#{exp} - #{act}| (#{n}) to be <= #{delta}" + "Expected |#{exp} - #{act}| (#{n}) to be <= #{delta}#{loadavg}" } assert delta >= n, msg end -- cgit v1.2.3