ruby / io-console

add console capabilities to IO instance

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Test failures: NoMethodError: undefined method echo? and raw for an instance of File

junaruga opened this issue · comments

I got the following 2 failures on the latest master branch ruby/io-console beec164 on the latest master branch Ruby ruby/ruby@ced84beb25 right now. Do you know what's the reason?

Failure: test_bad_keyword(TestIO_Console):
  Exception(ArgumentError) with message matches to /unknown keyword:.*bad/.
  [ArgumentError] exception expected, not #<NoMethodError: undefined method `raw' for an instance of File>.
Failure: test_failed_path(TestIO_Console): [Errno::ENODEV, Errno::ENOTTY, Errno::EBADF, Errno::ENXIO] exception expected, not #<NoMethodError: undefined method `echo?' for an instance of File>.

Reproducing steps

$ cat /etc/fedora-release
Fedora release 38 (Thirty Eight)

$ uname -m
x86_64
$ gcc --version
gcc (GCC) 13.2.1 20231011 (Red Hat 13.2.1-4)
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ ruby -v
ruby 3.3.0dev (2023-11-07T10:22:30Z master ced84beb25) [x86_64-linux]

$ which ruby
~/.local/ruby-3.3.0dev-debug-ced84beb25/bin/ruby

$ bundle -v
Bundler version 2.5.0.dev

$ which bundle
~/.local/ruby-3.3.0dev-debug-ced84beb25/bin/bundle
$ pwd
/home/jaruga/git/ruby/io-console

$ bundle install

$ bundle list
Gems included by the bundle:
  * io-console (0.6.1.dev)
  * power_assert (2.0.3)
  * rake (13.1.0)
  * rake-compiler (1.2.5)
  * test-unit (3.6.1)
  * test-unit-ruby-core (1.0.5)
Use `bundle info` to print more detailed information about a gem
$ bundle exec rake compile
mkdir -p lib/3.3.0/x86_64-linux/io
mkdir -p tmp/x86_64-linux/io/console/3.3.0/io
cd tmp/x86_64-linux/io/console/3.3.0
/home/jaruga/.local/ruby-3.3.0dev-debug-ced84beb25/bin/ruby -I. ../../../../../ext/io/console/extconf.rb
checking for rb_io_path()... yes
checking for rb_io_descriptor()... yes
checking for rb_io_get_write_io()... yes
checking for rb_io_closed_p()... yes
checking for rb_io_open_descriptor()... yes
checking for termios.h... yes
checking for cfmakeraw() in termios.h... yes
checking for sys/ioctl.h... yes
checking for HAVE_RUBY_FIBER_SCHEDULER_H... yes
creating Makefile
cd -
cd tmp/x86_64-linux/io/console/3.3.0
/bin/gmake
gcc -I. -I/home/jaruga/.local/ruby-3.3.0dev-debug-ced84beb25/include/ruby-3.3.0+0/x86_64-linux -I/home/jaruga/.local/ruby-3.3.0dev-debug-ced84beb25/include/ruby-3.3.0+0/ruby/backward -I/home/jaruga/.local/ruby-3.3.0dev-debug-ced84beb25/include/ruby-3.3.0+0 -I../../../../../ext/io/console -DHAVE_RB_IO_PATH -DHAVE_RB_IO_DESCRIPTOR -DHAVE_RB_IO_GET_WRITE_IO -DHAVE_RB_IO_CLOSED_P -DHAVE_RB_IO_OPEN_DESCRIPTOR -DHAVE_TERMIOS_H -DHAVE_CFMAKERAW -DHAVE_SYS_IOCTL_H -DHAVE_RB_IO_WAIT=1    -fPIC -O0 -fno-fast-math -g3 -ggdb3 -gdwarf-4 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef  -fPIC  -o console.o -c ../../../../../ext/io/console/console.c
rm -f console.so
gcc -shared -o console.so console.o -L. -L/home/jaruga/.local/ruby-3.3.0dev-debug-ced84beb25/lib -Wl,-rpath,/home/jaruga/.local/ruby-3.3.0dev-debug-ced84beb25/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,--compress-debug-sections=zlib    -Wl,-rpath,/home/jaruga/.local/ruby-3.3.0dev-debug-ced84beb25/lib -L/home/jaruga/.local/ruby-3.3.0dev-debug-ced84beb25/lib -lruby  -lm -lpthread  -lc
cp console.so io/console.so
cd -
mkdir -p tmp/x86_64-linux/stage/lib/3.3.0/x86_64-linux/io
/bin/gmake install sitearchdir=../../../../../lib/3.3.0/x86_64-linux/io sitelibdir=../../../../../lib/3.3.0/x86_64-linux/io target_prefix=
/bin/mkdir -p . ../../../../../lib/3.3.0/x86_64-linux/io
exit > .sitearchdir.-.io.time
/bin/install -c -m 0755 console.so ../../../../../lib/3.3.0/x86_64-linux/io
cp tmp/x86_64-linux/io/console/3.3.0/io/console.so tmp/x86_64-linux/stage/lib/3.3.0/x86_64-linux/io/console.so
$ bundle exec rake test
/bin/gmake install sitearchdir=../../../../../lib/3.3.0/x86_64-linux/io sitelibdir=../../../../../lib/3.3.0/x86_64-linux/io target_prefix=
/bin/install -c -m 0755 console.so ../../../../../lib/3.3.0/x86_64-linux/io
cp tmp/x86_64-linux/io/console/3.3.0/io/console.so tmp/x86_64-linux/stage/lib/3.3.0/x86_64-linux/io/console.so
Loaded suite /home/jaruga/.local/ruby-3.3.0dev-debug-ced84beb25/lib/ruby/gems/3.3.0+0/gems/rake-13.1.0/lib/rake/rake_test_loader
Started
F
===============================================================================
Failure: test_bad_keyword(TestIO_Console):
  Exception(ArgumentError) with message matches to /unknown keyword:.*bad/.
  [ArgumentError] exception expected, not #<NoMethodError: undefined method `raw' for an instance of File>.
