[net8.0] [tests] Add a .NET 7 test app. (#17385)
This commit is contained in:
Родитель
425323a1c6
Коммит
be031736be
|
@ -53,9 +53,11 @@ using (TextWriter writer = new StreamWriter (outputPath)) {
|
||||||
if (platform == "macOS") {
|
if (platform == "macOS") {
|
||||||
writer.WriteLine ($" \"microsoft-net-runtime-mono-tooling\",");
|
writer.WriteLine ($" \"microsoft-net-runtime-mono-tooling\",");
|
||||||
writer.WriteLine ($" \"microsoft-net-runtime-mono-tooling-net6\",");
|
writer.WriteLine ($" \"microsoft-net-runtime-mono-tooling-net6\",");
|
||||||
|
writer.WriteLine ($" \"microsoft-net-runtime-mono-tooling-net7\",");
|
||||||
} else {
|
} else {
|
||||||
writer.WriteLine ($" \"microsoft-net-runtime-{platformLowerCase}\",");
|
writer.WriteLine ($" \"microsoft-net-runtime-{platformLowerCase}\",");
|
||||||
writer.WriteLine ($" \"microsoft-net-runtime-{platformLowerCase}-net6\",");
|
writer.WriteLine ($" \"microsoft-net-runtime-{platformLowerCase}-net6\",");
|
||||||
|
writer.WriteLine ($" \"microsoft-net-runtime-{platformLowerCase}-net7\",");
|
||||||
}
|
}
|
||||||
writer.WriteLine ($" ]");
|
writer.WriteLine ($" ]");
|
||||||
writer.WriteLine ($" }},");
|
writer.WriteLine ($" }},");
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
using Foundation;
|
||||||
|
|
||||||
|
namespace MySimpleApp {
|
||||||
|
public class Program {
|
||||||
|
static int Main (string [] args)
|
||||||
|
{
|
||||||
|
GC.KeepAlive (typeof (NSObject)); // prevent linking away the platform assembly
|
||||||
|
|
||||||
|
Console.WriteLine (Environment.GetEnvironmentVariable ("MAGIC_WORD"));
|
||||||
|
|
||||||
|
return args.Length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
include ../shared.mk
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net7.0-maccatalyst</TargetFramework>
|
||||||
|
<SupportedOSPlatformVersion>14.0</SupportedOSPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="..\shared.csproj" />
|
||||||
|
</Project>
|
|
@ -0,0 +1,2 @@
|
||||||
|
TOP=../../..
|
||||||
|
include $(TOP)/tests/common/shared-dotnet-test.mk
|
|
@ -0,0 +1 @@
|
||||||
|
include ../shared.mk
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net7.0-ios</TargetFramework>
|
||||||
|
<SupportedOSPlatformVersion>11.0</SupportedOSPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="..\shared.csproj" />
|
||||||
|
</Project>
|
|
@ -0,0 +1 @@
|
||||||
|
include ../shared.mk
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net7.0-macos</TargetFramework>
|
||||||
|
<SupportedOSPlatformVersion>10.15</SupportedOSPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="..\shared.csproj" />
|
||||||
|
</Project>
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
|
||||||
|
<ApplicationTitle>MySimpleApp</ApplicationTitle>
|
||||||
|
<ApplicationId>com.xamarin.mysimpleapp</ApplicationId>
|
||||||
|
<ApplicationVersion>7.0</ApplicationVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<Import Project="../../common/shared-dotnet.csproj" />
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="../*.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
|
@ -0,0 +1,4 @@
|
||||||
|
TOP=../../../..
|
||||||
|
TESTNAME=Net7_0SimpleApp
|
||||||
|
TEST_TFM=net7.0
|
||||||
|
include $(TOP)/tests/common/shared-dotnet.mk
|
|
@ -0,0 +1 @@
|
||||||
|
include ../shared.mk
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net7.0-tvos</TargetFramework>
|
||||||
|
<SupportedOSPlatformVersion>11.0</SupportedOSPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="..\shared.csproj" />
|
||||||
|
</Project>
|
|
@ -1000,6 +1000,36 @@ namespace Xamarin.Tests {
|
||||||
ExecuteWithMagicWordAndAssert (platform, runtimeIdentifiers, appExecutable);
|
ExecuteWithMagicWordAndAssert (platform, runtimeIdentifiers, appExecutable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[TestCase (ApplePlatform.iOS, "iossimulator-x64")]
|
||||||
|
[TestCase (ApplePlatform.iOS, "ios-arm64")]
|
||||||
|
[TestCase (ApplePlatform.TVOS, "tvossimulator-arm64")]
|
||||||
|
[TestCase (ApplePlatform.MacOSX, "osx-arm64")]
|
||||||
|
[TestCase (ApplePlatform.MacCatalyst, "maccatalyst-x64")]
|
||||||
|
public void BuildNet7_0App (ApplePlatform platform, string runtimeIdentifiers)
|
||||||
|
{
|
||||||
|
var project = "Net7_0SimpleApp";
|
||||||
|
Configuration.IgnoreIfIgnoredPlatform (platform);
|
||||||
|
Configuration.AssertRuntimeIdentifiersAvailable (platform, runtimeIdentifiers);
|
||||||
|
|
||||||
|
var project_path = GetProjectPath (project, runtimeIdentifiers: runtimeIdentifiers, platform: platform, out var appPath, netVersion: "net7.0");
|
||||||
|
Clean (project_path);
|
||||||
|
var properties = GetDefaultProperties (runtimeIdentifiers);
|
||||||
|
|
||||||
|
var result = DotNet.AssertBuild (project_path, properties);
|
||||||
|
AssertThatLinkerExecuted (result);
|
||||||
|
var infoPlistPath = GetInfoPListPath (platform, appPath);
|
||||||
|
Assert.That (infoPlistPath, Does.Exist, "Info.plist");
|
||||||
|
var infoPlist = PDictionary.FromFile (infoPlistPath)!;
|
||||||
|
Assert.AreEqual ("com.xamarin.mysimpleapp", infoPlist.GetString ("CFBundleIdentifier").Value, "CFBundleIdentifier");
|
||||||
|
Assert.AreEqual ("MySimpleApp", infoPlist.GetString ("CFBundleDisplayName").Value, "CFBundleDisplayName");
|
||||||
|
Assert.AreEqual ("7.0", infoPlist.GetString ("CFBundleVersion").Value, "CFBundleVersion");
|
||||||
|
Assert.AreEqual ("7.0", infoPlist.GetString ("CFBundleShortVersionString").Value, "CFBundleShortVersionString");
|
||||||
|
|
||||||
|
var appExecutable = GetNativeExecutable (platform, appPath);
|
||||||
|
ExecuteWithMagicWordAndAssert (platform, runtimeIdentifiers, appExecutable);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[TestCase (ApplePlatform.iOS, "iossimulator-x64")]
|
[TestCase (ApplePlatform.iOS, "iossimulator-x64")]
|
||||||
// [TestCase (ApplePlatform.TVOS, "tvos-arm64")] // Currently doesn't work because we overwrite the required MtouchExtraArgs in tests/nunit.frameworks.target in this test.
|
// [TestCase (ApplePlatform.TVOS, "tvos-arm64")] // Currently doesn't work because we overwrite the required MtouchExtraArgs in tests/nunit.frameworks.target in this test.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче