Skip to content

Commit

Permalink
Naricc/test mono is mono (#36079)
Browse files Browse the repository at this point in the history
Add test to test if we are running mono.
  • Loading branch information
Nathan Ricci authored May 8, 2020
1 parent ca8c9de commit e77572f
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/coreclr/tests/issues.targets
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@
<ExcludeList Include="$(XunitTestBinBase)/Loader/classloader/generics/Variance/Interfaces/Interfaces001/*">
<Issue>https://github.com/dotnet/runtime/issues/3893</Issue>
</ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)/baseservices/mono/runningmono/*">
<Issue>This test is to verify we are running mono, and therefore only makes sense on mono.</Issue>
</ExcludeList>
</ItemGroup>

<!-- All Unix targets on all runtimes -->
Expand Down
26 changes: 26 additions & 0 deletions src/coreclr/tests/src/baseservices/mono/runningmono.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;

namespace TestRunningMono
{
class Program
{
public static int Main(string[] args)
{
const int Pass = 100, Fail = 1;
bool isMono = typeof(object).Assembly.GetType("Mono.RuntimeStructs") != null;

if(isMono)
{
return Pass;
}
else
{
return Fail;
}
}
}
}

11 changes: 11 additions & 0 deletions src/coreclr/tests/src/baseservices/mono/runningmono.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<Optimize>false</Optimize>
<CLRTestPriority>0</CLRTestPriority>
</PropertyGroup>
<ItemGroup>
<Compile Include="runningmono.cs" />
</ItemGroup>
</Project>

0 comments on commit e77572f

Please sign in to comment.