8243427: use reproducible random in :vmTestbase_vm_mlvm
Reviewed-by: thartmann
This commit is contained in:
parent
c37bd06081
commit
a0ed53b986
test/hotspot/jtreg/vmTestbase/vm/mlvm
anonloader
func
stress
meth
func/jdi/breakpoint
stress
share
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 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.misc
|
||||
*
|
||||
* @summary converted from VM Testbase vm/mlvm/anonloader/func/castToGrandparent.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 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.misc
|
||||
*
|
||||
* @summary converted from VM Testbase vm/mlvm/anonloader/func/classNameInStackTrace.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 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.misc java.base/jdk.internal.org.objectweb.asm
|
||||
*
|
||||
* @summary converted from VM Testbase vm/mlvm/anonloader/func/uniqueClassAndObject.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 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.misc
|
||||
*
|
||||
* @summary converted from VM Testbase vm/mlvm/anonloader/stress/byteMutation.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 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.misc
|
||||
*
|
||||
* @summary converted from VM Testbase vm/mlvm/anonloader/stress/oome/heap.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 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.misc
|
||||
*
|
||||
* @summary converted from VM Testbase vm/mlvm/anonloader/stress/randomBytecodes.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 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
|
||||
*
|
||||
* @summary converted from VM Testbase vm/mlvm/meth/func/jdi/breakpoint.
|
||||
* VM Testbase keywords: [feature_mlvm, nonconcurrent]
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 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
|
||||
*
|
||||
* @summary converted from VM Testbase vm/mlvm/meth/stress/gc/callSequencesDuringGC.
|
||||
* VM Testbase keywords: [feature_mlvm, nonconcurrent, quarantine]
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 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
|
||||
*
|
||||
* @summary converted from VM Testbase vm/mlvm/meth/stress/gc/createLotsOfMH.
|
||||
* VM Testbase keywords: [feature_mlvm, nonconcurrent]
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 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
|
||||
*
|
||||
* @summary converted from VM Testbase vm/mlvm/meth/stress/java/sequences.
|
||||
* VM Testbase keywords: [feature_mlvm, nonconcurrent, quarantine]
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 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 @@
|
||||
package vm.mlvm.share;
|
||||
|
||||
import java.util.Random;
|
||||
import jdk.test.lib.Utils;
|
||||
|
||||
import nsk.share.ArgumentParser;
|
||||
import nsk.share.Log;
|
||||
@ -69,11 +70,7 @@ public class Env {
|
||||
// RNG
|
||||
//
|
||||
|
||||
private static long _seed = new Random().nextLong();
|
||||
|
||||
public static void setRNGSeed(long seed) {
|
||||
_seed = seed;
|
||||
}
|
||||
private static long _seed = Utils.SEED;
|
||||
|
||||
private static volatile boolean _wasSeedPrinted = false;
|
||||
|
||||
@ -84,6 +81,8 @@ public class Env {
|
||||
if ( ! _wasSeedPrinted ) {
|
||||
_wasSeedPrinted = true;
|
||||
traceImportant("RNG seed = " + _seed + " (0x" + Long.toHexString(_seed) + ")");
|
||||
// ensure we also print out how to change seed
|
||||
Utils.getRandomInstance();
|
||||
}
|
||||
|
||||
long seed = _seed;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 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
|
||||
@ -89,9 +89,6 @@ public abstract class MlvmTest {
|
||||
+ "the specified exception class names separated with commas have to be caught for the test to pass")
|
||||
private List<Class<? extends Throwable>> requiredExceptionClasses = new ArrayList<>();
|
||||
|
||||
@Option(name = "seed", default_value = "0", description = "Initial random seed")
|
||||
private long _seed;
|
||||
|
||||
@Option(name = "runs", default_value = "1", description = "How many times the test should be re-run")
|
||||
private int runs = 1;
|
||||
|
||||
@ -140,13 +137,6 @@ public abstract class MlvmTest {
|
||||
return name;
|
||||
}
|
||||
|
||||
void initRNG() {
|
||||
if (_seed != 0) {
|
||||
Env.setRNGSeed(_seed);
|
||||
}
|
||||
Env.traceVerbose("Initial seed = " + _seed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets number of test runs
|
||||
* @param r Number of test runs
|
||||
@ -166,7 +156,7 @@ public abstract class MlvmTest {
|
||||
// Sugar...
|
||||
/**
|
||||
* Provides Random Number Generator for the test. The tests should always use this generator
|
||||
* to guarantee repeatability (using -seed option), especially in multi-threaded usages
|
||||
* to guarantee repeatability, especially in multi-threaded usages
|
||||
* @return Random number generator for this thread, seeded with command-line option, if provided
|
||||
*/
|
||||
public static Random getRNG() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 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
|
||||
@ -356,7 +356,6 @@ public class MlvmTestExecutor {
|
||||
private static void setupMlvmTest(MlvmTest instance) {
|
||||
MlvmTest.setInstance(instance);
|
||||
OptionSupport.setup(instance, Env.getArgParser().getRawArguments(), new IgnoreUnknownArgumentsHandler());
|
||||
instance.initRNG();
|
||||
}
|
||||
|
||||
private static boolean runMlvmTestInstance(MlvmTest instance) throws Throwable {
|
||||
|
Loading…
x
Reference in New Issue
Block a user