Default distro version for tests (dotnet/corefx#38860)
authorDan Moseley <danmose@microsoft.com>
Wed, 26 Jun 2019 02:44:22 +0000 (19:44 -0700)
committerGitHub <noreply@github.com>
Wed, 26 Jun 2019 02:44:22 +0000 (19:44 -0700)
* Default distro version for tests

* Move it

* typo

* typo

* Update PlatformApis.Unix.cs

Commit migrated from https://github.com/dotnet/corefx/commit/4f0d10773ccbb4849b869b6a0a73d5938f1804bd

src/libraries/CoreFx.Private.TestUtilities/src/System/PlatformApis.Unix.cs

index c1cca99..84b8d2d 100644 (file)
@@ -203,12 +203,13 @@ namespace System
                     }
                 }
             }
+            // possibly should fall back to /usr/lib/os-release here
 
             if (result != null)
             {
                 result = NormalizeDistroInfo(result);
             }
-            
+
             return result;
         }
 
@@ -236,6 +237,13 @@ namespace System
                 distroInfo.VersionId = distroInfo.VersionId.Substring(0, lastVersionNumberSeparatorIndex);
             }
 
+            // In some distros/versions we cannot discover the distro version; return something valid.
+            // Pick a high version number, since this seems to happen on newer distros.
+            if (string.IsNullOrEmpty(distroInfo.VersionId))
+            {
+                distroInfo.VersionId = new Version(Int32.MaxValue, Int32.MaxValue).ToString();
+            }
+
             return distroInfo;
         }