From: merch-redmine@... Date: 2020-08-21T15:12:22+00:00 Subject: [ruby-core:99665] [Ruby master Bug#17128] test_io_console.rb fails on actual console Issue #17128 has been updated by jeremyevans0 (Jeremy Evans). leam (Leam Hall) wrote in #note-1: > I have opened Bug 17128, to handle an edge case in a test. I have > working code to fix the issue, but am still learning the Ruby process > for contributing. > > Is this small enough to do a pull request for? Is there a better way to > resolve the issue? I'm not sure whether the change is correct, but if you would like to submit a pull request for it, you should do so to the upstream project: https://github.com/ruby/io-console/pulls ---------------------------------------- Bug #17128: test_io_console.rb fails on actual console https://bugs.ruby-lang.org/issues/17128#change-87149 * Author: leam (Leam Hall) * Status: Open * Priority: Normal * ruby -v: ruby 2.8.0dev (2020-08-21T07:01:46Z master 3eb76e747e) [x86_64-linux] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- When running "make test-all TESTS=io/console/test_io_console" on the current Ruby source, the following error is generated if the test is run on the server console: Run options: --seed=37271 "--ruby=./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems" --excludes-dir=./test/excludes --name=!/memory_leak/ # Running tests: 1) Error: TestIO_Console#test_set_winsize_console: Errno::EINVAL: Invalid argument - /dev/tty /usr/local/src/ruby/test/io/console/test_io_console.rb:446:in `winsize=' /usr/local/src/ruby/test/io/console/test_io_console.rb:446:in `test_set_winsize_console' Finished tests in 2.715363s, 9.2069 tests/s, 63.7116 assertions/s. 25 tests, 173 assertions, 0 failures, 1 errors, 0 skips ruby -v: ruby 2.8.0dev (2020-08-21T07:01:46Z master 3eb76e747e) [x86_64-linux] make: *** [yes-test-all] Error 1 #### The failing test is: 441 def test_set_winsize_console 442 set_winsize_setup 443 s = IO.console.winsize 444 assert_nothing_raised(TypeError) {IO.console.winsize = s} 445 bug = '[ruby-core:82741] [Bug #13888]' 446 IO.console.winsize = [s[0], s[1]+1] 447 assert_equal([s[0], s[1]+1], IO.console.winsize, bug) 448 IO.console.winsize = s 449 assert_equal(s, IO.console.winsize, bug) 450 ensure 451 set_winsize_teardown 452 end #### Similar to lines 282-296, a possible fix might be: 441 def test_set_winsize_console 442 set_winsize_setup 443 s = IO.console.winsize 444 assert_nothing_raised(TypeError) {IO.console.winsize = s} 445 bug = '[ruby-core:82741] [Bug #13888]' 446 begin 447 IO.console.winsize = [s[0], s[1]+1] 448 assert_equal([s[0], s[1]+1], IO.console.winsize, bug) 449 rescue Errno::EINVAL # Error if run on an actual console. 450 else 451 IO.console.winsize = s 452 assert_equal(s, IO.console.winsize, bug) 453 end 454 ensure 455 set_winsize_teardown 456 end -- https://bugs.ruby-lang.org/ Unsubscribe: