8252522: nsk/share/test/StressOptions should multiple stressTime by jtreg's timeout-factor

Reviewed-by: dholmes
This commit is contained in:
Igor Ignatyev 2020-09-06 16:17:30 +00:00
parent 1262ae36af
commit 5f76deb2e0

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -22,28 +22,30 @@
*/ */
package nsk.share.test; package nsk.share.test;
import java.io.PrintStream; import jdk.test.lib.Utils;
import vm.share.options.Option; import vm.share.options.Option;
import java.io.PrintStream;
/** /**
* Options for stress tests. * Options for stress tests.
* * <p>
* The following options may be configured: * The following options may be configured:
* * <p>
* -stressTime [time] execution time in seconds * -stressTime [time] execution time in seconds
* -stressIterationsFactor [factor] iterations factor. * -stressIterationsFactor [factor] iterations factor.
* The actual number of iterations is obtained by multiplying standard * The actual number of iterations is obtained by multiplying standard
* number of iterations (which is defined by the test itself) and this factor. * number of iterations (which is defined by the test itself) and this factor.
* -stressThreadsFactor [factor] number of threads factor * -stressThreadsFactor [factor] number of threads factor
* The actual number of threads is determined by multiplying standard * The actual number of threads is determined by multiplying standard
* number of threads (which is determined by test itself and may also depend * number of threads (which is determined by test itself and may also depend
* on machine configuration) and this factor. * on machine configuration) and this factor.
*/ */
public class StressOptions { public class StressOptions {
/** /**
* This enum contains names of stress options * This enum contains names of stress options
*/ */
public static enum StressOptionsParam { public enum StressOptionsParam {
stressTime, stressTime,
stressIterationsFactor, stressIterationsFactor,
stressThreadsFactor, stressThreadsFactor,
@ -88,25 +90,13 @@ public class StressOptions {
/** /**
* Create StressOptions configured from command line arguments. * Create StressOptions configured from command line arguments.
* *
* @param arg arguments * @param args arguments
*/ */
public StressOptions(String[] args) { public StressOptions(String[] args) {
this(); this();
parseCommandLine(args); parseCommandLine(args);
} }
/**
* Create stresser with same parameters as another.
*
* @param other another instance of StressOptions
*/
public StressOptions(StressOptions other) {
this.time = other.time;
this.iterationsFactor = other.iterationsFactor;
this.threadsFactor = other.threadsFactor;
this.runsFactor = other.runsFactor;
}
public static boolean isValidStressOption(String option) { public static boolean isValidStressOption(String option) {
for (int i = 0; i < StressOptions.StressOptionsParam.values().length; i++) { for (int i = 0; i < StressOptions.StressOptionsParam.values().length; i++) {
if (option.equals(StressOptions.StressOptionsParam.values()[i].name())) if (option.equals(StressOptions.StressOptionsParam.values()[i].name()))
@ -118,7 +108,7 @@ public class StressOptions {
/** /**
* Parse command line options related to stress. * Parse command line options related to stress.
* * <p>
* Other options are ignored. * Other options are ignored.
* *
* @param args arguments * @param args arguments
@ -221,12 +211,12 @@ public class StressOptions {
} }
/** /**
* Obtain execution time in seconds. * Obtain execution time in seconds adjusted for TIMEOUT_FACTOR.
* *
* @return time * @return time
*/ */
public long getTime() { public long getTime() {
return time; return Utils.adjustTimeout(time);
} }
/** /**