Some test fixes (dotnet/corefx#35092)
authorDan Moseley <danmose@microsoft.com>
Wed, 6 Feb 2019 15:53:59 +0000 (07:53 -0800)
committerViktor Hofer <viktor.hofer@microsoft.com>
Wed, 6 Feb 2019 15:53:59 +0000 (16:53 +0100)
* Disable Media test on NETFX

* Fix S.R.E for Uapaot

* Disable varargs for PN

* missing method 'AssemblyLoadContext..ctor(bool)

* IO test

* Fix UapAot RuntimeInformation tests

* Set correct tfm for AppDomainTests

* Merge driveonly tests into one

* Revert math

Commit migrated from https://github.com/dotnet/corefx/commit/0a751af9afe28042a720411925e6e6c55bdc10cc

src/libraries/System.IO.FileSystem/tests/DirectoryInfo/ToString.cs
src/libraries/System.Runtime.Extensions/tests/System/AppDomainTests.cs
src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/DescriptionNameTests.cs
src/libraries/System.Runtime/tests/System.Runtime.Tests.csproj
src/libraries/System.Runtime/tests/System/ArgIteratorTests.netcoreapp.cs
src/libraries/System.Runtime/tests/System/Reflection/IsCollectibleTests.cs
src/libraries/System.Windows.Extensions/tests/System/Media/SoundPlayerTests.cs

index fb09934..0a85ab8 100644 (file)
@@ -38,28 +38,13 @@ namespace System.IO.Tests
         }
 
         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInAppContainer))] // Can't read root in appcontainer
-        [SkipOnTargetFramework(TargetFrameworkMonikers.Netcoreapp)]
+        [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] // Different behavior on Desktop
         [PlatformSpecific(TestPlatforms.Windows)]  // Drive letter only
-        public void DriveOnlyReturnsPeriod_Windows_Desktop()
+        public void DriveOnlyReturnsDrive_Windows()
         {
             string path = @"C:";
             var info = new DirectoryInfo(path);
-            Assert.Equal(".", info.ToString());
-        }
-
-        [Fact]
-        [SkipOnTargetFramework(~TargetFrameworkMonikers.Netcoreapp)]
-        [PlatformSpecific(TestPlatforms.Windows)]  // Drive letter only
-        public void DriveOnlyReturnsPeriod_Windows_Core()
-        {
-            // This was likely a limited trust hack that was strangely implemented.
-            // Getting the current directory for a specified drive relative path
-            // doesn't make a lot of sense. There is no reason to hide original paths
-            // when in full trust.
-            string path = @"C:";
-            var info = new DirectoryInfo(path);
-            Assert.Equal("C:", info.ToString());
+            Assert.Equal(path, info.ToString());
         }
-
     }
 }
index 7439deb..397909a 100644 (file)
@@ -41,8 +41,16 @@ namespace System.Tests
         [Fact]
         public void TargetFrameworkTest()
         {
-            // On Uap we use the Microsoft.DotNet.XUnitRunnerUap instead of the RemoteExecutorConsoleApp
-            string targetFrameworkName = PlatformDetection.IsUap ? ".NETCore,Version=v5.0" : "DUMMY-TFA";
+            string targetFrameworkName = "DUMMY-TFA";
+            if (PlatformDetection.IsInAppContainer)
+            {
+                targetFrameworkName = ".NETCore,Version=v5.0";
+            }
+            if (PlatformDetection.IsNetNative)
+            {
+                targetFrameworkName = ".NETCoreApp,Version=v2.0";
+            }
+            
             RemoteInvoke((_targetFrameworkName) => {
                 Assert.Contains(_targetFrameworkName, AppContext.TargetFrameworkName);
             }, targetFrameworkName).Dispose();
index d46f142..59f49dd 100644 (file)
@@ -27,9 +27,13 @@ namespace System.Runtime.InteropServices.RuntimeInformationTests
 
             Console.WriteLine($@"### CONFIGURATION: {dvs} OS={osd} OSVer={osv} OSArch={osa} Arch={pra} Framework={frd} LibcRelease={lcr} LibcVersion={lcv}");
 
-            string binariesLocation = Path.GetDirectoryName(typeof(object).Assembly.Location);
-            string binariesLocationFormat = PlatformDetection.IsInAppContainer ? "Unknown" : new DriveInfo(binariesLocation).DriveFormat;
-            Console.WriteLine($"### BINARIES: {binariesLocation} (drive format {binariesLocationFormat})");
+            if (!PlatformDetection.IsNetNative)
+            {
+                string binariesLocation = Path.GetDirectoryName(typeof(object).Assembly.Location);
+                Console.WriteLine("location: " + binariesLocation);
+                string binariesLocationFormat = PlatformDetection.IsInAppContainer ? "Unknown" : new DriveInfo(binariesLocation).DriveFormat;
+                Console.WriteLine($"### BINARIES: {binariesLocation} (drive format {binariesLocationFormat})");
+            }
 
             string tempPathLocation = Path.GetTempPath();
             string tempPathLocationFormat = PlatformDetection.IsInAppContainer ? "Unknown" : new DriveInfo(tempPathLocation).DriveFormat;
index 61f04a4..4590d32 100644 (file)
     <Compile Include="System\ComponentModel\DefaultValueAttributeTests.netcoreapp.cs" />
     <Compile Include="System\Reflection\BindingFlagsDoNotWrap.netcoreapp.cs" />
     <Compile Include="System\Reflection\InvokeRefReturn.netcoreapp.cs" />
-    <Compile Include="System\Reflection\IsCollectibleTests.cs" />
+    <Compile Include="System\Reflection\IsCollectibleTests.cs" Condition="'$(TargetGroup)' != 'uapaot'"/><!-- missing method 'AssemblyLoadContext..ctor(bool) -->
     <Compile Include="System\Reflection\MethodBaseTests.netcoreapp.cs" />
     <Compile Include="System\Reflection\SignatureTypes.netcoreapp.cs" />
     <Compile Include="System\Reflection\TypeDelegatorTests.netcoreapp.cs" />
index fea0685..6c9fc13 100644 (file)
@@ -8,6 +8,7 @@ using Xunit;
 
 namespace System.Tests
 {
+    [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "varargs calling convention not supported on .NET Native")]
     public static class ArgIteratorTests
     {
         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsArgIteratorSupported))]
@@ -28,7 +29,7 @@ namespace System.Tests
             objArgs[1] = arg1;
             objArgs[2] = arg2;
             objArgs[3] = arg3;
-            
+
             // Walk all of the args in the variable part of the argument list.
             for (int i = 4; i < argCount; i++)
             {
index 251ac3a..f73ee1e 100644 (file)
@@ -18,7 +18,6 @@ namespace System.Reflection.Tests
     }
 
     [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "AssemblyLoadContext not available in NetFx")]
-    [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Assembly.LoadFrom() is not supported on UapAot")]
     public class IsCollectibleTests : RemoteExecutorTestBase
     {
         static public string asmNameString = "TestCollectibleAssembly";
index ff2c896..6cd4fe0 100644 (file)
@@ -495,6 +495,7 @@ namespace System.Media.Test
             Assert.Null(ea.UserState);
         }
 
+        [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "netfx hangs")]
         [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsSoundPlaySupported))]
         [MemberData(nameof(Play_String_TestData))]
         [OuterLoop]