Commit graph

93 commits

Author SHA1 Message Date
Charles Oliver Nutter
abf71864a5
[ruby/io-console] Mark all tests that use run_pty as pend on JRuby
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 https://github.com/jruby/jruby/issues/6552

a486b72e5e
b5c8e7bfd8
2021-02-05 12:29:33 +09:00
Charles Oliver Nutter
a1cc044ea1
[ruby/io-console] Use omit instead of skip
This test runs with test/unit now, which defines omit instead of
skip.

bd731d0b8d
2021-02-05 12:01:38 +09:00
Charles Oliver Nutter
2a764fe764
[ruby/io-console] Skip test on JRuby
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.

4a21610ece
2021-02-05 12:01:38 +09:00
Charles Oliver Nutter
8960d6b5bd
[ruby/io-console] Add console.rb to search for paths
74567376c4
2021-02-05 12:01:38 +09:00
Nobuyoshi Nakada
9ef7780b09
[ruby/io-console] Run subprocesses without test libraries
Now io/console is loaded from test-unit indirectly, test-unit
requires power_assert which requires io/console.

8817d07951
639cce89de
2021-02-05 11:45:04 +09:00
Nobuyoshi Nakada
ead8d89bd7 [ruby/io-console] Ignore chomp! result and return the modified string
09e5ccc729
2021-01-05 21:26:11 +09:00
Nobuyoshi Nakada
a79966743c [ruby/io-console] Fix timeout type error (#18)
Fixed TypeError when IO#getch timed out

`rb_io_wait` returns a bit-flags Integer representing available
events, or Qfalse if timed out.  Also the result of `NUM2INT` is
not a `VALUE`.

```
$ ./bin/ruby -v -rio/console -e "p IO.console.getch(intr: true, time: 0.1)"
ruby 3.0.0dev (2020-10-09T20:27:30Z master 5ea2ea74cc) [x64-mingw32]
-e:1:in `getch': no implicit conversion of false into Integer (TypeError)
        from -e:1:in `<main>'
```

3bdfaf62df
2020-10-11 02:00:24 +09:00
Leam Hall
f4b9e94317
[ruby/io-console] Bug 17128: In test_set_winsize_console, wrapped re-size in a begin-rescue-else.
a22333c33a
2020-08-27 23:46:02 +09:00
Nobuyoshi Nakada
883214f8e9
Use %w instead of %i not to create unused IDs 2020-05-09 20:13:30 +09:00
Yusuke Endoh
595e74ae4b test/io/console/test_io_console.rb: Rescue Errno::ENXIO for Solaris
20200509T100003Z.fail.html.gz
```
  1) Failure:
TestIO_Console#test_failed_path [/export/home/users/chkbuild/cb-gcc/tmp/build/20200509T100003Z/ruby/test/io/console/test_io_console.rb:40]:
[Errno::ENODEV, Errno::ENOTTY, Errno::EBADF] exception expected, not #<Errno::ENXIO: No such device or address - /dev/null>.
```
2020-05-09 20:07:38 +09:00
Nobuyoshi Nakada
581763d14c [ruby/io-console] Fails with EBADF on mingw
530cec574c
2020-05-09 14:51:43 +09:00
Nobuyoshi Nakada
d7a59e2ffe
[ruby/io-console] Expanded expected errors
May fail with ENOTTY instead of ENODEV.

fe117b89e0
2020-05-09 14:46:08 +09:00
Nobuyoshi Nakada
cc9bc14530 [ruby/io-console] Added test for failed path
06a540f9b4
2020-05-09 13:57:04 +09:00
Charles Oliver Nutter
569f56e0f7 [ruby/io-console] Filter Ruby engine name rather than just /ruby/
This breaks tests using this path on JRuby because the `jruby`
executable turns into `jjruby` after the sub.

e5951aa34c
2020-01-18 00:15:00 +09:00
Nobuyoshi Nakada
31e2f03512 [ruby/io-console] Enable only interrupt bits on intr: true
baaf929041
2019-12-29 16:26:22 +09:00
Nobuyoshi Nakada
c147eeff7c [ruby/io-console] Skip Interrupt test on Linux
Hangs up only in ruby/ruby on Travis-CI.

de39aa6dd6
2019-12-18 13:30:52 +09:00
Nobuyoshi Nakada
77e3078ede [ruby/io-console] Set raw mode strictly same as cfmakeraw
* Default VMIN and VTIME to minimum input.
* Disable parity check bits explicitly.
* Disable all bits for flow control on input.

Co-Authored-By: NARUSE, Yui <naruse@airemix.jp>

5ce201a686
2019-12-18 10:33:05 +09:00
Nobuyoshi Nakada
07ed8f2f91 [ruby/io-console] Skip interrupt
8ed5a2bcc3
2019-12-18 00:08:04 +09:00
Nobuyoshi Nakada
905a926ea8 [ruby/io-console] Timeout in the child process
b8411689a5
2019-12-17 23:55:24 +09:00
Nobuyoshi Nakada
4b7d27ca0d [ruby/io-console] Use IO.console instead of STDIN
9e3ec5b936
2019-12-17 23:55:22 +09:00
Nobuyoshi Nakada
81eb2d16ef
[ruby/io-console] Disable implementation-defined special control characters
In raw mode with interrupt enabled.

e9e8e3ff17
2019-12-17 13:55:04 +09:00
Nobuyoshi Nakada
ec89a0f803
[ruby/io-console] Added the test for intr option
4f01db102d
2019-12-17 13:55:04 +09:00
Yusuke Endoh
0bca34ddaa test/io/console/test_io_console.rb: add a memo for the mysterious hack 2019-12-05 16:56:08 +09:00
Yusuke Endoh
b40bb27e35 test/io/console/test_io_console.rb: Try the hack for Solaris
I'm not entirely sure why, but test_set_winsize_console gets stuck on
Solaris (and if I recall, macOS).  I found a hack for FreeBSD, so I want
to give it a try on Solaris too.
2019-12-05 15:53:29 +09:00
Nobuyoshi Nakada
b1c92363a7
Wait for the main thread to start reading by Queue
Otherwise, the written data to pty before the reading started may
be just lost.
2019-12-02 13:17:05 +09:00
Kazuhiro NISHIYAMA
c99fb0f41e
Revert "[ruby/io-console] Skip cursor position test on Solaris"
This reverts commit 5294ded681.
2019-09-25 09:48:44 +09:00
Nobuyoshi Nakada
c60451d9cd [ruby/io-console] Unique paths to be added
a3ad851b6c
2019-09-25 09:43:31 +09:00
Nobuyoshi Nakada
fc9eb5b9c1 [ruby/io-console] Load the current libraries
ab7653c543
2019-09-25 09:43:29 +09:00
Nobuyoshi Nakada
5294ded681 [ruby/io-console] Skip cursor position test on Solaris
It results in a mysterious failure.

e3543c3da4
2019-09-25 08:24:19 +09:00
Nobuyoshi Nakada
10e3267c31 [ruby/io-console] Made cursor position 0-origin
9377e37295
2019-09-24 16:20:31 +09:00
nobu
65dd1434b3 Suppress uninitialized instance variable warnings
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-14 01:29:23 +00:00
normal
c7ce155412 test/io/console/test_io_console.rb: fix short read failures
Running with TESTS=--no-retry, I sometimes get short reads
leading to failures due to the use of IO#readpartial instead of
IO#gets.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-09 09:02:32 +00:00
normal
1c8b370840 test/io/console/test_io_console.rb: fix for systems where PTY is not defined
[ruby-core:87420] [Bug #14828]
Thanks-to: MSP-Greg (Greg L)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-06 01:12:23 +00:00
normal
bcd984f02f test/io/console/test_io_console.rb: ignore TTOU on FreeBSD
I'm not entirely sure why, but SIGTTOU pauses the test
when running test-all in parallel.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-05 22:28:49 +00:00
mame
0efd8bbd34 test/io/console/test_io_console.rb (test_oflush): Avoid race condition
Add a ad-hoc wait.  Follows test_ioflush2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-15 05:34:20 +00:00
nobu
ac40fc997b test_io_console.rb: get rid of sporadic failures
* test/io/console/test_io_console.rb (test_getpass): try to get
  rid of timing issues.

* test/io/console/test_io_console.rb (test_ioflush2): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-23 14:31:56 +00:00
nobu
140daa5212 test_io_console.rb: flush
* test/io/console/test_io_console.rb: flush to ensure the second
  data is sent.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-28 02:51:41 +00:00
nobu
65b11a04f1 console.c: set winsize on Windows
* ext/io/console/console.c (console_set_winsize): retry shrinking
  window and screen buffer.  [ruby-core:82741] [Bug #13888]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-11 20:10:34 +00:00
nobu
b6bc45b985 test_io_console.rb: test_set_winsize_console
* test/io/console/test_io_console.rb (test_set_winsize_console):
  split from test_get_winsize_console and enable the case when
  attached to a console already

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-11 20:10:33 +00:00
nobu
868700a7a6 test_io_console.rb: fix of old CentOS5
* test/io/console/test_io_console.rb (test_winsize): on old CentOS5
  window size seems unable to be set across a pty.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-08 04:04:29 +00:00
nobu
b4a55c1cad console.c: unpaired size
* ext/io/console/console.c (console_set_winsize): reject unpaired
  pixel size.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-07 23:02:29 +00:00
nobu
5b856ee1a6 console.c: OOB access
* ext/io/console/console.c (console_set_winsize): fix
  out-of-bounds access.  [ruby-core:79004] [Bug #13112]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-07 22:52:03 +00:00
nobu
e78beed499 io/console: unknown key code for names with nul
* ext/io/console/console.c (console_key_pressed_p): raise the same
  exception, "unknown virtual key code", for names with nul chars.
  though console_win32_vk() considers the length and can deal with
  nul chars, rb_sprintf() raised at PRIsVALUE previously, so quote
  it if it is unprintable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-15 01:07:14 +00:00
nobu
caaf4f2aea io/console: move conditions
* test/io/console/test_io_console.rb: move conditions for method
  definitions before the bodies.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-15 01:06:49 +00:00
naruse
3e92b635fb Add frozen_string_literal: false for all files
When you change this to true, you may need to add more tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 05:07:31 +00:00
nobu
e373aed707 TestIO_Console.rb: disable getpass test by --excludes
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09 20:06:00 +00:00
nobu
ac5c2218ee test_io_console.rb: skip
* test/io/console/test_io_console.rb (test_getpass): skip for the
  time being.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09 11:53:52 +00:00
nobu
040a83d83e test_io_console.rb: wait
* test/io/console/test_io_console.rb (test_getpass): wait for the
  child process to read the input, not to read it by the master
  itself.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09 10:45:18 +00:00
nobu
6e6dcf2a6c test_io_console.rb: ignore echo back
* test/io/console/test_io_console.rb (test_getpass): ignore echo
  back of input from the master side.  some systems seem echo back
  but other may not.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09 07:46:47 +00:00
ngoto
d573666e62 * test/io/console/test_io_console.rb (run_pty): Avoid waiting twice
for a process. Fix Errno::ECHILD in TestIO_Console#test_close and
  TestIO_Console#test_sync.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08 14:33:29 +00:00