summaryrefslogtreecommitdiff
path: root/test/lib/test
AgeCommit message (Collapse)Author
2019-07-02Move to tool/lib from test/lib.Hiroshi SHIBATA
2019-07-01Return the result of the block given to assert_warning/assert_no_warningNobuyoshi Nakada
2019-06-22Show timed out threadsNobuyoshi Nakada
* test/lib/test/unit/assertions.rb (assert_join_threads): kill and show timed out threads.
2019-06-14Use Exception#full_message for tracebackNobuyoshi Nakada
2019-06-13test/lib/test/unit/assertions.rb (assert_cpu_usage_low): tweak the waitYusuke Endoh
It still fails randomly. https://rubyci.org/logs/rubyci.s3.amazonaws.com/amazon2/ruby-master/log/20190613T093003Z.fail.html.gz https://rubyci.org/logs/mswinci.japaneast.cloudapp.azure.com/vc12-x64/ruby-master/log/20190613T051547Z.fail.html.gz
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-06-11MIN_HZ and MIN_MEASURABLE constantsNobuyoshi Nakada
* test/lib/test/unit/assertions.rb (Test::Unit::Assertions): promoted MIN_HZ and MIN_MEASURABLE as constants, which should be constant through the process.
2019-06-11Generalize timeout_scaleNobuyoshi Nakada
* test/lib/test/unit.rb (Test::Unit::TimeoutOption): renamed SubprocessOption. * test/lib/test/unit.rb (Test::Unit::TimeoutOption#setup_options): prefer `--timeout-scale` option. * test/lib/test/unit.rb (Test::Unit::TimeoutOption#non_options): prefer `ENV["RUBY_TEST_TIMEOUT_SCALE"]`.
2019-06-11test/lib/test/unit/assertions.rb (assert_cpu_usage_low): Relax the limitYusuke Endoh
CPU usage 1% causes occesional test failure. Try to use 5%. https://rubyci.org/logs/rubyci.s3.amazonaws.com/gentoo/ruby-master/log/20190604T153002Z.fail.html.gz https://rubyci.org/logs/rubyci.s3.amazonaws.com/gentoo/ruby-master/log/20190610T153002Z.fail.html.gz
2019-06-07Report a sudden death of workersNobuyoshi Nakada
2019-06-04test/lib/test/unit.rb: use colorize.rbNobuyoshi Nakada
2019-04-29Make only `mesg` can be assigned with default `fname`Nobuyoshi Nakada
2019-01-30Show the code in syntax assertionsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-27test/mkmf/test_flags.rb: try to suppress random CI failurek0kubun
on AIX ppc https://rubyci.org/logs/rubyci.s3.amazonaws.com/aix71_ppc/ruby-trunk/log/20181226T113305Z.fail.html.gz test/lib/test/unit/assertions.rb: ditto, for TestIO#test_copy_stream_no_busy_wait git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-15test/lib/test/unit.rb: do not propagate MAKEFLAGS to childrennormal
Propagating MAKEFLAGS to children running test/unit caused stuck tests with GNU make when "-jN" is passed in both the make(1) command-line and the "TESTS=" variable; because the forked child process would see MAKEFLAGS and try to use jobserver on its own. This is regression caused by r64399 (commit b53fadfd5f200dbd6fe9f4b2a91ebb68618e59bb, "process.c: defaults to close_others false"); but that change also fixed a regression when close-on-exec became the default in 2.0 :< git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-26parse.y: remove "shadowing outer local variable" warningmame
You can now write the following without warning. user = User.all.find {|user| cond(user) } Fixes [Feature #12490]. A patch from Soutaro Matsumoto <matsumoto@soutaro.com>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-26Revert "parse.y: remove "shadowing outer local variable" warning"mame
I forgot to add the copyright of the patch... git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-26parse.y: remove "shadowing outer local variable" warningmame
You can now write the following without warning. user = User.all.find {|user| cond(user) } Fixes [Feature #12490]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-23test/unit.rb: glob w/o prefix/suffixnobu
* test/lib/test/unit.rb (Test::Unit::GlobOption#non_options): glob the given pattern as-is under the TESTSDIR without the prefix nor the suffix, when it has separator(s) but does not end with a separator nor is not a directory. e.g.: make test-all TESTS='ruby/test_time*' runs `ruby/test_time.rb` and `ruby/test_time_tz.rb` only, like as the following: make test-all TESTS='$(TESTSDIR)/ruby/test_time*' git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-23test/unit.rb: fixed wrong method namenobu
* test/lib/test/unit.rb (Test::Unit::Parallel#deal): fixed wrong method name at r36388. * test/testunit/test_parallel.rb (TestParallel::TestParallel#test_separate): refine the pattern to process IDs but not backtrace lines, and add a better message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65329 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
2018-09-24test/unit.rb: fix --subprocess-timeout-scalenobu
* test/lib/test/unit.rb (Test::Unit::SubprocessOption#non_options): set timeout scale after parsing options. the option value will be set after returning from setup_options. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-16Propagate subprocess timeout scale option to worker processesnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-31test/lib/test/unit/assertions.rb: explicit delegation of keyword argumentsmame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-16process.c: defaults to close_others falsenormal
Arbitrarily closing file descriptors on exec breaks use cases where a Ruby process sets up a descriptor for non-Ruby children to use. For example, the "rake foo" target may spawn any number of subprocesses (Ruby or not) which depends on parsing the "FOO" environment variable for out_fd:99 and writing to foo.out FOO=out_fd:99 rake foo 99>>foo.out Unfortunately, this introduced one incompatibility in test/lib/test/unit.rb and it now requires explicitly setting IO#close_on_exec=true [ruby-core:88007] [Misc #14907] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-29test/lib/test/unit/assertions.rb (assert_in_out_err): disable gemsnormal
RubyGems loading is still a bottleneck at startup and this speeds up test/ruby/test_rubyoptions.rb test from 15s => 3.5s on the fastest machine I have access to. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-12assertions.rb: parenthesesnobu
* test/lib/test/unit/assertions.rb (assert_not_all): fix missing parentheses. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-06Removed redundant private declaration.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12Capture the values of globals in EnvUtil to restore to the originaleregon
* Avoids the thread-safety issues mentioned in r61192, when thread concurrently modify default Encodings or $VERBOSE. Their state will always be the original one once the test finishes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12Revert r61192 and r61193eregon
* More general fix coming. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12Do not change Encoding.default_internal in assert_raise_with_messageeregon
* It is not thread-safe: if two threads call it concurrently, the default_internal Encoding might not be restored, which causes many problems. The same applies for $VERBOSE, which might also not be restored to its original value but to the new value instead. This happens because reading the original value might capture the value already changed by EnvUtil.with_default_internal in another Thread. One solution could be to capture the value of these globals before running the test. * Reverts part of r54522. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-02assertions.rb: fix return in assert_raisenobu
* test/lib/test/unit/assertions.rb (assert_raise): should fail if returned gently in the given block without any exceptions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21Use caller with length to reduce unused stringskazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-08Remove unnecessary `require 'thread'`kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-01assertions.rb: AllFailures#message encodingnobu
* test/lib/test/unit/assertions.rb (AllFailures#message): put indented messages back to the original encoding, to get rid of Encoding::CompatibilityError when key has non-ASCII characters. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-16assertions.rb: frozen string buffernobu
* test/lib/test/unit/assertions.rb (assert_pattern_list): make frozen string literals modifiable as buffers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-08assertions.rb: syntax_check for other implnobu
* test/lib/test/unit/assertions.rb (syntax_check): use eval instead of RubyVM::InstructionSequence.compile so that other implementations can share the tests. [ruby-core:81935] [Bug #13723] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-22catch up frozen_string_literal: true.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-20Specify frozen_string_literal: true.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-18test/unit.rb: close jobservernobu
* test/lib/test/unit.rb (Test::Unit::Parallel#flush_job_tokens): close jobserver auth fds aflter flush, not to release tokens more than acquired. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-03test: attempt to reduce failures in assert_cpu_usage_lownormal
Try to make this test less fragile by taking into account the worst case kernel timing resolution. [ruby-core:81540] * test/lib/test/unit/assertions.rb (assert_cpu_usage_low): clamp measurement to minimum measurable time and warn about tests being too short to measure * test/ruby/test_io.rb (test_copy_stream_no_busy_wait): remove pct kwarg and rely on assert_cpu_usage_low defaults git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-28tests: increase CPU percentage threshold for assert_cpu_usage_lownormal
When sleeping for the tick rate of 100ms (defined in thread_pthread.c) as we do in test/ruby/test_io.rb (test_copy_stream_no_busy_wait), it may not be possible to measure with <= 10ms resolution on 100HZ systems (CONFIG_HZ in the Linux kernel). So increase the threshold to 15ms (10ms + 5ms slack for slow systems). * test/lib/test/unit/assertions.rb (assert_cpu_usage_low): increase pct default value [ruby-core:81427] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27test for IO.copy_stream CPU usage (r58534)normal
I'm likely to make similar mistakes in the future when working on Fiber auto-scheduling. Start adding assertions for existing code, first. * test/ruby/test_io.rb (test_copy_stream_no_busy_wait): added * test/lib/test/unit/assertions.rb (assert_cpu_usage_low): added git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-24assertions.rb: AllFailures#foreachnobu
* test/lib/test/unit/assertions.rb (AllFailures#foreach): shortcircuit for `each` and `AllFailures#for`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-16test/unit.rb: fix returning job tokensnobu
* test/lib/test/unit.rb (_run_parallel): flush job tokens after quitting workers when normally finished too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-16fix wordsnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-23Add diagnostic reports section header [ci skip]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-23assert_syntax_error returns the exception [ci skip]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-09thread.c: refine stream closed messagenobu
* thread.c (Init_Thread): [EXPERIMENTAL] refine the "stream closed" special exception message, by explicating that it is caused by threading. [ruby-core:80583] [Bug #13405] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-09test/unit.rb: no jobserver in workersnobu
* test/lib/test/unit.rb (Test::Unit::Parallel#process_args): worker processes do not access job server. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e