RFR(M): 8044186 Introduce a reproducible random generator
David Chase
david.r.chase at oracle.com
Fri Sep 19 20:58:37 UTC 2014
I looked hard at Utils.java, that code looks fine.
A question about BMITestRunner.java — I see
76 int seed = Utils.getRandomInstance().nextInt();
…
146 "-D" + Utils.SEED_PROPERTY_NAME + "=" + seed,
But is it guaranteed that
(new Random(seed)).nextInt() == seed?
which is what I think this accomplishes?
I just checked, it seems not to be true, so this is not correct re-run advice.
Should Utils.java provide a method for obtaining the seed that was used
so it may be queried, also?
David (not a Reviewer)
On 2014-09-19, at 9:57 AM, Sergei Kovalev <sergei.kovalev at oracle.com> wrote:
> Hi All,
>
> I'm working for CR https://bugs.openjdk.java.net/browse/JDK-8044186 that submitted against tests.
>
> There's the several tests which use randomly generated numbers. It's needed to introduce a way that provide a common manner to reproduce the same random sequence, set seed.
>
> There are two possible way to provide seed value:
> - system property
> - command line arguments.
>
> I chose system property to provide seed value because it could be obtained in any part of code without additional effort. In case passing seed value as command line argument we have to introduce additional logic (and unwanted code) to pass this value in appropriate method.
>
> I introduced factory method getRandomInstance in the file Utility.java and make reference to this method in all applicable tests.
> There is other utility class: Verifier.java. It used in several other testcases from test/compiler/intrinsics/mathexact/ package. Therefore many files contains modifications only for jtreg annotations.
>
> I've tested all related tests locally. All tests passed and seed value printed to the logs.
>
> links:
> bug: https://bugs.openjdk.java.net/browse/JDK-8044186
> webrev: http://cr.openjdk.java.net/~vlivanov/kovalev/8044186/webrev.00/
>
> --
> With best regards,
> Sergei
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20140919/60860215/signature.asc>
More information about the hotspot-compiler-dev
mailing list