[#97063] [Ruby master Bug#16608] ConditionVariable#wait should return false when timeout exceeded — shugo@...

Issue #16608 has been reported by shugo (Shugo Maeda).

10 messages 2020/02/05

[#97084] [Ruby master Feature#16614] New method cache mechanism for Guild — ko1@...

Issue #16614 has been reported by ko1 (Koichi Sasada).

18 messages 2020/02/07

[#97248] [Ruby master Bug#16651] Extensions Do Not Compile on Mingw64 — cfis@...

Issue #16651 has been reported by cfis (Charlie Savage).

17 messages 2020/02/24

[#97289] [Ruby master Bug#16658] `method__cache__clear` DTrace hook was dropped without replacement — v.ondruch@...

Issue #16658 has been reported by vo.x (Vit Ondruch).

9 messages 2020/02/27

[#97307] [Ruby master Feature#16663] Add block or filtered forms of Kernel#caller to allow early bail-out — headius@...

Issue #16663 has been reported by headius (Charles Nutter).

29 messages 2020/02/28

[#97310] [Ruby master Feature#16665] Add an Array#except_index method — alexandr1golubenko@...

Issue #16665 has been reported by alex_golubenko (Alex Golubenko).

12 messages 2020/02/29

[ruby-core:97272] [Ruby master Feature#16655] Each test on test-all should run `srand(seed)` at setup

From: ko1@...
Date: 2020-02-26 17:23:26 UTC
List: ruby-core #97272
Issue #16655 has been reported by ko1 (Koichi Sasada).

----------------------------------------
Feature #16655: Each test on test-all should run `srand(seed)` at setup
https://bugs.ruby-lang.org/issues/16655

* Author: ko1 (Koichi Sasada)
* Status: Open
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
* Target version: 2.8
----------------------------------------
# Points

* call `srand($seed)` before each test. `$seed` is given seed number by `--seed N`

# Background

Some tests use `rand()` to produce random number to generate random test examples.

Example: 

```
  def test_local_variable_set_wb
    assert_ruby_status([], <<-'end;', '[Bug #13605]', timeout: 30)
      b = binding
      n = 20_000

      n.times do |i|
        v = rand(2_000)
        name = "n#{v}"
        value = Object.new
        b.local_variable_set name, value
      end
    end;
  end
```

This test generates 2,000 randomly named ivar which point random numbers.

However, several tests calls `srand(0)` and this random sequence is affected by test methods order.

Two problems:

* Test authors of this kind of tests should assume that every test processes uses very different random sequence to increase the test coverage.
* We can not get reproducible results on such tests which use random sequence with `--seed` because of `srand(0)` using tests.

# Proposal

To solve the above two problems, I`ll insert `srand($seed)` at the beginning of each test (`$seed` is given by `--seed` option).
This proposal respects `--seed` option more, so we can expect more deterministic results.

I measured performance overhead and I can't get meaningful slow down.

# Additional note

Surprisingly, `--seed` option is ignored just now on test-all, so I'll fix this problem too.




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next