/home/jaruga/.local/ruby-3.3.0dev-debug-ced84beb25/lib/ruby/gems/3.3.0+0/gems/test-unit-ruby-core-1.0.5/lib/core_assertions.rb:446:in `block in assert_raise'
/home/jaruga/.local/ruby-3.3.0dev-debug-ced84beb25/lib/ruby/gems/3.3.0+0/gems/test-unit-ruby-core-1.0.5/lib/core_assertions.rb:532:in `assert'
/home/jaruga/.local/ruby-3.3.0dev-debug-ced84beb25/lib/ruby/gems/3.3.0+0/gems/test-unit-ruby-core-1.0.5/lib/core_assertions.rb:445:in `rescue in assert_raise'
/home/jaruga/.local/ruby-3.3.0dev-debug-ced84beb25/lib/ruby/gems/3.3.0+0/gems/test-unit-ruby-core-1.0.5/lib/core_assertions.rb:433:in `assert_raise'
/home/jaruga/.local/ruby-3.3.0dev-debug-ced84beb25/lib/ruby/gems/3.3.0+0/gems/test-unit-ruby-core-1.0.5/lib/core_assertions.rb:492:in `block in assert_raise_with_message'
/home/jaruga/.local/ruby-3.3.0dev-debug-ced84beb25/lib/ruby/gems/3.3.0+0/gems/test-unit-ruby-core-1.0.5/lib/envutil.rb:258:in `with_default_internal'
/home/jaruga/.local/ruby-3.3.0dev-debug-ced84beb25/lib/ruby/gems/3.3.0+0/gems/test-unit-ruby-core-1.0.5/lib/core_assertions.rb:491:in `assert_raise_with_message'
/home/jaruga/var/git/ruby/io-console/test/io/console/test_io_console.rb:55:in `test_bad_keyword'
     52:
     53:   def test_bad_keyword
     54:     omit if RUBY_ENGINE == 'jruby'
  => 55:     assert_raise_with_message(ArgumentError, /unknown keyword:.*bad/) do
     56:       File.open(IO::NULL) do |f|
     57:         f.raw(bad: 0)
     58:       end
===============================================================================
F
===============================================================================
Failure: test_failed_path(TestIO_Console): [Errno::ENODEV, Errno::ENOTTY, Errno::EBADF, Errno::ENXIO] exception expected, not #<NoMethodError: undefined method `echo?' for an instance of File>.
/home/jaruga/.local/ruby-3.3.0dev-debug-ced84beb25/lib/ruby/gems/3.3.0+0/gems/test-unit-ruby-core-1.0.5/lib/core_assertions.rb:446:in `block in assert_raise'
/home/jaruga/.local/ruby-3.3.0dev-debug-ced84beb25/lib/ruby/gems/3.3.0+0/gems/test-unit-ruby-core-1.0.5/lib/core_assertions.rb:532:in `assert'
/home/jaruga/.local/ruby-3.3.0dev-debug-ced84beb25/lib/ruby/gems/3.3.0+0/gems/test-unit-ruby-core-1.0.5/lib/core_assertions.rb:445:in `rescue in assert_raise'
/home/jaruga/.local/ruby-3.3.0dev-debug-ced84beb25/lib/ruby/gems/3.3.0+0/gems/test-unit-ruby-core-1.0.5/lib/core_assertions.rb:433:in `assert_raise'
/home/jaruga/var/git/ruby/io-console/test/io/console/test_io_console.rb:46:in `block in test_failed_path'
     43:     exceptions.compact!
     44:     omit if exceptions.empty?
     45:     File.open(IO::NULL) do |f|
  => 46:       e = assert_raise(*exceptions) do
     47:         f.echo?
     48:       end
     49:       assert_include(e.message, IO::NULL)
/home/jaruga/var/git/ruby/io-console/test/io/console/test_io_console.rb:45:in `open'
/home/jaruga/var/git/ruby/io-console/test/io/console/test_io_console.rb:45:in `test_failed_path'
===============================================================================
Finished in 1.517363165 seconds.
-------------------------------------------------------------------------------
3 tests, 8 assertions, 2 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
33.3333% passed
-------------------------------------------------------------------------------
1.98 tests/s, 5.27 assertions/s
rake aborted!
Command failed with status (1)
/home/jaruga/.local/ruby-3.3.0dev-debug-ced84beb25/bin/bundle:25:in `load'
/home/jaruga/.local/ruby-3.3.0dev-debug-ced84beb25/bin/bundle:25:in `<main>'
Tasks: TOP => test
(See full trace by running task with --trace)