Project

General

Profile

Actions

Bug #17128

closed

test_io_console.rb fails on actual console

Added by leam (Leam Hall) over 3 years ago. Updated over 3 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.8.0dev (2020-08-21T07:01:46Z master 3eb76e747e) [x86_64-linux]
[ruby-core:99662]

Description

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

Updated by leam (Leam Hall) over 3 years ago

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?

Thank you.

Leam

Updated by jeremyevans0 (Jeremy Evans) over 3 years ago

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

Updated by leam (Leam Hall) over 3 years ago

Jeremy, thank you for the suggestion! I will do that now.

Updated by jeremyevans0 (Jeremy Evans) over 3 years ago

  • Status changed from Open to Closed

The pull request was merged (https://github.com/ruby/io-console/pull/16), so this can be closed.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0