runtime icon indicating copy to clipboard operation
runtime copied to clipboard

System.Globalization.Tests.GregorianCalendarGetWeekOfYears.GetWeekOfYear failed in CI

Open v-haren opened this issue 9 years ago • 7 comments

failed test: System.Globalization.Tests.GregorianCalendarGetWeekOfYears.GetWeekOfYear detail: https://ci.dot.net/job/dotnet_corefx/job/master/job/opensuse42.1_debug/2246/testReport/System.Globalization.Tests/GregorianCalendarGetWeekOfYears/GetWeekOfYear/

MESSAGE:

System.ArgumentOutOfRangeException : Year, Month, and Day parameters describe an un-representable DateTime.

STACK TRACE:

at System.DateTime.DateToTicks(Int32 year, Int32 month, Int32 day) 
at System.DateTime..ctor(Int32 year, Int32 month, Int32 day)
at System.Globalization.Tests.GregorianCalendarGetWeekOfYears.<GetWeekOfYear_TestData>d__6.MoveNext() 
at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()

v-haren avatar May 02 '17 06:05 v-haren

@tarekgh

danmoseley avatar May 02 '17 16:05 danmoseley

yes I am trying to look at this. This failure on OpenSUSE and I am not able to see the history of this test on that OS. so I wondering if we started to run such OS? or why this test started to fail.

tarekgh avatar May 02 '17 16:05 tarekgh

@tarekgh as far as I know we've been running against OpenSuSE 42.1 for a while. Helix just changed to 42.2 and it's apparently passing there. 42.1 is out of support so if it's a 42.1 issue only we don't care about it, and we should probably update netci.groovy to change to 42.2.

danmoseley avatar May 02 '17 17:05 danmoseley

This is very interesting failure because it fails when create DateTime object. the values we use to construct the DateTime is generated randomly. I have reviewed the code we have which generate such values and I am not seeing any obvious case which can generate wrong values for years, months and days. the only explanation I can have is Random class somehow generate negative values.

I am going to add some log messages in the test so we can catch exactly the failed cases with the wrong values.

tarekgh avatar May 03 '17 02:05 tarekgh

@tarekgh - sure it can, the last case doesn't match year with the month/day-of-month generated:

int randomYear = RandomYear();
yield return new object[] { new DateTime(RandomYear(), randomMonth, RandomDay(randomYear, randomMonth)), RandomCalendarWeekRule(), RandomDayOfWeek() };

... I think it's likely intellisense is to blame for supplying the wrong thing.

Clockwork-Muse avatar May 03 '17 02:05 Clockwork-Muse

Actually, I'm less sure that's the actual problem, but it's still a potential issue.

A bigger problem is that all the calls to the random data functions are running off of a static, shared instance of Random, which isn't threadsafe. So we might be getting bizarre data too.

Clockwork-Muse avatar May 03 '17 02:05 Clockwork-Muse

yield return new object[] { new DateTime(RandomYear(), randomMonth, RandomDay(randomYear, randomMonth)), RandomCalendarWeekRule(), RandomDayOfWeek() };

The day field depends on randomYear. However, the year is RandomYear(). RandomYear() != randomYear most of the time. So I guess if RandomYear() is a leap year, randomMonth == 2, and RandomDay(randomYear, randomMonth) is greater than 29 or whatever, the test will fail.

hughbe avatar May 03 '17 03:05 hughbe