Граф коммитов

106 Коммитов

Автор SHA1 Сообщение Дата
k0kubun 271c8f5d06 test_io_wait.rb: try to stabilize test_wait_readable
that randomly fails
https://rubyci.org/logs/mswinci.japaneast.cloudapp.azure.com/vc12-x64/ruby-trunk/log/20181231T103312Z.fail.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-31 12:54:40 +00: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 6a65f2b1e4 io + socket: make pipes and sockets nonblocking by default
All normal Ruby IO methods (IO#read, IO#gets, IO#write, ...) are
all capable of appearing to be "blocking" when presented with a
file description with the O_NONBLOCK flag set; so there is
little risk of incompatibility within Ruby-using programs.

The biggest compatibility risk is when spawning external
programs.  As a result, stdin, stdout, and stderr are now always
made blocking before exec-family calls.

This change will make an event-oriented MJIT usable if it is
waiting on pipes on POSIX_like platforms.

It is ALSO necessary to take advantage of (proposed lightweight
concurrency (aka "auto-Fiber") or any similar proposal for
network concurrency: https://bugs.ruby-lang.org/issues/13618

Named-pipe (FIFO) are NOT yet non-blocking by default since
they are rarely-used and may introduce compatibility problems
and extra syscall overhead for a common path.

Please revert this commit if there are problems and if I am afk
since I am afk a lot, lately.

[ruby-core:89950] [Bug #14968]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-22 08:46:51 +00:00
normal 32910b8781 test/io/wait/test_io_wait_uncommon.rb: relax /dev/random check
Too many machines lack entropy to have a usable /dev/random.  I
had similar problems on my system until I started using
haveged(8), but we can't require that for CI.

cf. https://rubyci.org/logs/rubyci.s3.amazonaws.com/debian/ruby-trunk/log/20180825T213003Z.fail.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-25 22:32:35 +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 15d7adf90e test/io/wait/test_io_wait_uncommon.rb (test_tty_wait): increase timeout
Apparently my tty can't keep up when I run test-all with
TESTS='-v --no-retry'

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-09 08:51:22 +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
normal f4e451ce4b test_io_wait_uncommon: new test for uncommon file types
This should make portability problems more apparent when we try
using ppoll with rb_wait_for_single_fd on FreeBSD or other
non-Linux platforms.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-15 00:08:33 +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
mame 8c59236674 Hide NotImplementedError for windows
440dc6b7e0 (commitcomment-24074203)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-05 08:15:54 +00:00
mame 440dc6b7e0 Improve line covearge of ext/io/nonblock/nonblock.c from 54.5% to 95.5%
Not so good test, but it would be better than nothing, I guess...

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-04 13:25:01 +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
odaira 8f5cbc589c * test/io/wait/test_io_wait.rb (test_wait_readwrite_timeout):
select(2) in AIX returns "readable" for the write-side fd
  of a pipe, so it is not possible to use a pipe to test
  the read-write timeout of IO#wait on AIX.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-09 00:28:41 +00:00
nobu 311b715483 test: use assert_not_*
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-19 07:45:58 +00:00
nobu b58fac9a97 wait readable/writable
* ext/io/wait/wait.c (io_wait_readwrite): [EXPERIMENTAL] allow to
  wait for multiple modes, readable and writable, at once.  the
  arguments may change in the future.  [Feature #12013]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-24 07:55:05 +00:00
nobu 5320f8846b test_io_wait.rb: wait_readable
* test/io/wait/test_io_wait.rb: add tests for IO#wait_readable,
  same as IO#wait.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-24 05:30:54 +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
nobu 8f620b9b17 retry IO#getpass
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08 13:26:56 +00:00
naruse 958e153cdb Revert r52902,r52903,r52910,r52911,r52937,r52939
Reject IO::Console#getpass because it can't test portablly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08 10:54:42 +00:00
nobu 9518406544 test_io_console.rb: separate master and slave
* test/io/console/test_io_console.rb (test_getpass): separate
  master side and slave side in each threads.  r52937 deadlocked
  on OS X.  [Bug #11780] [ruby-dev:49412]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08 05:12:15 +00:00
ngoto 14c46e5f1a * test/io/console/test_io_console.rb (test_getpass): s.getpass
should be tested. Narrow ensure block. This reverts r52911.
  [Bug #11780] [ruby-dev:49412]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08 04:03:53 +00:00
naruse b5c0ca497e temporally remove prompt to pass the test
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-07 03:11:53 +00:00
nobu 51cb462f42 test_io_console.rb: wait
* test/io/console/test_io_console.rb (test_getpass): wait slave
  thread.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-06 12:41:47 +00:00
nobu 187de9240a console.c: console_getpass
* ext/io/console/console.c (console_getpass): add IO#getpass
  method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-06 06:25:10 +00:00
normal d4fd2fb0a3 test/io/wait/test_io_wait.rb (test_wait_eof): test return value
I wrote some code which relies on this nowadays, but Ruby <=2.2
and earlier behaved differently...

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-22 22:25:19 +00:00
nobu beb1c085d5 use Timeout.timeout
* time: Object#timeout has been deprecated a long time ago, use
  Timeout.timeout.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-13 10:07:01 +00:00
nobu ae042f21fb use assert_raise
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-02 02:18:44 +00:00
nobu 7b14512bee test_io_wait.rb: no EOF test
* test/io/wait/test_io_wait.rb (test_wait_eof): just test
  timeout.  follow r50263.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-12 06:46:28 +00:00
normal 26e1ebdc1e io/wait: fix return value for buffered read
* ext/io/wait/wait.c (io_nread): wrap return value with INT2FIX
  Thanks to Yura Sokolov <funny.falcon@gmail.com>
  [ruby-core:68369] [Bug#10923]
* test/io/wait/test_io_wait.rb (test_nread_buffered):
  fix broken test

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-01 21:03:22 +00:00
akr 57b87a00f8 [DOC]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-11 15:58:40 +00:00
nobu 903046aa48 test_io_console.rb: different names
* test/io/console/test_io_console.rb (test_noctty): use different
  names for each tempfiles.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-28 00:24:47 +00:00
nobu 945e4692ca console.c: IO.console arguments passing
* ext/io/console/console.c (console_dev): send the given arguments
  to the opened console.  as a special case, do nothing if :close
  is given.
* test/lib/leakchecker.rb (LeakChecker#check_fd_leak): close if
  console.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-25 07:14:12 +00:00
nobu 913943270d test_io_console.rb: use gets
* test/io/console/test_io_console.rb (run_pty): pty cannot read
  all, should use gets only.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-25 06:17:49 +00:00
nobu d33a3837cb test_io_console.rb: chomp results
* test/io/console/test_io_console.rb (run_pty): IO#readlines
  ignores the given block.  need map to chomp the results.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-25 03:51:27 +00:00
usa c10d7640b2 * test/io/console/test_io_console.rb (TestIO_Console#run_pty): no block given.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-25 02:37:17 +00:00
nobu d8d326c97a console.c: get rid of NameError
* ext/io/console/console.c (console_dev): id_console is not a
  constant name, use rb_const_remove() to get rid of NameError.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-25 01:09:17 +00:00