aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-08-02 19:30:29 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-08-02 19:55:31 +0900
commit85ee4a65a22ebe6f3c65f0b10397bd6ebb976333 (patch)
tree4e8db40c10faa8e9fe310bd289cb0898ca3dc6af
parentffe0f9eb6cfbc388a0da979ed173da94fae46c82 (diff)
downloadruby-85ee4a65a22ebe6f3c65f0b10397bd6ebb976333.tar.gz
Allow to override environment variables for debug
-rw-r--r--test/-ext-/bug_reporter/test_bug_reporter.rb3
-rw-r--r--test/ruby/test_rubyoptions.rb3
-rw-r--r--tool/lib/envutil.rb2
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)