-
Notifications
You must be signed in to change notification settings - Fork 511
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
[tests] Add .NET version of the fsharp test. #12359
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
namespace Xamarin.Mac.Tests | ||
|
||
open System | ||
open System.Collections.Generic | ||
open System.Runtime.InteropServices | ||
open System.Threading | ||
open System.Threading.Tasks | ||
|
||
module PInvokes = | ||
[<DllImport ("/usr/lib/libSystem.dylib")>] | ||
extern void _exit (int exit_code) | ||
|
||
type MainClass = | ||
static member ThreadMonitor(obj : System.Object) = | ||
let exit_code = obj :?> int | ||
Thread.Sleep (3000) | ||
Console.WriteLine ($"The process didn't exist within 3s of returning from Main. Assuming something is deadlocked, and will now exit immediately and forcefully (with exit code {exit_code}).") | ||
PInvokes._exit (exit_code) | ||
|
||
static member asyncMainTask (args: string[]) : Async<int> = | ||
async { | ||
// Skip arguments added by VSfM/macOS when running from the IDE | ||
let mutable arguments = new List<string> (args) | ||
arguments.RemoveAll (fun (arg) -> arg.StartsWith ("-psn_", StringComparison.Ordinal)) |> ignore | ||
|
||
let! exit_code = MonoTouch.NUnit.UI.MacRunner.MainAsync (arguments, true, PInvokes._exit, typedefof<MainClass>.Assembly) |> Async.AwaitTask | ||
|
||
let del = ParameterizedThreadStart(MainClass.ThreadMonitor) | ||
let exit_monitor = new Thread (del) | ||
exit_monitor.Name <- "Exit monitor" | ||
exit_monitor.IsBackground <- true | ||
exit_monitor.Start (exit_code) | ||
|
||
return exit_code | ||
} | ||
|
||
module Program = | ||
[<EntryPoint>] | ||
let main args = | ||
async { | ||
return! MainClass.asyncMainTask (args) | ||
} |> Async.RunSynchronously |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
open System | ||
open System.Reflection | ||
|
||
open UIKit | ||
open Foundation | ||
|
||
open NUnit.Framework | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.xamarin.fsharp</string> | ||
<key>LSMinimumSystemVersion</key> | ||
<string>10.15</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ../shared.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net6.0-maccatalyst</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<!-- Imports of the form '../shared.fsproj' will be processed by xharness --> | ||
<Import Project="../shared.fsproj" /> | ||
|
||
<ItemGroup> | ||
<!-- this empty item group is here for xharness --> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
TOP=../../.. | ||
include $(TOP)/Make.config | ||
|
||
build-all: | ||
for platform in $(DOTNET_PLATFORMS); do \ | ||
echo "Building in $$platform"; \ | ||
$(MAKE) -C "$$platform" build; \ | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"[]> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.xamarin.fsharp</string> | ||
<key>MinimumOSVersion</key> | ||
<string>10.0</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ../shared.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net6.0-ios</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<!-- Imports of the form '../shared.fsproj' will be processed by xharness --> | ||
<Import Project="../shared.fsproj" /> | ||
|
||
<ItemGroup> | ||
<!-- this empty item group is here for xharness --> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.xamarin.fsharp</string> | ||
<key>LSMinimumSystemVersion</key> | ||
<string>10.14</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ../shared.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net6.0-macos</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<!-- Imports of the form '../shared.fsproj' will be processed by xharness --> | ||
<Import Project="../shared.fsproj" /> | ||
|
||
<ItemGroup> | ||
<!-- this empty item group is here for xharness --> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<DefineConstants>$(DefineConstants);NET</DefineConstants> | ||
<LangVersion>latest</LangVersion> | ||
<RootNamespace>fsharp</RootNamespace> | ||
<AssemblyName>fsharp</AssemblyName> | ||
|
||
<ApplicationTitle>FSharp</ApplicationTitle> | ||
|
||
<RootTestsDirectory>$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\..\..\..'))</RootTestsDirectory> | ||
<TestLibrariesDirectory>$(RootTestsDirectory)\test-libraries</TestLibrariesDirectory> | ||
<FSharpTestDirectory>$(RootTestsDirectory)\fsharp</FSharpTestDirectory> | ||
|
||
<!-- Don't remove native symbols, because it makes debugging native crashes harder --> | ||
<MtouchNoSymbolStrip>true</MtouchNoSymbolStrip> | ||
|
||
<DefineConstants Condition="'$(Configuration)' == 'Debug'">$(DefineConstants);DEBUG</DefineConstants> | ||
</PropertyGroup> | ||
|
||
<Import Project="$(RootTestsDirectory)/common/shared-dotnet.csproj" /> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="NUnitLite" Version="3.12.0" /> | ||
<ProjectReference Include="$(RootTestsDirectory)\..\external\Touch.Unit\Touch.Client\dotnet\$(_PlatformName)\Touch.Client-$(_PlatformName).dotnet.csproj" /> | ||
<!-- MonoTouch.Dialog references System.Json, which isn't shipped with .NET5, so reference the NuGet instead --> | ||
<PackageReference Include="System.Json" Version="4.7.1" /> | ||
<PackageReference Include="FSharp.Core" Version="5.0.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="$(FSharpTestDirectory)/AppDelegate.fs" Condition="!$(TargetFramework.EndsWith('-macos'))" /> | ||
<Compile Include="$(FSharpTestDirectory)/FSharpTests.fs" /> | ||
<Compile Include="$(RootTestsDirectory)/common/mac/MacMain.fs" Condition="$(TargetFramework.EndsWith('-macos'))" /> | ||
<Compile Include="$(FSharpTestDirectory)/Main.fs" Condition="!$(TargetFramework.EndsWith('-macos'))" /> | ||
</ItemGroup> | ||
|
||
<Import Project="$(RootTestsDirectory)\nunit.framework.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
TOP=../../../.. | ||
include $(TOP)/Make.config | ||
include $(TOP)/mk/colors.mk | ||
|
||
prepare: | ||
$(Q) $(MAKE) -C $(TOP)/tests/dotnet copy-dotnet-config | ||
|
||
reload: | ||
$(Q) rm -Rf $(TOP)/tests/dotnet/packages | ||
$(Q) $(MAKE) -C $(TOP) -j8 all | ||
$(Q) $(MAKE) -C $(TOP) -j8 install | ||
$(Q) git clean -xfdq | ||
|
||
reload-and-build: | ||
$(Q) $(MAKE) reload | ||
$(Q) $(MAKE) build | ||
|
||
reload-and-run: | ||
$(Q) $(MAKE) reload | ||
$(Q) $(MAKE) run | ||
|
||
build: prepare | ||
$(Q) $(DOTNET6) build /bl *.fsproj $(MSBUILD_VERBOSITY) $(BUILD_ARGUMENTS) | ||
|
||
run: prepare | ||
$(Q) $(DOTNET6) build /bl *.fsproj $(MSBUILD_VERBOSITY) $(BUILD_ARGUMENTS) -t:Run | ||
|
||
diag: prepare | ||
$(Q) $(DOTNET6) build /v:diag msbuild.binlog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"[]> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.xamarin.fsharp</string> | ||
<key>MinimumOSVersion</key> | ||
<string>10.0</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ../shared.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net6.0-tvos</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<!-- Imports of the form '../shared.fsproj' will be processed by xharness --> | ||
<Import Project="../shared.fsproj" /> | ||
|
||
<ItemGroup> | ||
<!-- this empty item group is here for xharness --> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exist
->exit