Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions eng/testing/tests.mobile.targets
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,19 @@
<ExtraAssemblies Include="$(PublishDir)System.Xml.dll" />
<ExtraAssemblies Include="$(PublishDir)WindowsBase.dll" />
</ItemGroup>
<!-- these tests load assemblies from the file system -->
<ItemGroup Condition="'$(AssemblyName)' == 'System.Reflection.MetadataLoadContext.Tests'">
<WasmFilesToIncludeInFileSystem Include="$(PublishDir)System.Private.CoreLib.dll" />
<WasmFilesToIncludeInFileSystem Include="$(PublishDir)System.Reflection.MetadataLoadContext.Tests.dll" />
<WasmFilesToIncludeInFileSystem Include="$(PublishDir)mscorlib.dll" />
</ItemGroup>
<ItemGroup Condition="'$(AssemblyName)' == 'System.Reflection.Metadata.Tests'">
<WasmFilesToIncludeInFileSystem Include="$(PublishDir)System.Reflection.Metadata.Tests.dll" />
</ItemGroup>
<ItemGroup Condition="'$(AssemblyName)' == 'System.Reflection.Tests'">
<WasmFilesToIncludeInFileSystem Include="$(PublishDir)System.Reflection.Tests.dll" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a better way to track these dependencies? hardcoding looks wrong

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or avoid defining this centrally and instead set a property in the project file that indicates this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah we need to find a better way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please open an issue to discuss this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the project could add to an item and then we could transform that item to remap the value to be under PublishDir

<WasmFilesToIncludeInFileSystem Include="$(PublishDir)System.Reflection.Tests.pdb" />
</ItemGroup>
<Error Condition="!Exists('$(MicrosoftNetCoreAppRuntimePackRidDir)')" Text="MicrosoftNetCoreAppRuntimePackRidDir=$(MicrosoftNetCoreAppRuntimePackRidDir) doesn't exist" />
<WasmAppBuilder
AppDir="$(BundleDir)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public void BasicValidation(Machine machine)
}

[Fact]
[PlatformSpecific(~TestPlatforms.Browser)] // System.Security.Cryptography isn't supported on browser
public void BasicValidationSigned()
{
using (var peStream = new MemoryStream())
Expand Down Expand Up @@ -654,13 +655,15 @@ private static IEnumerable<string> GetBlobRanges(BlobBuilder builder, IEnumerabl
}

[Fact]
[PlatformSpecific(~TestPlatforms.Browser)] // System.Security.Cryptography isn't supported on browser
public void Checksum()
{
Assert.True(TestChecksumAndAuthenticodeSignature(new MemoryStream(Misc.Signed), Misc.KeyPair));
Assert.False(TestChecksumAndAuthenticodeSignature(new MemoryStream(Misc.Deterministic)));
}

[Fact]
[PlatformSpecific(~TestPlatforms.Browser)] // System.Security.Cryptography isn't supported on browser
public void ChecksumFXAssemblies()
{
var paths = new[]
Expand Down
7 changes: 5 additions & 2 deletions src/libraries/System.Reflection/tests/AssemblyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public void ExportedTypes(Type type, bool expected)
}

[Fact]
[PlatformSpecific(~TestPlatforms.Browser)] // entry assembly won't be xunit.console on browser
public void GetEntryAssembly()
{
Assert.NotNull(Assembly.GetEntryAssembly());
Expand All @@ -157,15 +158,17 @@ public void GetFile()
AssertExtensions.Throws<ArgumentException>(null, () => typeof(AssemblyTests).Assembly.GetFile(""));
Assert.Null(typeof(AssemblyTests).Assembly.GetFile("NonExistentfile.dll"));
Assert.NotNull(typeof(AssemblyTests).Assembly.GetFile("System.Reflection.Tests.dll"));
Assert.Equal(typeof(AssemblyTests).Assembly.GetFile("System.Reflection.Tests.dll").Name, typeof(AssemblyTests).Assembly.Location);
if (PlatformDetection.IsNotBrowser) // see https://github.com/dotnet/runtime/issues/39650
Assert.Equal(typeof(AssemblyTests).Assembly.GetFile("System.Reflection.Tests.dll").Name, typeof(AssemblyTests).Assembly.Location);
}

[Fact]
public void GetFiles()
{
Assert.NotNull(typeof(AssemblyTests).Assembly.GetFiles());
Assert.Equal(1, typeof(AssemblyTests).Assembly.GetFiles().Length);
Assert.Equal(typeof(AssemblyTests).Assembly.GetFiles()[0].Name, typeof(AssemblyTests).Assembly.Location);
if (PlatformDetection.IsNotBrowser) // see https://github.com/dotnet/runtime/issues/39650
Assert.Equal(typeof(AssemblyTests).Assembly.GetFiles()[0].Name, typeof(AssemblyTests).Assembly.Location);
}

public static IEnumerable<object[]> GetHashCode_TestData()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace System.Reflection.Tests
public class AssemblyTests
{
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/39650", TestPlatforms.Browser)]
public void CurrentLocation_HasLocaton()
{
string location = GetExecutingAssembly().Location;
Expand Down
3 changes: 0 additions & 3 deletions src/libraries/tests.proj
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Private.Uri\tests\FunctionalTests\System.Private.Uri.Functional.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Private.Xml\tests\XmlSerializer\ReflectionOnly\System.Xml.XmlSerializer.ReflectionOnly.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Private.Xml\tests\XmlSerializer\System.Xml.XmlSerializer.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Reflection.Metadata\tests\System.Reflection.Metadata.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Reflection\tests\CoreCLR\System.Reflection.CoreCLR.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Reflection\tests\System.Reflection.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Security.Permissions\tests\System.Security.Permissions.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Threading.Thread\tests\System.Threading.Thread.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.ValueTuple\tests\System.ValueTuple.Tests.csproj" />
Expand Down