From 85ee4a65a22ebe6f3c65f0b10397bd6ebb976333 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 2 Aug 2023 19:30:29 +0900 Subject: [PATCH] Allow to override environment variables for debug --- test/-ext-/bug_reporter/test_bug_reporter.rb | 3 +-- test/ruby/test_rubyoptions.rb | 3 +-- tool/lib/envutil.rb | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/test/-ext-/bug_reporter/test_bug_reporter.rb b/test/-ext-/bug_reporter/test_bug_reporter.rb index 6e44337d41..d4d0de7f46 100644 --- a/test/-ext-/bug_reporter/test_bug_reporter.rb +++ b/test/-ext-/bug_reporter/test_bug_reporter.rb @@ -9,8 +9,6 @@ class TestBugReporter < Test::Unit::TestCase end def test_bug_reporter_add - omit if ENV['RUBY_ON_BUG'] - description = RUBY_DESCRIPTION description = description.sub(/\+RJIT /, '') unless JITSupport.rjit_force_enabled? expected_stderr = [ @@ -27,6 +25,7 @@ class TestBugReporter < Test::Unit::TestCase args = ["--disable-gems", "-r-test-/bug_reporter", "-C", tmpdir] args.push("--yjit") if yjit_enabled? # We want the printed description to match this process's RUBY_DESCRIPTION + args.unshift({"RUBY_ON_BUG" => nil}) stdin = "#{no_core}register_sample_bug_reporter(12345); Process.kill :SEGV, $$" assert_in_out_err(args, stdin, [], expected_stderr, encoding: "ASCII-8BIT") ensure diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index 5fdcf128cf..c616cb8831 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -789,11 +789,10 @@ class TestRubyOptions < Test::Unit::TestCase end def assert_segv(args, message=nil) - omit if ENV['RUBY_ON_BUG'] - # We want YJIT to be enabled in the subprocess if it's enabled for us # so that the Ruby description matches. args.unshift("--yjit") if self.class.yjit_enabled? + args.unshift({'RUBY_ON_BUG' => nil}) test_stdin = "" opt = SEGVTest::ExecOptions.dup diff --git a/tool/lib/envutil.rb b/tool/lib/envutil.rb index 728ca7059b..3316b1b01d 100644 --- a/tool/lib/envutil.rb +++ b/tool/lib/envutil.rb @@ -155,7 +155,7 @@ module EnvUtil # remain env %w(ASAN_OPTIONS RUBY_ON_BUG).each{|name| - child_env[name] = ENV[name] if ENV[name] + child_env = ENV[name] if !child_env.key?(name) and ENV.key?(name) } args = [args] if args.kind_of?(String)