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

112 Коммитов

Автор SHA1 Сообщение Дата
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)

https://github.com/ruby/ruby/actions/runs/6807729617/job/18511055636#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
Nobuyoshi Nakada 93e87c0217 Fix the case of multiple trailers 2022-11-28 16:30:40 +09:00
Nobuyoshi Nakada 5a171ee4c0 Add tests for sync_default_gems.rb 2022-11-28 16:30:40 +09:00
Nobuyoshi Nakada d903e76726 Allow strings in assert_pattern_list 2022-08-19 01:28:31 +09:00
Nobuyoshi Nakada 7c1ed47097
Add tests for assert_pattern_list 2022-08-18 23:38:56 +09:00
Nobuyoshi Nakada 56b45e8c8e Let testunit use omit or pend instead of skip 2022-01-16 21:35:09 +09:00
Takashi Kokubun 1a63468831
Prepare for removing RubyVM::JIT (#5262) 2021-12-13 23:07:46 -08:00
Nobuyoshi Nakada cc33d07f46
Disable experimental warnings in test/runner.rb 2021-11-10 17:42:09 +09:00
Samuel Williams 81d0ce7e97 Mark IO::Buffer as experimental. 2021-11-10 19:21:05 +13:00
Nobuyoshi Nakada c7eac1be51
Retry hung up tests verbosely 2021-10-17 22:40:31 +09:00
Nobuyoshi Nakada 13716898df Retry hung tests after parallel runs 2021-10-17 16:33:58 +09:00