Mailing List Archive

Running tests with streaming console output but NOT verbose?
Hi Team,

This is prolly a Dawid question...

Sometimes I want to run a test (like a slow Monster test), seeing its
ongoing musings popping out on the console in "real time" (not buffered).

I can do this today by adding "-Dtests.verbose=true" to the ./gradlew
invocation that's running the test.

But that also turns on LuceneTestCase.VERBOSE which sometimes produces
insane amounts of mostly not helpful content.

Is there any way to do the first (stream console output) without the second
(mega verbosity enabled)?

Thanks,

Mike McCandless

http://blog.mikemccandless.com
Re: Running tests with streaming console output but NOT verbose? [ In reply to ]
This is actually an accidental (?) clash between Lucene's system property
and what's in defaults-tests.gradle.
You can manually prepend true || ... to the following in
defaults-tests.gradle.

def verboseMode = resolvedTestOption("tests.verbose").toBoolean()

I can't remember why it aligns with Lucene's logger. Maybe it should/could
be a
separate property? I find it difficult to come up with a reasonable name
though.

D.

On Tue, Dec 12, 2023 at 8:03?PM Michael McCandless <
lucene@mikemccandless.com> wrote:

> Hi Team,
>
> This is prolly a Dawid question...
>
> Sometimes I want to run a test (like a slow Monster test), seeing its
> ongoing musings popping out on the console in "real time" (not buffered).
>
> I can do this today by adding "-Dtests.verbose=true" to the ./gradlew
> invocation that's running the test.
>
> But that also turns on LuceneTestCase.VERBOSE which sometimes produces
> insane amounts of mostly not helpful content.
>
> Is there any way to do the first (stream console output) without the
> second (mega verbosity enabled)?
>
> Thanks,
>
> Mike McCandless
>
> http://blog.mikemccandless.com
>
Re: Running tests with streaming console output but NOT verbose? [ In reply to ]
Ahh thanks for the quick explanation and temporary solution Dawid!. Naming
is the hardest part :)

I think long ago we used to call it "-Dtests.stdout=true" or so? Not the
greatest name tho. Maybe "tests.liveConsoleOut"? "tests.liveConsole"?

Mike McCandless

http://blog.mikemccandless.com


On Tue, Dec 12, 2023 at 2:31?PM Dawid Weiss <dawid.weiss@gmail.com> wrote:

>
> This is actually an accidental (?) clash between Lucene's system property
> and what's in defaults-tests.gradle.
> You can manually prepend true || ... to the following in
> defaults-tests.gradle.
>
> def verboseMode = resolvedTestOption("tests.verbose").toBoolean()
>
> I can't remember why it aligns with Lucene's logger. Maybe it should/could
> be a
> separate property? I find it difficult to come up with a reasonable name
> though.
>
> D.
>
> On Tue, Dec 12, 2023 at 8:03?PM Michael McCandless <
> lucene@mikemccandless.com> wrote:
>
>> Hi Team,
>>
>> This is prolly a Dawid question...
>>
>> Sometimes I want to run a test (like a slow Monster test), seeing its
>> ongoing musings popping out on the console in "real time" (not buffered).
>>
>> I can do this today by adding "-Dtests.verbose=true" to the ./gradlew
>> invocation that's running the test.
>>
>> But that also turns on LuceneTestCase.VERBOSE which sometimes produces
>> insane amounts of mostly not helpful content.
>>
>> Is there any way to do the first (stream console output) without the
>> second (mega verbosity enabled)?
>>
>> Thanks,
>>
>> Mike McCandless
>>
>> http://blog.mikemccandless.com
>>
>
Re: Running tests with streaming console output but NOT verbose? [ In reply to ]
I think I remember now... So, this is LuceneTestCase:

/**
* True if and only if tests are run in verbose mode. If this flag is
false tests are not expected
* to print any messages. Enforced with {@link TestRuleLimitSysouts}.
*/
public static final boolean VERBOSE =
systemPropertyAsBoolean("tests.verbose", false);

/** Enables or disables dumping of {@link InfoStream} messages. */
public static final boolean INFOSTREAM =
systemPropertyAsBoolean("tests.infostream", VERBOSE);

Note infostream is by default on when verbose is enabled. You can turn it
off independently though (-Ptests.infostream=false) or even set the default
in your gradle.properties...

So I don't think there's anything to do here? For the record, all the test
options and their defaults are displayed with:

gradlew -p lucene\core testOpts

Dawid

On Tue, Dec 12, 2023 at 8:45?PM Michael McCandless <
lucene@mikemccandless.com> wrote:

