New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test with JRuby #22
Test with JRuby #22
Conversation
@nobu I will look into this. Thank you for starting the process! |
Two tests appear to hang: Both of these tests use a complicated set of queues and thread status checks that very likely may have races. I am trying to sort out what these tests are actually doing to see if there is a better way to accomplish it. Skipping those tests lets the suite complete (with a handful of errors) on SEED=1 at least. |
It appears that |
|
This stupid patch makes the tests run to completion: diff --git a/lib/ruby/stdlib/io/console/jruby/common.rb b/lib/ruby/stdlib/io/console/jruby/common.rb
index 10f7fc0396..48eeedbef4 100644
--- a/lib/ruby/stdlib/io/console/jruby/common.rb
+++ b/lib/ruby/stdlib/io/console/jruby/common.rb
@@ -1,6 +1,7 @@
# Methods common to all backend impls
class IO
- def getch(*)
+ def getch(*, min: 1)
+ return nil if min == 0
raw do
getc
end I will work on a less hacky fix. |
I added support for |
The tests |
I do not understand why my JRuby-specific changes broke the other platforms. |
Three out of the four JRuby runs (push/pull_request on head/9.2) now run to completion (with known errors) but I still don't understand why my changes broke the other builds. No other runs should even be loading the JRuby sources. |
Ok at least some of the problems are due to the subprocesses launched by the tests not including the jruby dir, so they pick up the older version shipped with JRuby instead of the one in the repository. I am testing a change that moves the JRuby stuff back under lib like it was in my original PR to see if it improves things. |
On JRuby the test
Ignoring stderr makes this pass on JRuby. I do not know why it started failing on CRuby. |
This allows the test suite to complete rather than blocking on the getch calls.
power_assert enables traces, which are only partially supported on JRuby without --debug. The warning that results breaks assert_separately due to stderr output from the child process.
This works at command line but seems to block in the cursor positioning tests.
And weirdly the CRuby tests now run to completion again. I am filling out some missing functionality to get closer to passing all tests. |
Having the separate dir makes testing difficult and doesn't reflect the structure the gem will eventually have. We can filter these files out if necessary when building the CRuby gem.
Locally I am down to 3 failures, but the most recent change that allows it to load the right console logic on JRuby causes the cursor position test to hang. For some reason even though it appears to write the proper escape sequence, that can't be read from the parent and so it gets stuck on readpartial. |
9d2185f
to
682c340
Compare
The subprocess script here works fine at a command line, but when run as a pty subprocess during the tests the master side hangs waiting for output.
e4e0421
to
02d9746
Compare
|
I am trying to figure that out now. It passes all test_pty and it appears to do the same as pty.c so I am not sure where the bug is, if any. |
This script reproduces the hanging in readpartial... on JRuby, both the 'hello' and the cursor escape sequence do not seem to make it into readpartial and it hangs there. Either line works on CRuby. If the require 'pty'
require 'io/console'
r, w, pid = PTY.spawn("jruby", "-Ilib", "-rio/console", "-e", <<src)
f = File.open('/dev/tty', 'r+')
f.sync = true
f.raw {
f.syswrite 'hello'
# f.cursor
}
f.cursor_down(3); con.puts
f.cursor_right(4); con.puts
f.cursor_left(2); con.puts
f.cursor_up(1); con.puts
src
p r.readpartial(5) |
The FFI version of io/console now passes rake test on CRuby.
I have made a few additional fixes and now the FFI version passes all tests under CRuby. @nobu At this point I think it is probably safe to say the FFI logic is good enough to ship, test issues on JRuby notwithstanding. The remaining problems do seem to be an issue with JRuby's PTY module so I will be looking into that next. I don't think there's any more work to do on the FFI io-console since it seems to work well in CRuby now. |
I have confirmed that CRuby also hangs in the same tests at |
Most of our current pty.rb came from @Freaky in jruby/jruby#3185 but due to our inability to fork we are unable to properly set up the tty in the subprocess. Specifically:
This is a known issue in our PTY and I do not know how to fix it. I have opened an issue for it here: jruby/jruby#6552 |
This test runs with test/unit now, which defines omit instead of skip.
JRuby's PTY.spawn does not produce a process with its own controlling terminal, which is necessary for testing these raw escape sequences. This commit marks those tests as pending. The functionality tested appears to work at a command line, but due to this PTY bug in JRuby we cannot test it this way. See jruby/jruby#6552
I have pushed a final set of commits that should make this green everywhere:
The suite runs green with me locally now and should be green in CI. I believe this PR is done. |
Enabled CI with JRuby, but seems hanging up.
@headius, do you have any idea?