Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.IO.Tests.File_GetSetTimes.SetDateTimeMax fails on Ubuntu 18.04 in the CI #43166

Closed
janvorli opened this issue Oct 8, 2020 · 8 comments · Fixed by #59790
Closed

System.IO.Tests.File_GetSetTimes.SetDateTimeMax fails on Ubuntu 18.04 in the CI #43166

janvorli opened this issue Oct 8, 2020 · 8 comments · Fixed by #59790
Labels
area-System.IO disabled-test The test is disabled in source code against the issue test-bug Problem in test source code (most likely)

Comments

@janvorli
Copy link
Member

janvorli commented Oct 8, 2020

In two of my unrelated CIs, the System.IO.Tests.File_GetSetTimes.SetDateTimeMax test keeps failing on Ubuntu 18.04 with the following error:

Assert.Equal() Failure\nExpected: 9999-04-11T23:47:17.0210000Z\nActual:   2446-05-10T22:38:55.0000000Z

There was a notice from the engineering team that they have updated Ubuntu 18.04 image to the latest version, so I wonder if it is related. Setting the file time calls utimes or utimensat glibc functions, so their implementation w.r.t. clipping the max time could have possibly changed.

Runfo Tracking Issue: System.IO.Tests.File_GetSetTimes.SetDateTimeMax fails on Ubuntu 18.04 in the CI

Build Definition Kind Run Name

Build Result Summary

Day Hit Count Week Hit Count Month Hit Count
0 0 0
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-System.IO untriaged New issue has not been triaged by the area owner labels Oct 8, 2020
@janvorli
Copy link
Member Author

janvorli commented Oct 8, 2020

@janvorli
Copy link
Member Author

janvorli commented Oct 8, 2020

I can repro the issue on my local Ubuntu 18.04 VM too.

@janvorli
Copy link
Member Author

janvorli commented Oct 8, 2020

It seems there was a kernel patch that enabled limits on the time stamps, see https://lore.kernel.org/lkml/20190730014924.2193-10-deepa.kernel@gmail.com/. The timestamp limit mentioned in that page matches what we are getting as the actual value in the test.

@stephentoub
Copy link
Member

I'm disabling the test for now on Linux in #43178.

@danmoseley
Copy link
Member

Fix I guess is to update

private static bool SupportsLongMaxDateTime => PlatformDetection.IsWindows || (!PlatformDetection.Is32BitProcess && !PlatformDetection.IsOSXLike);

@danmoseley
Copy link
Member

Eh, I guess not that simple; it seems it's filesystem specific.

@am11
Copy link
Member

am11 commented Oct 9, 2020

Since from this point onward, Linux kernels will not have long max datetime support, I think we can simply exclude Linux from this test's matrix? macOS and 32bit Unix are already excluded, regardless of filesystem type (e.g. NTFS macOS will pass this test in practice but we seem to only care about the default file system of platform).
IMO:

--- a/src/libraries/System.IO.FileSystem/tests/File/GetSetTimes.cs
+++ b/src/libraries/System.IO.FileSystem/tests/File/GetSetTimes.cs
@@ -11,10 +11,6 @@ namespace System.IO.Tests
 {
     public class File_GetSetTimes : StaticGetSetTimes
     {
-        // OSX has the limitation of setting upto 2262-04-11T23:47:16 (long.Max) date.
-        // 32bit Unix has time_t up to ~ 2038.
-        private static bool SupportsLongMaxDateTime => PlatformDetection.IsWindows || (!PlatformDetection.Is32BitProcess && !PlatformDetection.IsOSXLike);
-
         protected override string GetExistingItem()
         {
             string path = GetTestFilePath();
@@ -148,7 +144,7 @@ public void SetUptoNanoseconds()
             Assert.Equal(ticks, dateTime.Ticks);
         }
 
-        [ConditionalFact(nameof(SupportsLongMaxDateTime))]
+        [PlatformSpecific(TestPlatforms.Windows)]
         public void SetDateTimeMax()
         {
             string file = GetTestFilePath();

@danmoseley
Copy link
Member

Seems this issue can be closed, since the test no longer runs on Linux?

@runfoapp runfoapp bot removed this from the 6.0.0 milestone Apr 14, 2021
@ghost ghost locked as resolved and limited conversation to collaborators May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.IO disabled-test The test is disabled in source code against the issue test-bug Problem in test source code (most likely)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants