summaryrefslogtreecommitdiff
path: root/test/ruby/test_io.rb
AgeCommit message (Collapse)Author
2021-01-13Rename RubyVM::MJIT to RubyVM::JITTakashi Kokubun
because the name "MJIT" is an internal code name, it's inconsistent with --jit while they are related to each other, and I want to discourage future JIT implementation-specific (e.g. MJIT-specific) APIs by this rename. [Feature #17490]
2020-12-18Use category: :deprecated in warnings that are related to deprecationJeremy Evans
Also document that both :deprecated and :experimental are supported :category option values. The locations where warnings were marked as deprecation warnings was previously reviewed by shyouhei. Comment a couple locations where deprecation warnings should probably be used but are not currently used because deprecation warning enablement has not occurred at the time they are called (RUBY_FREE_MIN, RUBY_HEAP_MIN_SLOTS, -K). Add assert_deprecated_warn to test assertions. Use this to simplify some tests, and fix failing tests after marking some warnings with deprecated category. Notes: Merged: https://github.com/ruby/ruby/pull/3917
2020-12-04Guard all accesses to RubyVM::MJIT with defined?(RubyVM::MJIT) &&Benoit Daloze
* Otherwise those tests, etc cannot run on alternative Ruby implementations.
2020-12-03test/ruby/test_io.rb: some test methods had been overwrittenYusuke Endoh
http://rubyci.s3.amazonaws.com/ubuntu/ruby-master/log/20201203T123002Z.log.html.gz ``` /home/chkbuild/chkbuild/tmp/build/20201203T123002Z/ruby/test/ruby/test_io.rb:1830: warning: method redefined; discarding old test_each_byte /home/chkbuild/chkbuild/tmp/build/20201203T123002Z/ruby/test/ruby/test_io.rb:376: warning: previous definition of test_each_byte was here test/unit warning: method TestIO#test_each_byte is redefined /home/chkbuild/chkbuild/tmp/build/20201203T123002Z/ruby/test/ruby/test_io.rb:1849: warning: method redefined; discarding old test_each_char /home/chkbuild/chkbuild/tmp/build/20201203T123002Z/ruby/test/ruby/test_io.rb:1799: warning: previous definition of test_each_char was here test/unit warning: method TestIO#test_each_char is redefined ```
2020-12-03delete deprecated IO-like methods卜部昌平
This commit deletes {IO,ARGF,StringIO,Zib::GZipReader}#{bytes,chars,lines,codepoints}, which have been deprecated since c47c095b9740e7c19d6fdca29ab661c1089221d4. Note that String also has those methods. They are neither depreacted nor deleted because they are not aliases of counterpart each_something.
2020-09-27Revert the first diff of "Use Tempfile.create instead of Tempfile.open in ↵Benoit Daloze
test_io.rb" * This partially reverts commit dead7478748a828c45e16134fca812bc7771344e. * Windows will not allow a file to be unlinked if any file handles exist, see https://github.com/ruby/ruby/pull/3597
2020-09-26Use Tempfile.create instead of Tempfile.open in test_io.rbBenoit Daloze
2020-09-25Disable deprecation warning by the default [Feature #16345]Nobuyoshi Nakada
And `-w` option turns it on. Notes: Merged: https://github.com/ruby/ruby/pull/3481
2020-09-09Revert the related commits about `Tempfile.open` change.Hiroshi SHIBATA
Start with https://github.com/ruby/ruby/commit/fa21985a7a2f8f52a8bd82bd12a724e9dca74934 to https://github.com/ruby/ruby/commit/d7492a0be885ea9f2b9f71e3e95582f9a859c439
2020-08-29Simplify Tempfile.open calls with a block as they now unlink the file ↵Benoit Daloze
automatically
2020-08-27[stringio] fix stringio codepoint enumerator off by one errorYoann Lecuyer
Notes: Merged: https://github.com/ruby/ruby/pull/3460
2020-08-17Ensure the shortcut cached in the classNobuyoshi Nakada
As well as the other places using RCLASS_IV_INDEX_TBL. `IO#reopen` seems the only case that the class of an object can be changed.
2020-05-07Suffixed memory leak tests as "memory_leak"Nobuyoshi Nakada
So that `TEST_EXCLUDES` option in common.mk works.
2020-04-11Silence broken pipe error messages on STDOUT [Feature #14413]Nobuyoshi Nakada
Raise `SignalException` for SIGPIPE to abort when EPIPE occurs. Notes: Merged: https://github.com/ruby/ruby/pull/3013 Merged-By: nobu <nobu@ruby-lang.org>
2020-03-27Set external encoding correctly for File.open('f', FILE::BINARY) on WindowsJeremy Evans
Previously, the external encoding was only set correctly for File::BINARY if keyword arguments were provided. This copies the logic for the keyword arguments case to the no keyword arguments case. Possibly it should be refactored into a separate function. Fixes [Bug #16737] Notes: Merged: https://github.com/ruby/ruby/pull/2985
2020-03-02Revert "show debug info."Koichi Sasada
This reverts commit 0bfee2397ba59112902d2b49f08461db3a637b46.
2020-03-02show debug info.Koichi Sasada
https://gist.github.com/ko1/a71f7cbcfbd61ba004bffdfedab9f5f2#file-brlog-trunk-random0-20200302-020213-L2127
2020-02-23Warn non-nil `$\` [Feature #14240]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/2920
2020-02-23Warn non-nil `$,` in `IO#print` tooNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/2920
2020-01-02Update tests for full keyword argument separationJeremy Evans
Notes: Merged: https://github.com/ruby/ruby/pull/2794
2019-12-23Reword keyword arguments warning messages to convey these are deprecation ↵Marc-Andre Lafortune
warnings
2019-12-20vm_args.c: rephrase the warning message of keyword argument separationYusuke Endoh
(old) test.rb:4: warning: The last argument is used as the keyword parameter test.rb:1: warning: for `foo' defined here; maybe ** should be added to the call? (new) test.rb:4: warning: The last argument is used as keyword parameters; maybe ** should be added to the call test.rb:1: warning: The called method `foo' is defined here
2019-11-18Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans
This removes the related tests, and puts the related specs behind version guards. This affects all code in lib, including some libraries that may want to support older versions of Ruby. Notes: Merged: https://github.com/ruby/ruby/pull/2476
2019-09-30test/ruby/test_io.rb: supress a "method redefined" warningYusuke Endoh
by explicitly removing the old definition.
2019-09-27Kernel#open may be redefinedNobuyoshi Nakada
2019-09-26Fix keyword argument sepration issues when IO#open calls #to_openJeremy Evans
Notes: Merged: https://github.com/ruby/ruby/pull/2484
2019-09-25Make rb_scan_args handle keywords more similar to Ruby methods (#2460)Jeremy Evans
Cfuncs that use rb_scan_args with the : entry suffer similar keyword argument separation issues that Ruby methods suffer if the cfuncs accept optional or variable arguments. This makes the following changes to : handling. * Treats as **kw, prompting keyword argument separation warnings if called with a positional hash. * Do not look for an option hash if empty keywords are provided. For backwards compatibility, treat an empty keyword splat as a empty mandatory positional hash argument, but emit a a warning, as this behavior will be removed in Ruby 3. The argument number check needs to be moved lower so it can correctly handle an empty positional argument being added. * If the last argument is nil and it is necessary to treat it as an option hash in order to make sure all arguments are processed, continue to treat the last argument as the option hash. Emit a warning in this case, as this behavior will be removed in Ruby 3. * If splitting the keyword hash into two hashes, issue a warning, as we will not be splitting hashes in Ruby 3. * If the keyword argument is required to fill a mandatory positional argument, continue to do so, but emit a warning as this behavior will be going away in Ruby 3. * If keyword arguments are provided and the last argument is not a hash, that indicates something wrong. This can happen if a cfunc is calling rb_scan_args multiple times, and providing arguments that were not passed to it from Ruby. Callers need to switch to the new rb_scan_args_kw function, which allows passing of whether keywords were provided. This commit fixes all warnings caused by the changes above. It switches some function calls to *_kw versions with appropriate kw_splat flags. If delegating arguments, RB_PASS_CALLED_KEYWORDS is used. If creating new arguments, RB_PASS_KEYWORDS is used if the last argument is a hash to be treated as keywords. In open_key_args in io.c, use rb_scan_args_kw. In this case, the arguments provided come from another C function, not Ruby. The last argument may or may not be a hash, so we can't set keyword argument mode. However, if it is a hash, we don't want to warn when treating it as keywords. In Ruby files, make sure to appropriately use keyword splats or literal keywords when calling Cfuncs that now issue keyword argument separation warnings through rb_scan_args. Also, make sure not to pass nil in place of an option hash. Work around Kernel#warn warnings due to problems in the Rubygems override of the method. There is an open pull request to fix these issues in Rubygems, but part of the Rubygems tests for their override fail on ruby-head due to rb_scan_args not recognizing empty keyword splats, which this commit fixes. Implementation wise, adding rb_scan_args_kw is kind of a pain, because rb_scan_args takes a variable number of arguments. In order to not duplicate all the code, the function internals need to be split into two functions taking a va_list, and to avoid passing in a ton of arguments, a single struct argument is used to handle the variables previously local to the function. Notes: Merged-By: jeremyevans <code@jeremyevans.net>
2019-09-19DEBUG: cxxanyargsNobuyoshi Nakada
2019-09-19DEBUGNobuyoshi Nakada
2019-09-03Examine TestIO#test_select_exceptfds on Solaris with 1 byte dataNaohisa Goto
On Solaris, it seems that the select(3C) in this test works only when sending 1 byte out-of-band data, though I cannot investigate the cause. The behavior is observed on a Solaris 10 server in addition to Solaris 11 on which the test had been skipped.
2019-08-30Fix keyword argument separation warnings in testJeremy Evans
Notes: Merged: https://github.com/ruby/ruby/pull/2395
2019-08-30Move pread + pwrite tests out of RUBY_ENGINE blockCharles Oliver Nutter
These tests were guarded by a RUBY_ENGINE of "ruby" even though they test an official Ruby feature (pread/pwrite added in Ruby 2.5). This commit moves them to the top level of the test case so they will run on other implementations. Notes: Merged: https://github.com/ruby/ruby/pull/2412
2019-08-01Compact ensure clause and rename variables to fix alignmentKazuhiro NISHIYAMA
2019-07-31test/ruby/test_io.rb (test_binmode_pipe): close all pipes explicitlyYusuke Endoh
to suppress the leak checker.
2019-07-30Do not change IO.pipe encodings if encodings explicitly givenJeremy Evans
This commit makes it so that if the binmode option is given with any encoding arguments, the reader and writer IO objects are not set to binary encoding. Fixes [Bug #12989]
2019-07-30Passing `binmode: true` to `IO.pipe` should behave like `binmode`Aaron Patterson
When passing `binmode: true` to `IO.pipe`, it should behave the same way as calling `binmode` on each of the file handles. It should set the file to binmode *and* set the encoding to binary on the file. Before this commit, passing `binmode: true` to `IO.pipe` would make `binmode?` return `true`, but the file's encoding would remain the same as the default encoding. Passing `binmode: true` should make `binmode?` return `true` *and* set the encoding to binary.
2019-07-30Separate test_set_lineno_getsNobuyoshi Nakada
2019-07-25Fix errno at seeking socket/pipe on WindowsNobuyoshi Nakada
[Bug #12230]
2019-07-11Check exception flag as a bool [Bug #15987]Nobuyoshi Nakada
2019-06-11assert_cpu_usage_low with timeout scaleNobuyoshi Nakada
* test/lib/test/unit/assertions.rb (assert_cpu_usage_low): apply the timeout scale to measuring period. this assertion is very runtime environment dependent.
2019-04-18io.c: warn non-nil $,nobu
* array.c (rb_ary_join_m): warn use of non-nil $,. * io.c (rb_output_fs_setter): warn when set to non-nil value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-07io.c: chomp CR at the end of read buffernobu
* io.c (rb_io_getline_fast): chomp CR followed by LF but separated by the read buffer boundary. [ruby-core:91707] [Bug #15642] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-21test_io.rb: skip test on MJIT to prevent random failurek0kubun
like this: http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/1636642 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-28test_io.rb: increase timeout for RubyCIk0kubun
to stabilize AIX powerpc CI https://rubyci.org/logs/rubyci.s3.amazonaws.com/aix71_ppc/ruby-trunk/log/20181227T113302Z.fail.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-30test/ruby/test_io.rb (test_recycled_fd_close): remove hacksnormal
I think I finally fixed the underlying bug in r65937 ("io.c (fptr_finalize_flush): close race leading to EBADF") I've run this test over 100000 times on a multicore system, now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-24io.c: wait on FD readability w/o GVL reacquisitionnormal
Since non-blocking I/O is the default after [Bug #14968], we will hit it more often and cause more acquisition/release of GVL to wait on single FD. This also lets us avoid touching the temporal string locking as much and lets us clean up some test changes made for [Bug #14968] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-22io + socket: make pipes and sockets nonblocking by defaultnormal
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-20Skip known MJIT random test failuresk0kubun
Let me silence this until I have time to work on them, and make the CI usable for testing other features. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-27test_io.rb: skip busy wait test againk0kubun
which I tried to avoid skipping this in r65311, but the test seems not working under some high load of ci.rvm.jp. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-23test/lib/test/unit/assertions.rb: skip memory leak checkk0kubun
for all test cases on MJIT. In addition to those 2 tests, TestAutoload#test_no_leak newly failed and most of assert_no_memory_leak usages are likely to randomly fail. Let me just skip all of them but let's revisit this to check it properly later. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e