> Ahh thanks for the quick explanation and temporary solution Dawid!.
> Naming is the hardest part :)
>
> I think long ago we used to call it "-Dtests.stdout=true" or so? Not the
> greatest name tho. Maybe "tests.liveConsoleOut"? "tests.liveConsole"?
>
> Mike McCandless
>
> http://blog.mikemccandless.com
>
>
> On Tue, Dec 12, 2023 at 2:31?PM Dawid Weiss <dawid.weiss@gmail.com> wrote:
>
>>
>> This is actually an accidental (?) clash between Lucene's system property
>> and what's in defaults-tests.gradle.
>> You can manually prepend true || ... to the following in
>> defaults-tests.gradle.
>>
>> def verboseMode = resolvedTestOption("tests.verbose").toBoolean()
>>
>> I can't remember why it aligns with Lucene's logger. Maybe it
>> should/could be a
>> separate property? I find it difficult to come up with a reasonable name
>> though.
>>
>> D.
>>
>> On Tue, Dec 12, 2023 at 8:03?PM Michael McCandless <
>> lucene@mikemccandless.com> wrote:
>>
>>> Hi Team,
>>>
>>> This is prolly a Dawid question...
>>>
>>> Sometimes I want to run a test (like a slow Monster test), seeing its
>>> ongoing musings popping out on the console in "real time" (not buffered).
>>>
>>> I can do this today by adding "-Dtests.verbose=true" to the ./gradlew
>>> invocation that's running the test.
>>>
>>> But that also turns on LuceneTestCase.VERBOSE which sometimes produces
>>> insane amounts of mostly not helpful content.
>>>
>>> Is there any way to do the first (stream console output) without the
>>> second (mega verbosity enabled)?
>>>
>>> Thanks,
>>>
>>> Mike McCandless
>>>
>>> http://blog.mikemccandless.com
>>>
>>
Re: Running tests with streaming console output but NOT verbose? [ In reply to ]
Aha, wonderful, thanks Dawid!

I somehow failed to remember about this "gradlew -p lucene/core testOpts"
-- that's really awesome and produces all sorts of options I long forgot
about too. What are the C and ! characters in the left most column?

Also why on earth is my tests.file.encoding US-ASCII!! I thought I fixed
my box's messed up default Locale (thank you Rob)...

> Task :lucene:core:testOpts

Test options for project :lucene:core and seed "2649C13388947F46":

tests.LUCENE_VERSION = 10.0.0 # Base Lucene version.

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

tests.awaitsfix = null # Enables or disables @AwaitsFix
tests.

tests.bwcdir = null # Data for backward-compatibility
indexes.

tests.codec = random # Sets the codec tests should run
with.

tests.directory = random # Sets the Directory implementation
tests should run with.

tests.docvaluesformat = random # Sets the doc values format tests
should run with.

tests.dups = 0 # Reiterate runs of entire test
suites ('beast' task).

tests.failfast = false # Stop the build early on failure.

C tests.file.encoding = US-ASCII # (!= default: computed) Sets the
default file.encoding on test JVM.

tests.filter = null # Applies a test filter (see
:helpTests).

tests.forceintegervectors = true # Forces use of integer vectors even
when slow.

C tests.gui = false # (!= default: computed) Enables or
disables @RequiresGUI tests.

tests.haltonfailure = true # Halt processing on test failure.

tests.heapsize = 512m # Heap size for test JVMs

tests.infostream = false # Enables or disables infostream logs.

tests.iters = null # Duplicate (re-run) each test case N
times.

C tests.jvmargs = -XX:TieredStopAtLevel=1 -XX:+UseParallelGC
-XX:ActiveProcessorCount=1 # (!= default: computed) Arguments passed to
each forked JVM.

! tests.jvms = 12 # (!= default: computed) Number of
forked test JVMs

tests.leaveTemporary = false # Leave temporary directories after
tests complete.

tests.linedocsfile = europarl.lines.txt.gz # Test data file path.

tests.locale = random # Sets the default locale tests
should run with.

tests.maxfailures = null # Skip tests after a given number of
failures.

tests.minheapsize = 256m # Minimum heap size for test JVMs

tests.monster = false # Enables or disables @Monster tests.

tests.multiplier = null # Value multiplier for randomized
tests.

tests.neverUpToDate = true # Make test tasks always fail the
up-to-date checks (rerun) even if the inputs have not changed.

tests.nightly = false # Enables or disables @Nightly tests.

tests.postingsformat = random # Sets the postings format tests
should run with.

tests.profile = false # Enable Java Flight Recorder
profiling.

C tests.seed = 2649C13388947F46 # (!= default: computed) Sets
the master randomization seed.

tests.slowestSuites = true # Print the summary of the slowest
suites.

tests.slowestTests = true # Print the summary of the slowest
tests.

tests.timeoutSuite = null # Timeout (in millis) for an entire
suite.

tests.timezone = random # Sets the default time zone tests
should run with.

tests.useSecurityManager = true # Control security manager in tests.

C tests.vectorsize = 128 # (!= default: computed) Sets
preferred vector size in bits.

tests.verbose = false # Enables verbose mode (emits full
test outputs immediately).

tests.weekly = false # Enables or disables @Weekly tests.

C tests.workDir = build/tmp/tests-tmp # (!= default: computed)
Working directory for forked test JVMs

Mike McCandless

http://blog.mikemccandless.com


On Wed, Dec 13, 2023 at 2:42?AM Dawid Weiss <dawid.weiss@gmail.com> wrote:

>
> I think I remember now... So, this is LuceneTestCase:
>
> /**
> * True if and only if tests are run in verbose mode. If this flag is
> false tests are not expected
> * to print any messages. Enforced with {@link TestRuleLimitSysouts}.
> */
> public static final boolean VERBOSE =
> systemPropertyAsBoolean("tests.verbose", false);
>
> /** Enables or disables dumping of {@link InfoStream} messages. */
> public static final boolean INFOSTREAM =
> systemPropertyAsBoolean("tests.infostream", VERBOSE);
>
> Note infostream is by default on when verbose is enabled. You can turn it
> off independently though (-Ptests.infostream=false) or even set the default
> in your gradle.properties...
>
> So I don't think there's anything to do here? For the record, all the test
> options and their defaults are displayed with:
>
> gradlew -p lucene\core testOpts
>
> Dawid
>
> On Tue, Dec 12, 2023 at 8:45?PM Michael McCandless <
> lucene@mikemccandless.com> wrote:
>
>> Ahh thanks for the quick explanation and temporary solution Dawid!.
>> Naming is the hardest part :)
>>
>> I think long ago we used to call it "-Dtests.stdout=true" or so? Not the
>> greatest name tho. Maybe "tests.liveConsoleOut"? "tests.liveConsole"?
>>
>> Mike McCandless
>>
>> http://blog.mikemccandless.com
>>
>>
>> On Tue, Dec 12, 2023 at 2:31?PM Dawid Weiss <dawid.weiss@gmail.com>
>> wrote:
>>
>>>
>>> This is actually an accidental (?) clash between Lucene's system
>>> property and what's in defaults-tests.gradle.
>>> You can manually prepend true || ... to the following in
>>> defaults-tests.gradle.
>>>
>>> def verboseMode = resolvedTestOption("tests.verbose").toBoolean()
>>>
>>> I can't remember why it aligns with Lucene's logger. Maybe it
>>> should/could be a
>>> separate property? I find it difficult to come up with a reasonable name
>>> though.
>>>
>>> D.
>>>
>>> On Tue, Dec 12, 2023 at 8:03?PM Michael McCandless <
>>> lucene@mikemccandless.com> wrote:
>>>
>>>> Hi Team,
>>>>
>>>> This is prolly a Dawid question...
>>>>
>>>> Sometimes I want to run a test (like a slow Monster test), seeing its
>>>> ongoing musings popping out on the console in "real time" (not buffered).
>>>>
>>>> I can do this today by adding "-Dtests.verbose=true" to the ./gradlew
>>>> invocation that's running the test.
>>>>
>>>> But that also turns on LuceneTestCase.VERBOSE which sometimes produces
>>>> insane amounts of mostly not helpful content.
>>>>
>>>> Is there any way to do the first (stream console output) without the
>>>> second (mega verbosity enabled)?
>>>>
>>>> Thanks,
>>>>
>>>> Mike McCandless
>>>>
>>>> http://blog.mikemccandless.com
>>>>
>>>
Re: Running tests with streaming console output but NOT verbose? [ In reply to ]
Hi Mike,

What are the C and ! characters in the left most column?
>

Always good to add a legend, eh? It's this snippet that computes the
prefixes:

(defValue != value ? "! " : computedValue ? "C " : " "),

In short, "C" stands for a "computed" value. This means the value is
randomly computed from the provided (or random) tests.seed. This applies to
properties we can't modify in LuceneTestCase - like tests.file.encoding you
asked about (which can be declared at VM startup only). This is ok, since
we do want to "simulate" those odd locales and encodings.

The "!" next to a property means you have it locally overridden (either via
command line property or in gradle.properties). In your case, it's this
one, for example:


> ! tests.jvms = 12 # (!= default: computed) Number of
> forked test JVMs
>

Dawid