8243432: use reproducible random in :vmTestbase_vm_defmeth

Reviewed-by: dholmes
This commit is contained in:
Igor Ignatyev 2020-05-05 09:54:51 -07:00
parent 0b7a47665f
commit 2163dec6c4
3 changed files with 9 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -37,6 +37,7 @@ import vm.runtime.defmeth.shared.builder.TestBuilder;
import vm.share.options.Option;
import vm.share.options.OptionSupport;
import vm.share.options.Options;
import jdk.test.lib.Utils;
import static jdk.internal.org.objectweb.asm.Opcodes.*;
/*
@ -72,7 +73,7 @@ public class StressTest implements Runnable {
private Throwable reason;
private volatile long executedTests = 0;
public Worker(String id, int seed) {
public Worker(String id, long seed) {
setName(id);
this.rand = new Random(seed);
}
@ -215,7 +216,7 @@ public class StressTest implements Runnable {
private void startWorkers() {
Random rand;
if (seed == 0) {
seed = (new Random()).nextInt();
seed = Utils.SEED;
}
System.out.printf("Seed: %d\n", seed);
@ -247,7 +248,7 @@ public class StressTest implements Runnable {
for (int i = 0; i < workers.length; i++) {
workers[i] = new Worker(
String.format("Worker #%d/%d", i+1, workers.length),
rand.nextInt());
rand.nextLong());
}
for (Worker worker : workers) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
/*
* @test
* @key randomness
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
*
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Stress_noredefine.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
/*
* @test
* @key randomness
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
*
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Stress_redefine.