Skip to content

Fixes to get specs passing on Darwin and other things#6311

Merged
headius merged 17 commits intojruby:masterfrom
headius:darwin_specs
Jul 8, 2020
Merged

Fixes to get specs passing on Darwin and other things#6311
headius merged 17 commits intojruby:masterfrom
headius:darwin_specs

Conversation

@headius
Copy link
Member

@headius headius commented Jul 8, 2020

This started out as a PR to get :fast specs passing on Darwin, but has expanded into fixing a few additional issues.

The bulk of the failing specs were from socket specs, mostly because there are special carve-outs for certain platforms and we did not have these tagged. Where possible, I've actually fixed the related specs on all platforms.

One failure was due to the JIT not using <main> for the method name of blocks at the root level of a script.

One failure was due to incorrectly managing the SIGCLD and SIGCHLD signals the way CRuby does.

headius added 11 commits July 7, 2020 14:53
This fixes one spec when run with command-line AOT enabled (the
default):

Kernel#caller returns an Array with the block given to #at_exit at the base of the stack FAILED
Expected ["/spec/ruby/core/kernel/fixtures/caller_at_exit.rb:6:in `foo'\n",
 "/spec/ruby/core/kernel/fixtures/caller_at_exit.rb:2:in `block in /spec/ruby/core/kernel/fixtures/caller_at_exit.rb'\n"] == ["/spec/ruby/core/kernel/fixtures/caller_at_exit.rb:6:in `foo'\n",
 "/spec/ruby/core/kernel/fixtures/caller_at_exit.rb:2:in `block in <main>'\n"]
to be truthy but was false
This fixes one spec on Darwin:

Signal.list redefines CLD with CHLD if defined FAILED
Expected nil == 20
to be truthy but was false
This expands our exception translation to work for more than just
the IOException family of types, first including the
NotYetConnectedException that does not live within that hierarchy.

In addition, it makes this translation method explicitly from
Throwable to Throwable with a user-provided fallback, and adds a
method for doing this translation or throwing the original error
in one shot.

This change was motivated by issues in BasicSocket where the
NotYetConnectedException was bubbling out as-is, rather than being
translated into an ENOTCONN. A subsequent change will modify
RubyBasicSocket to use this new logic.
Without this change, we were raising the original NotYetConnected
exception instead of a more appropriate ENOTCONN.
When the socket is a datagram socket, implement these using
DatagramChannel.send and receive. Otherwise fall back on the
previous logic that does writes and reads.

This fixes all failures in BasicSocket's read_nonblock specs.
This fixes at least one spec failure on Darwin, and may fix
others.
@headius headius added the core label Jul 8, 2020
@headius headius added this to the JRuby 9.3.0.0 milestone Jul 8, 2020
headius added 5 commits July 8, 2020 03:20
Apparently Travis does not have IPv6, so IPv6-specific specs do
not run there.
MacOS appears to provide a hostname for the broadcast address, so
when we attempt to reverse the address we get the name instead of
the address. We shouldn't reverse the name, but there doesn't
appear to be another way to get the hostname from Java's
InetAddress.
* On Linux, read_nonblock's use of recv(... MSG_DONTWAIT) does not
  leave the socket non-blocking, so we emulate that with Java APIs
  here.
* Refactor handling of EAGAIN result to share code with
  recv_nonblock.
This moves some hanging specs to a new "hangs" tag, to make that
exclusion clearer and filterable when updating "fails" tags.
@headius headius marked this pull request as ready for review July 8, 2020 10:09
These represent minor behavioral differences when running on
Travis CI, but should otherwise pass.
@headius headius merged commit 06137d0 into jruby:master Jul 8, 2020
@headius headius deleted the darwin_specs branch July 8, 2020 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant