Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions bootstraptest/test_io.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/freebsd/ =~ RUBY_PLATFORM or
assert_finish 5, %q{
r, w = IO.pipe
t1 = Thread.new { r.sysread(1) }
Expand Down Expand Up @@ -31,7 +30,6 @@
end
}, '[ruby-dev:32566]'

/freebsd/ =~ RUBY_PLATFORM or
assert_finish 5, %q{
r, w = IO.pipe
Thread.new {
Expand Down Expand Up @@ -85,7 +83,7 @@
ARGF.set_encoding "foo"
}

/(freebsd|mswin)/ =~ RUBY_PLATFORM or
/mswin/ =~ RUBY_PLATFORM or
10.times do
assert_normal_exit %q{
at_exit { p :foo }
Expand Down
3 changes: 3 additions & 0 deletions insns.def
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,9 @@ intern
()
(VALUE str)
(VALUE sym)
/* This instruction can raise EncodingError, thus can call
* EncodingError#initialize. */
// attr bool leaf = false;
{
sym = rb_str_intern(str);
}
Expand Down
3 changes: 0 additions & 3 deletions lib/mkmf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2763,9 +2763,6 @@ def init_mkmf(config = CONFIG, rbconfig = RbConfig::CONFIG)
if $warnflags = CONFIG['warnflags'] and CONFIG['GCC'] == 'yes'
# turn warnings into errors only for bundled extensions.
config['warnflags'] = $warnflags.gsub(/(?:\A|\s)-W\Kerror[-=](?!implicit-function-declaration)/, '')
if /icc\z/ =~ config['CC']
config['warnflags'].gsub!(/(\A|\s)-W(?:division-by-zero|deprecated-declarations)/, '\1')
end
RbConfig.expand(rbconfig['warnflags'] = config['warnflags'].dup)
config.each do |key, val|
RbConfig.expand(rbconfig[key] = val.dup) if /warnflags/ =~ val
Expand Down
2 changes: 1 addition & 1 deletion lib/time.rb
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ def xmlschema(time)
def rfc3339(time)
pattern = /\A\s*
(-?\d{4})-(\d\d)-(\d\d)
[T\s]
[T ]
(\d\d):(\d\d):(\d\d)
(\.\d+)?
(Z|[+-]\d\d:\d\d)
Expand Down
6 changes: 5 additions & 1 deletion parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -14095,8 +14095,12 @@ reduce_nodes(struct parser_params *p, NODE **body)
while (node) {
int newline = (int)nd_fl_newline(node);
switch (nd_type(node)) {
end:
case NODE_NIL:
// Keep an explicit nil in a method's tail (value) position when it
// is on its own line, so it still emits a :line event and records
// line coverage for that line. [Bug #22302]
if (newline) return;
end:
*body = 0;
return;
case NODE_BEGIN:
Expand Down
6 changes: 3 additions & 3 deletions spec/ruby/core/process/setpriority_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
Process.getpriority(Process::PRIO_PROCESS, 0).should == priority
end

# Darwin and FreeBSD don't seem to handle these at all, getting all out of
# whack with either permission errors or just the wrong value
platform_is_not :darwin, :freebsd do
# Darwin doesn't seem to handle these at all, getting all out of whack
# with either permission errors or just the wrong value
platform_is_not :darwin do
it "sets the scheduling priority for a specified process group" do
priority = Process.getpriority(Process::PRIO_PGRP, 0)

Expand Down
14 changes: 5 additions & 9 deletions spec/ruby/core/process/times_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@
Process.times.should.is_a?(Process::Tms)
end

# TODO: Intel C Compiler does not work this example
# http://rubyci.s3.amazonaws.com/icc-x64/ruby-master/log/20221013T030005Z.fail.html.gz
unless RbConfig::CONFIG['CC']&.include?("icx")
it "returns current cpu times" do
t = Process.times
user = t.utime
it "returns current cpu times" do
t = Process.times
user = t.utime

1 until Process.times.utime > user
Process.times.utime.should > user
end
1 until Process.times.utime > user
Process.times.utime.should > user
end
end
15 changes: 7 additions & 8 deletions spec/ruby/core/thread/backtrace/location/source_range_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,13 @@ class Symbol
end
RUBY

# Aborts the test process on CRuby's CI with ZJIT
# "interpolated symbol" => [<<-RUBY, :InterpolatedSymbolNode],
# value = Object.new
# def value.to_s
# (+"\\xFF").force_encoding(Encoding::UTF_8)
# end
# %I[$\#{value}$]
# RUBY
"interpolated symbol" => [<<-RUBY, :InterpolatedSymbolNode],
value = Object.new
def value.to_s
(+"\\xFF").force_encoding(Encoding::UTF_8)
end
%I[$\#{value}$]
RUBY
}.each_pair do |description, (source, prism_class, frame)|
it "returns the precise range for #{description}" do
capture_backtrace_location_source_range(source, prism_class, frame: frame || 0)
Expand Down
2 changes: 0 additions & 2 deletions spec/ruby/language/symbol_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
%I{a b #{"c"}}.should == [:a, :b, :c]
end

quarantine! do # Aborts the test process on CRuby's CI
it "raises an EncodingError when an interpolated symbol has invalid bytes" do
-> {
:"#{(+"\xFF").force_encoding(Encoding::UTF_8)}"
Expand All @@ -106,7 +105,6 @@
%I[#{(+"\xFF").force_encoding(Encoding::UTF_8)}]
}.should.raise(EncodingError, 'invalid symbol in encoding UTF-8 :"\xFF"')
end
end

ruby_bug "#20280", ""..."3.4" do
it "raises an SyntaxError at parse time when Symbol with invalid bytes" do
Expand Down
12 changes: 0 additions & 12 deletions test/.excludes/TestThread.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
# frozen_string_literal: false
exclude(/_stack_size$/, 'often too expensive')
if /freebsd13/ =~ RUBY_PLATFORM
# http://rubyci.s3.amazonaws.com/freebsd13/ruby-master/log/20220216T143001Z.fail.html.gz
#
# 1) Error:
# TestThread#test_signal_at_join:
# Timeout::Error: execution of assert_separately expired timeout (120 sec)
# pid 30743 killed by SIGABRT (signal 6) (core dumped)
# |
#
# /usr/home/chkbuild/chkbuild/tmp/build/20220216T143001Z/ruby/test/ruby/test_thread.rb:1390:in `test_signal_at_join'
exclude(:test_signal_at_join, 'gets stuck somewhere')
end
if /mswin/ =~ RUBY_PLATFORM && ENV.key?('GITHUB_ACTIONS')
# to avoid "`failed to allocate memory (NoMemoryError)" error
exclude(:test_thread_interrupt_for_killed_thread, 'TODO')
Expand Down
9 changes: 0 additions & 9 deletions test/.excludes/TestThreadQueue.rb

This file was deleted.

20 changes: 20 additions & 0 deletions test/coverage/test_coverage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,26 @@ def foo(bar)
end;
end

def test_line_coverage_for_implicit_nil_return
result = {
:lines => [1, 1, nil, nil, 1, 1, 1, nil, nil, nil, 1, 1]
}
assert_coverage(<<~"end;", { lines: true }, result) # Bug #22302
def a
nil
end

def b(x)
if x
nil
end
end

a
b(true)
end;
end

def test_branch_coverage_for_if_statement
result = {
:branches => {
Expand Down
9 changes: 0 additions & 9 deletions test/io/console/test_io_console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -555,15 +555,6 @@ def assert_ctrl(expect, cc, r, w)
end

def test_intr
# This test fails randomly on FreeBSD 13
# http://rubyci.s3.amazonaws.com/freebsd13/ruby-master/log/20220304T163001Z.fail.html.gz
#
# 1) Failure:
# TestIO_Console#test_intr [/usr/home/chkbuild/chkbuild/tmp/build/20220304T163001Z/ruby/test/io/console/test_io_console.rb:387]:
# <"25"> expected but was
# <"-e:12:in `p': \e[1mexecution expired (\e[1;4mTimeout::Error\e[m\e[1m)\e[m">.
omit if host_os?(/freebsd/)

run_pty("#{<<~"begin;"}\n#{<<~'end;'}") do |r, w, _|
begin;
require 'timeout'
Expand Down
4 changes: 0 additions & 4 deletions test/ruby/test_file_exhaustive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1466,8 +1466,6 @@ def test_truncate
end

def test_flock_exclusive
omit "[Bug #18613]" if /freebsd/ =~ RUBY_PLATFORM

timeout = EnvUtil.apply_timeout_scale(1).to_s
File.open(regular_file, "r+") do |f|
f.flock(File::LOCK_EX)
Expand Down Expand Up @@ -1497,8 +1495,6 @@ def test_flock_exclusive
end

def test_flock_shared
omit "[Bug #18613]" if /freebsd/ =~ RUBY_PLATFORM

timeout = EnvUtil.apply_timeout_scale(1).to_s
File.open(regular_file, "r+") do |f|
f.flock(File::LOCK_SH)
Expand Down
15 changes: 15 additions & 0 deletions test/ruby/test_insns_leaf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,19 @@ def test_insns_leaf
assert Namespace.test?(Id.new(1)), "IDS should include 1"
assert !Namespace.test?(Id.new(5)), "IDS should not include 5"
end

def test_intern_is_not_leaf
assert_separately([], <<~'RUBY')
class EncodingError
def initialize(...)
$encoding_error_initialize_called = true
super
end
end

invalid_utf8 = (+"\xFF").force_encoding(Encoding::UTF_8)
assert_raise(EncodingError) { :"#{invalid_utf8}" }
assert $encoding_error_initialize_called
RUBY
end
end
6 changes: 0 additions & 6 deletions test/ruby/test_io.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3606,8 +3606,6 @@ def test_cross_thread_close_fd
end

def test_cross_thread_close_stdio
omit "[Bug #18613]" if /freebsd/ =~ RUBY_PLATFORM

assert_separately([], <<-'end;')
IO.pipe do |r,w|
$stdin.reopen(r)
Expand Down Expand Up @@ -4302,8 +4300,6 @@ def test_race_gets_and_close
end

def test_race_closed_stream
omit "[Bug #18613]" if /freebsd/ =~ RUBY_PLATFORM

assert_separately([], "#{<<-"begin;"}\n#{<<-"end;"}")
begin;
bug13158 = '[ruby-core:79262] [Bug #13158]'
Expand Down Expand Up @@ -4398,8 +4394,6 @@ def lim.to_int; raise "invalid limit"; end
end

def test_closed_stream_in_rescue
omit "[Bug #18613]" if /freebsd/ =~ RUBY_PLATFORM

assert_separately([], "#{<<-"begin;"}\n#{<<~"end;"}")
begin;
10.times do
Expand Down
4 changes: 0 additions & 4 deletions test/ruby/test_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1465,10 +1465,6 @@ def rest_parameter(*rest)
end

def test_splat_long_array
if File.exist?('/etc/os-release') && File.read('/etc/os-release').include?('openSUSE Leap')
# For RubyCI's openSUSE machine http://rubyci.s3.amazonaws.com/opensuseleap/ruby-trunk/recent.html, which tends to die with NoMemoryError here.
omit 'do not exhaust memory on RubyCI openSUSE Leap machine'
end
n = 10_000_000
assert_equal n , rest_parameter(*(1..n)).size, '[Feature #10440]'
end
Expand Down
2 changes: 0 additions & 2 deletions test/ruby/test_require.rb
Original file line number Diff line number Diff line change
Expand Up @@ -889,8 +889,6 @@ def test_loading_fifo_threading_raise
end if File.respond_to?(:mkfifo)

def test_loading_fifo_threading_success
omit "[Bug #18613]" if /freebsd/=~ RUBY_PLATFORM

Tempfile.create(%w'fifo .rb') {|f|
f.close
File.unlink(f.path)
Expand Down
6 changes: 0 additions & 6 deletions test/ruby/test_thread.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1009,8 +1009,6 @@ def test_backtrace
end

def test_thread_timer_and_interrupt
omit "[Bug #18613]" if /freebsd/ =~ RUBY_PLATFORM

bug5757 = '[ruby-dev:44985]'
pid = nil
cmd = 'Signal.trap(:INT, "DEFAULT"); pipe=IO.pipe; Thread.start {Thread.pass until Thread.main.stop?; puts; STDOUT.flush}; pipe[0].read'
Expand Down Expand Up @@ -1530,10 +1528,6 @@ def test_signal_at_join
# opt = {new_pgroup: true}
end

if /freebsd/ =~ RUBY_PLATFORM
omit "[Bug #18613]"
end

assert_separately([], "#{<<~"{#"}\n#{<<~'};'}", timeout: 120)
{#
n = 1000
Expand Down
2 changes: 0 additions & 2 deletions test/ruby/test_thread_queue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,6 @@ def test_sized_queue_push_non_block
end

def test_thr_kill
omit "[Bug #18613]" if /freebsd/ =~ RUBY_PLATFORM

bug5343 = '[ruby-core:39634]'
Dir.mktmpdir {|d|
timeout = 120
Expand Down
4 changes: 2 additions & 2 deletions test/ruby/test_time_tz.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ class TestTimeTZ < Test::Unit::TestCase
has_lisbon_tz = true
force_tz_test = ENV["RUBY_FORCE_TIME_TZ_TEST"] == "yes"
case RUBY_PLATFORM
when /darwin|linux/
when /darwin|linux|freebsd/
force_tz_test = true
when /freebsd|openbsd/
when /openbsd/
has_lisbon_tz = false
force_tz_test = true
end
Expand Down
2 changes: 1 addition & 1 deletion test/socket/test_socket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ def test_closed_read
ensure
serv_thread.value.close
server.close
end unless RUBY_PLATFORM.include?("freebsd")
end

def test_connect_timeout
host = "127.0.0.1"
Expand Down
23 changes: 23 additions & 0 deletions test/test_time.rb
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,29 @@ def test_huge_precision
define_method(test.sub(/xmlschema/, 'rfc3339')) {__send__(sub, :rfc3339)}
end

def test_rfc3339_separator
# RFC 3339 section 5.6 defines the separator as "T", and only notes that an
# application may use a space for readability. The other \s characters are
# not permitted, and Time.xmlschema has never accepted any of them.
t = Time.utc(2011, 10, 5, 22, 26, 12)
assert_equal(t, Time.rfc3339("2011-10-05T22:26:12Z"))
assert_equal(t, Time.rfc3339("2011-10-05 22:26:12Z"))

["\t", "\n", "\v", "\f", "\r"].each do |sep|
s = "2011-10-05#{sep}22:26:12Z"
e = assert_raise(ArgumentError, "separator #{sep.inspect}") { Time.rfc3339(s) }
assert_match(/invalid rfc3339 format/, e.message, "separator #{sep.inspect}")
end

# Time.xmlschema keeps rejecting every separator but "T".
assert_equal(t, Time.xmlschema("2011-10-05T22:26:12Z"))
["\t", "\n", "\v", "\f", "\r", " "].each do |sep|
assert_raise(ArgumentError, "separator #{sep.inspect}") do
Time.xmlschema("2011-10-05#{sep}22:26:12Z")
end
end
end

def test_parse_with_various_object
d = Date.new(2010, 10, 28)
dt = DateTime.new(2010, 10, 28)
Expand Down
4 changes: 2 additions & 2 deletions yjit/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10254,8 +10254,8 @@ fn gen_intern(
jit: &mut JITState,
asm: &mut Assembler,
) -> Option<CodegenStatus> {
// Save the PC and SP because we might allocate
jit_prepare_call_with_gc(jit, asm);
// rb_str_intern can allocate and raise EncodingError.
jit_prepare_non_leaf_call(jit, asm);

let str = asm.stack_opnd(0);
let sym = asm.ccall(rb_str_intern as *const u8, vec![str]);
Expand Down
Loading