tests.multiplier could be omitted in failed test reproduce line (#12752)

The default tests.multiplier passed from gradle was 1, but
LuceneTestCase tried to compute its default value from TESTS_NIGHTLY.
This could lead to subtle errors: nightly mode failures would not report
tests.multipler=1 and when started from the IDE, the tests.multiplier
would be set to 2 (leading to different randomness).
This commit is contained in:
Dawid Weiss 2023-11-03 17:05:17 +01:00 committed by GitHub
parent 1f3f3ae14f
commit d6836d3d0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 3 deletions

View File

@ -67,7 +67,7 @@ allprojects {
// seed, repetition and amplification.
[propName: 'tests.seed', value: { -> rootSeed }, description: "Sets the master randomization seed."],
[propName: 'tests.iters', value: null, description: "Duplicate (re-run) each test case N times."],
[propName: 'tests.multiplier', value: 1, description: "Value multiplier for randomized tests."],
[propName: 'tests.multiplier', value: null, description: "Value multiplier for randomized tests."],
[propName: 'tests.maxfailures', value: null, description: "Skip tests after a given number of failures."],
[propName: 'tests.timeoutSuite', value: null, description: "Timeout (in millis) for an entire suite."],
[propName: 'tests.failfast', value: "false", description: "Stop the build early on failure.", buildOnly: true],

View File

@ -285,6 +285,9 @@ Bug Fixes
Build
---------------------
* GITHUB#12752: tests.multiplier could be omitted in test failure reproduce lines (esp. in
nightly mode). (Dawid Weiss)
* GITHUB#12742: JavaCompile tasks may be in up-to-date state when modular dependencies have changed
leading to odd runtime errors (Chris Hostetter, Dawid Weiss)

View File

@ -476,7 +476,12 @@ public abstract class LuceneTestCase extends Assert {
* of iterations to scale your tests (for nightly builds).
*/
public static final int RANDOM_MULTIPLIER =
systemPropertyAsInt("tests.multiplier", TEST_NIGHTLY ? 2 : 1);
systemPropertyAsInt("tests.multiplier", defaultRandomMultiplier());
/** Compute the default value of the random multiplier (based on {@link #TEST_NIGHTLY}). */
static int defaultRandomMultiplier() {
return TEST_NIGHTLY ? 2 : 1;
}
/** Leave temporary files on disk, even on successful runs. */
public static final boolean LEAVE_TEMPORARY;

View File

@ -189,7 +189,8 @@ public final class RunListenerPrintReproduceInfo extends RunListener {
addVmOpt(b, "tests.seed", RandomizedContext.current().getRunnerSeedAsString());
// Test groups and multipliers.
if (RANDOM_MULTIPLIER > 1) addVmOpt(b, "tests.multiplier", RANDOM_MULTIPLIER);
if (RANDOM_MULTIPLIER != LuceneTestCase.defaultRandomMultiplier())
addVmOpt(b, "tests.multiplier", RANDOM_MULTIPLIER);
if (TEST_NIGHTLY) addVmOpt(b, SYSPROP_NIGHTLY, TEST_NIGHTLY);
if (TEST_WEEKLY) addVmOpt(b, SYSPROP_WEEKLY, TEST_WEEKLY);
if (TEST_MONSTER) addVmOpt(b, SYSPROP_MONSTER, TEST_MONSTER);