aboutsummaryrefslogtreecommitdiffstats
path: root/tool/lib/leakchecker.rb
diff options
context:
space:
mode:
authorKazuhiro NISHIYAMA <zn@mbf.nifty.com>2019-12-27 13:06:31 +0900
committerKazuhiro NISHIYAMA <zn@mbf.nifty.com>2019-12-27 13:06:31 +0900
commit729b7ce27058ed4b41d5facbb6b912b8e7c6a960 (patch)
tree8dcdc2f4e80228ff900b0d8822a704013cd95993 /tool/lib/leakchecker.rb
parent8c5430e2745b7dad698cfcc6e0d3ba6c71bfc39e (diff)
downloadruby-729b7ce27058ed4b41d5facbb6b912b8e7c6a960.tar.gz
Add check_warning_flags to leakchecker
Diffstat (limited to 'tool/lib/leakchecker.rb')
-rw-r--r--tool/lib/leakchecker.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/tool/lib/leakchecker.rb b/tool/lib/leakchecker.rb
index 57e28665d6..7d7f4835c0 100644
--- a/tool/lib/leakchecker.rb
+++ b/tool/lib/leakchecker.rb
@@ -7,6 +7,7 @@ class LeakChecker
@env_info = find_env
@encoding_info = find_encodings
@old_verbose = $VERBOSE
+ @old_warning_flags = find_warning_flags
end
def check(test_name)
@@ -17,6 +18,7 @@ class LeakChecker
check_env(test_name),
check_encodings(test_name),
check_verbose(test_name),
+ check_warning_flags(test_name),
]
GC.start if leaks.any?
end
@@ -230,6 +232,26 @@ class LeakChecker
return leaked
end
+ WARNING_CATEGORIES = %i[deprecated experimental].freeze
+
+ def find_warning_flags
+ WARNING_CATEGORIES.to_h do |category|
+ [category, Warning[category]]
+ end
+ end
+
+ def check_warning_flags(test_name)
+ new_warning_flags = find_warning_flags
+ leaked = false
+ WARNING_CATEGORIES.each do |category|
+ if new_warning_flags[category] != @old_warning_flags[category]
+ leaked = true
+ puts "Warning[#{category.inspect}] changed: #{test_name} : #{@old_warning_flags[category]} to #{new_warning_flags[category]}"
+ end
+ end
+ return leaked
+ end
+
def puts(*a)
output = MiniTest::Unit.output
if defined?(output.set_encoding)