Commit graph

122 commits

Author SHA1 Message Date
Nobuyoshi Nakada
b066260296 Follow up testunit
* Update method names.
* Sort shuffled tests by names.
2025-06-18 01:46:58 +09:00
Nobuyoshi Nakada
1a527929a5 Revert "Temporary pend unknown behavior of parallel tests"
This reverts commit 980f61935f, which
seems no longer needed.
2025-06-18 01:46:58 +09:00
Yusuke Endoh
fc26004660 Remove test_retry_workers
The test fails randomly for unknown reason.

3956294509
```
    1) Error:
  TestParallel::TestParallel#test_retry_workers:
  Test::Unit::ProxyError: execution expired (start: 2025-03-28 04:04:10 +0000, end: 2025-03-28 04:05:50 +0000)
      /home/runner/work/ruby/ruby/src/tool/test/testunit/test_parallel.rb:16:in 'TestParallel.timeout'
      /home/runner/work/ruby/ruby/src/tool/test/testunit/test_parallel.rb:225:in 'TestParallel::TestParallel#test_retry_workers'
```

Maybe the workers do not respond "quit" request.

We no longer use the retry mechanism, so just remove the test.
2025-03-28 14:19:33 +09:00
Yusuke Endoh
28c7ae6626 Try avoiding "invalid byte sequence in UTF-8" 2025-03-28 14:19:33 +09:00
Yusuke Endoh
12f8dda9e0 Report the actual time wated for timeout errors in TestParallel 2025-03-28 14:19:33 +09:00
Naoto Ono
2dff416ff2
Increase timeout in TestParallel testing to reduce flaky failures (#12822)
Currently, the following tests are flaky and failing intermittently, so I'm going to increase the timeout to improve stability.

```  
    1) Failure:
  TestParallel::TestParallel#test_hungup [/Users/runner/work/ruby/ruby/src/tool/lib/zombie_hunter.rb:6]:
  Expected [[42009, #<Process::Status: pid 42009 SIGKILL (signal 9)>]] to be empty.
  
    2) Error:
  TestParallel::TestParallel#test_hungup:
  Test::Unit::ProxyError: execution expired
      /Users/runner/work/ruby/ruby/src/lib/timeout.rb:40:in 'Timeout::Error.handle_timeout'
      /Users/runner/work/ruby/ruby/src/lib/timeout.rb:194:in 'Timeout.timeout'
      /Users/runner/work/ruby/ruby/src/tool/test/testunit/test_parallel.rb:210:in 'TestParallel::TestParallel#test_hungup'

```
3790150623 (step):14:105

```
    1) Error:
  TestParallel::TestParallel#test_retry_workers:
  Test::Unit::ProxyError: execution expired
      /Users/runner/work/ruby/ruby/src/lib/timeout.rb:40:in 'Timeout::Error.handle_timeout'
      /Users/runner/work/ruby/ruby/src/lib/timeout.rb:194:in 'Timeout.timeout'
      /Users/runner/work/ruby/ruby/src/tool/test/testunit/test_parallel.rb:217:in 'TestParallel::TestParallel#test_retry_workers'
```
3789904158 (step):14:106
2025-02-27 07:55:54 +00:00
Naoto Ono
48b6c60969
[Misc #20661] Stop retrying tests in make test-all command by default (#11271)
[Misc #20661] Stop retrying tests in make test-all command by default
2025-02-27 06:12:02 +00:00
Nobuyoshi Nakada
4a67ef09cc
[Feature #21116] Extract RJIT as a third-party gem 2025-02-13 18:01:03 +09:00
Nobuyoshi Nakada
c51668d249
Add Test::Unit::CoreAssertions#assert_raise_kind_of
Similar to `Test::Unit::assert_raise`, but allows sub classes too.
2025-01-24 15:51:28 +09:00
Nobuyoshi Nakada
ae94fca788
Add test for Test::Unit::CoreAssertions#assert_raise_with_message 2025-01-24 15:53:08 +09:00
Peter Zhu
7eeabccf4c Fix TestParallel#test_hungup when RUBY_TEST_TIMEOUT_SCALE is set
When RUBY_TEST_TIMEOUT_SCALE is set, the timeout increases by the multiple
specified. However, the test in test4test_hungup.rb does not scale, so
if RUBY_TEST_TIMEOUT_SCALE is a large number like 10, then the test will
not time out causing the tests test to fail.
2024-10-29 15:34:58 +09:00
Nobuyoshi Nakada
fcb058309b Accept version range
Single `Integer` argument means an exact match to the major version.
2024-09-12 23:47:34 +09:00
Yusuke Endoh
062f85e141 Dump all-thread backtraces when test parallel worker exceeds time limit 2024-08-06 21:11:41 +09:00
Hiroshi SHIBATA
9a5e3a4007 Removed WEBrick and that tests
We can handle uri, time and others without `make test-all` dependencies now.
2024-07-11 09:23:16 +09:00
Naoto Ono
8ede84aa95 Move the file location of launchable.rb 2024-07-08 10:15:04 +09:00
Naoto Ono
5b78925455 Integrate Launchable into make btest 2024-07-08 10:15:04 +09:00
Nobuyoshi Nakada
aabe718e64
Show the caller location of assertion methods
Not only defined in `Test::Unit` or `CoreAssertions`, also show the
caller location of assertion methods defined in the current class or
ancestors.
2024-05-08 17:24:36 +09:00
Koichi Sasada
9180e33ca3 show warning for unused block
With verbopse mode (-w), the interpreter shows a warning if
a block is passed to a method which does not use the given block.

Warning on:

* the invoked method is written in C
* the invoked method is not `initialize`
* not invoked with `super`
* the first time on the call-site with the invoked method
  (`obj.foo{}` will be warned once if `foo` is same method)

[Feature #15554]

`Primitive.attr! :use_block` is introduced to declare that primitive
functions (written in C) will use passed block.

For minitest, test needs some tweak, so use
ea9caafc07
for `test-bundled-gems`.
2024-04-15 12:08:07 +09:00
Naoto Ono
56ecd8038a Launchable: Add lineNumber field 2024-04-03 16:17:30 +09:00
Naoto Ono
3d1d1435c1 Launchable: Refactor the logic of JsonStreamWriter 2024-04-02 21:55:32 +09:00
KJ Tsanaktsidis
75234beb24 Make TestParallel#test_retry_workers consider RUBY_TEST_TIMEOUT_SCALE
This test currently fails if RUBY_TEST_TIMEOUT_SCALE is set, because the
worker timeout is scaled out but the duration of the sleep does not;
thus, the test-test-case does not timeout when it should.
2024-03-28 09:48:53 +11:00
Jean Boussier
09d8c99cdc Ensure test suite is compatible with --frozen-string-literal
As preparation for https://bugs.ruby-lang.org/issues/20205
making sure the test suite is compatible with frozen string
literals is making things easier.
2024-03-14 17:56:15 +01:00
KJ Tsanaktsidis
dc532b7c4e Fix WEBrick::TestFileHandler#test_short_filename test not working
The test is currently skipped and can't possibly work on windows at the
moment. It fails because $LOAD_PATH is not set up properly in the forked
CGI process, so `require 'uri'` fails.

This works properly in the test_cgi.rb tests, because it sets up a
:RequestCallback to fix things up. Let's move the setup there into
util.rb, so it can be shared with test_filehandler.rb as well.
2023-12-27 12:54:25 +11:00
Sorah Fukumori
fac2536776
Test_SyncDefaultGems: Fail when editor run (#9365)
When something went wrong and git launches editor, and a editor chosen
was terminal-based, a test run unnoticeably hangs.

As we intend editors not to be ran with --no-edit, GIT_EDITOR should be
defaulted to `false` so let Git command fails when it attempts to start a
editor. This allows catching such unintentional behaviour in test suite.

(Note: Prior to Git v2.32.0, git cherry-pick --no-edit doesn't work for
conflict resolution so currently the test hangs when older Git is in use.
39edfd5cbc
i.e. Ubuntu 20.04, Debian Bullseye doesn't satisfy this prerequisite.)
2023-12-26 21:43:23 +00:00
Nobuyoshi Nakada
7cbc08b388 Follow removed conflict files
After editing a conflict, continue without removed files.
2023-12-15 22:37:38 +09:00
Yusuke Endoh
5bf75c20a2 Refactor the settings of test-all out
test/runner.rb and tool/lib/test/unit/parallel.rb must use the same
settings. However, some settings were copied and pasted, while some were
added only to test/runner.rb.
This changeset creates tool/test/init.rb for all settings of test-unit,
which is loaded not only by test/runner.rb but also
tool/lib/test/unit/parallel.rb.

Background: the GEM_HOME environment variable was removed in
test/runner.rb, which prohibit `require "rake"` (note that rake is a
bundled gem). However the parallel mode didn't refrect this setting,
i.e., `require "rake"` was allowed.
This leads to an inconsistency, which actually affected a test test
defines s test class *only when* `require "rake"` is successful.
(test/rubygems/test_gem_package_task.rb)

1851105563 (step):8:1714
```
  /home/runner/work/ruby/ruby/src/tool/lib/test/unit.rb:729:in `const_get': uninitialized constant TestGemPackageTask (NameError)

                suites.map! {|r| ::Object.const_get(r[:testcase])}
                                         ^^^^^^^^^^
```
2023-11-15 19:27:10 +09:00
Nobuyoshi Nakada
304194d73e Remove files which are newly added but to be ignored 2023-11-07 10:45:02 +09:00
Hiroshi SHIBATA
634e0ac140 Fix test failure with __runner_options__ renaming 2023-10-26 12:39:13 +09:00
lukeg
7717684d16 tool test/unit/testcase: rename vars @passed, @@current
to @__passed__, @@__current__.
@passed is redefined in a few test suites, and this could lead to bugs.

Also rename @options (Runner#options) to @__runner_options__, which is
only used in make test-tool anyway.
2023-10-26 12:39:13 +09:00
Nobuyoshi Nakada
4f4016497e
Handle Timeout::Error reported from workers 2023-10-18 23:41:23 +09:00
Nobuyoshi Nakada
776d4dec69 Manage parallel test workers after timeout 2023-10-18 02:55:42 +09:00
Nobuyoshi Nakada
8b520bd3fb Add jobs optional keyword argument 2023-10-18 02:55:42 +09:00
Nobuyoshi Nakada
94bcae1b2a
Special treat when the first line ends with a dot [ci skip] 2023-10-04 19:27:34 +09:00
Nobuyoshi Nakada
3c11cdbcfe Fix the case of file to be ignored with to be removed
The case of 7fc73ab5f6, which modified
`.gitignore` and `.github/workflows/main.yml`.  Both files need to be
rejected and restored, but since the latter file was not there before,
`git checkout` failed and the former file could not be restored along
with it.  To fix this failure, restore the ignored files one by one.
2023-09-20 13:00:18 +09:00
Nobuyoshi Nakada
afaa164a05 Add a successful sync test case 2023-09-20 13:00:18 +09:00
Nobuyoshi Nakada
88262875fd
Fix git cat-file condition
When multiple files changed in the same directory to be removed, the
first file only was removed from changed set.
2023-09-18 02:23:59 +09:00
Nobuyoshi Nakada
8d219a9bd7
Refactor test_sync_default_gems.rb 2023-09-18 02:11:48 +09:00
Nobuyoshi Nakada
00439dbdb4
sync_default_gems.rb: convert keys of REPOSITORIES to strings
Referencing always after conversion to a symbol, and yielded gem name
is always converted to a string.
2023-08-28 17:52:50 +09:00
Nobuyoshi Nakada
eb221a3734
Prohibit copying to fixtures and dot-direcotry just under test
Do not add directories which would let chkbuild fires accidentally, to
just under `test`.  The "fixtures" directory is often used to place
test stuffs.
2023-08-13 15:30:58 +09:00
Nobuyoshi Nakada
3651f985f0
Exclude files added to the toplevel 2023-08-06 09:26:20 +09:00
Nobuyoshi Nakada
628cc7e12d
Change HOME too when testing sync_default_gems.rb
As well as `GIT_CONFIG_GLOBAL`, which is supported since git 2.32.
2023-07-29 20:02:47 +09:00
Nobuyoshi Nakada
4b91d6abb9
Revert "Test sync_default_gems.rb only when git 2.32 is available"
This reverts commit b0f44cfa5d.
2023-07-29 20:02:13 +09:00
Nobuyoshi Nakada
b0f44cfa5d
Test sync_default_gems.rb only when git 2.32 is available
With older git, as `GIT_CONFIG_GLOBAL` environment variable is not
supported, these tests clobber user's configurations.
2023-07-29 11:49:53 +09:00
Nobuyoshi Nakada
4589056384 Exit with a failure if any test files failed to load 2023-06-03 20:22:10 +09:00
Nobuyoshi Nakada
35da0d4a6e
Support older git
The -b flag is available since 2.28, but Ubuntu 20.04 uses 2.25.
2023-04-28 18:29:31 +09:00
Nobuyoshi Nakada
6b05f125bb Skip commits only for tools
Get rid of accidents like 67feb782f9.
2023-03-28 17:17:51 +09:00
Takashi Kokubun
2e875549a9 s/MJIT/RJIT/ 2023-03-06 23:44:01 -08:00
Nobuyoshi Nakada
6b46057e5c
Expand the test directory to real path
When the test source directory path contains symbolic links, that
directory might be placed earlier in the result of
`IRB::InputCompletor.retrieve_gem_and_system_load_path`, than other
directories in the source tree that are expanded to the real path.  In
that case, the test file in "csv" under the test directory of csv gem
instead of the library path will be the first candidate, in
`TestIRB::TestCompletion#test_complete_require_library_name_first`.

```
<"'csv"> expected but was
<"'csv/helper">.
```
2023-03-03 15:30:02 +09:00
Nobuyoshi Nakada
398aaed2f0
Fix the case trailer without newline
cf0b413ef8
2022-12-22 00:34:21 +09:00
Nobuyoshi Nakada
d752cf7601 Use class methods of File over Kernel.open and IO.read 2022-12-01 02:28:49 +09:00