Skip to content

Commit

Permalink
tests.multiplier could be omitted in failed test reproduce line (#12752)
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
dweiss authored Nov 3, 2023
1 parent 1f3f3ae commit d6836d3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle/testing/randomization.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
3 changes: 3 additions & 0 deletions lucene/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ private void reportAdditionalFailureInfo(final String testName) {
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);
Expand Down

0 comments on commit d6836d3

Please sign in to comment.