Run, for example:

gradlew -p lucene testOpts

to see the options available. Notice this one:

  tests.asserts            = true     # Enables or disables assertions mode.

and run your tests with:

gradlew -p lucene -Ptests.asserts=false test

>From IDE level you can disable assertions with -Dtests.asserts=false
(and not adding -ea).

D.

On Thu, Feb 18, 2021 at 3:45 AM Gautam Worah <worah.gau...@gmail.com> wrote:
>
> Hi Folks,
>
> I was working on PR LUCENE-9476 when we found cases where `asserts` in test 
> cases were always enabled. To verify whether this was true, I wrote a simple 
> test case that called assert 1000 times, modified a variable and then checked 
> its value. This test case always passed because `assert` was always enabled.
>
> Mike McCandless mentioned in the PR that Lucene earlier had the capability to 
> randomly disable `asserts` so that there were no accidental cases of 
> developers relying on `asserts` always being enabled. We may have lost this 
> feature when the project transitioned to Gradle.
> When I change the default value of `tests.asserts` in randomization.gradle to 
> false, the test fails promptly.
>
> Has anyone else noticed this/knows more about this?
>
> Thanks,
> Gautam Worah.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to