You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by GitBox <gi...@apache.org> on 2021/11/18 23:51:21 UTC

[GitHub] [lucenenet] NightOwl888 opened a new issue #546: Failing Test: Lucene.Net.Search.TestSimpleExplanations::TestDMQ8()

NightOwl888 opened a new issue #546:
URL: https://github.com/apache/lucenenet/issues/546


   > 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:
   
   1. 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()`.
   2. 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
   ```
   
   [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.
   
   > NOTE: I am working on a PR to fix the random seed functionality #288 now, and the settings in the error message don't exist in master yet.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [lucenenet] NightOwl888 closed issue #546: Failing Test: Lucene.Net.Search.TestSimpleExplanations::TestDMQ8()

Posted by GitBox <gi...@apache.org>.
NightOwl888 closed issue #546:
URL: https://github.com/apache/lucenenet/issues/546


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org