You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For information about how to help us debug tests, see #269.
This test only started failing after fixing the test framework to randomize the codecs, culture and time zone (NUnit's Randomizer was always initialized with a seed of 0, so none of these were actually random).
It only fails on .NET Framework under x86 on Windows, and only when optimizations are enabled (Release mode). I have confirmed that the test is 100% repeatable with the below seed and culture.
So far, all similar failures have been due to one of two things:
Floating point numbers are compared directly using ==, >=, <=, >, or <. To fix these, converting the float data type to an int for both sides of the comparison has worked using Lucene.Net.Util.NumericUtils.SingleToSortableInt32().
A float is being assigned to a double, which makes it change in precision. A place to watch out for are the Math functions that accept double as a parameter but are passed a float. For score values which can only be between 0 and 1, doing an intermediate cast to a decimal works (double x = (double)(decimal)theFloat). However, we haven't found a solution that works in more general cases because this could overflow the decimal for large numbers.
query assigned doc 2 a score of <243969.1> but skipTo(1) has <243969.1>!
Expected: 243969.09375d +/- 0.0010000000474974513d
But was: 243969.078125d
Off by: 0.015625d
To reproduce this test result:
Option 1:
Apply the following assembly-level attributes:
[assembly: Lucene.Net.Util.RandomSeed(0x88c92f3536160e0L)]
[assembly: NUnit.Framework.SetCulture("en-IN")]
Option 2:
Use the following .runsettings file:
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x88c92f3536160e0" />
<Parameter name="tests:culture" value="en-IN" />
</TestRunParameters>
</RunSettings>
See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
at Lucene.Net.Search.QueryUtils.CollectorAnonymousClass2.Collect(Int32 doc) in D:\a\1\s\src\Lucene.Net.TestFramework\Search\QueryUtils.cs:line 585
at Lucene.Net.Search.Weight.DefaultBulkScorer.ScoreAll(ICollector collector, Scorer scorer) in D:\a\1\s\src\Lucene.Net\Search\Weight.cs:line 196
at Lucene.Net.Search.Weight.DefaultBulkScorer.Score(ICollector collector, Int32 max) in D:\a\1\s\src\Lucene.Net\Search\Weight.cs:line 167
at Lucene.Net.Search.BulkScorer.Score(ICollector collector) in D:\a\1\s\src\Lucene.Net\Search\BulkScorer.cs:line 36
at Lucene.Net.Search.AssertingBulkScorer.Score(ICollector collector) in D:\a\1\s\src\Lucene.Net.TestFramework\Search\AssertingBulkScorer.cs:line 74
at Lucene.Net.Search.IndexSearcher.Search(IList`1 leaves, Weight weight, ICollector collector) in D:\a\1\s\src\Lucene.Net\Search\IndexSearcher.cs:line 633
at Lucene.Net.Search.AssertingIndexSearcher.Search(IList`1 leaves, Weight weight, ICollector collector) in D:\a\1\s\src\Lucene.Net.TestFramework\Search\AssertingIndexSearcher.cs:line 106
at Lucene.Net.Search.IndexSearcher.Search(Query query, ICollector results) in D:\a\1\s\src\Lucene.Net\Search\IndexSearcher.cs:line 304
at Lucene.Net.Search.QueryUtils.CheckFirstSkipTo(Query q, IndexSearcher s) in D:\a\1\s\src\Lucene.Net.TestFramework\Search\QueryUtils.cs:line 518
at Lucene.Net.Search.QueryUtils.Check(Random random, Query q1, IndexSearcher s, Boolean wrap) in D:\a\1\s\src\Lucene.Net.TestFramework\Search\QueryUtils.cs:line 146
at Lucene.Net.Search.CheckHits.CheckHitCollector(Random random, Query query, String defaultFieldName, IndexSearcher searcher, Int32[] results) in D:\a\1\s\src\Lucene.Net.TestFramework\Search\CheckHits.cs:line 114
at Lucene.Net.Search.TestExplanations.Qtest(Query q, Int32[] expDocNrs) in D:\a\1\s\src\Lucene.Net.Tests\Search\TestExplanations.cs:line 109
at Lucene.Net.Search.TestSimpleExplanations.TestDMQ8() in D:\a\1\s\src\Lucene.Net.Tests\Search\TestSimpleExplanations.cs:line 293
This test only started failing after fixing the test framework to randomize the codecs, culture and time zone (NUnit's Randomizer was always initialized with a seed of 0, so none of these were actually random).
It only fails on .NET Framework under x86 on Windows, and only when optimizations are enabled (Release mode). I have confirmed that the test is 100% repeatable with the below seed and culture.
So far, all similar failures have been due to one of two things:
==
,>=
,<=
,>
, or<
. To fix these, converting thefloat
data type to anint
for both sides of the comparison has worked usingLucene.Net.Util.NumericUtils.SingleToSortableInt32()
.float
is being assigned to adouble
, which makes it change in precision. A place to watch out for are theMath
functions that acceptdouble
as a parameter but are passed afloat
. For score values which can only be between 0 and 1, doing an intermediate cast to adecimal
works (double x = (double)(decimal)theFloat
). However, we haven't found a solution that works in more general cases because this could overflow thedecimal
for large numbers.See: https://dev.azure.com/lucene-net-temp3/Lucene.NET/_build/results?buildId=590&view=ms.vss-test-web.build-test-results-tab&runId=429610&resultId=100341&paneView=debug](https://dev.azure.com/lucene-net-temp3/Lucene.NET/_build/results?buildId=590&view=ms.vss-test-web.build-test-results-tab&runId=429610&resultId=100341&paneView=debug) to download the test artifacts, but do note that the build will be cleaned up after 30 days.
The text was updated successfully, but these errors were encountered: