-
Notifications
You must be signed in to change notification settings - Fork 559
Expand file tree
/
Copy pathSdkDbTest.cs
More file actions
80 lines (70 loc) · 3.1 KB
/
SdkDbTest.cs
File metadata and controls
80 lines (70 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using Xamarin;
using Xamarin.Tests;
namespace Sharpie.Bind.Tests;
public class SdkDbTest {
static IEnumerable<TestCaseData> TestCases {
get {
var desktopCompilerArguments = new string [] {
"-DGL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED",
};
var desktopExcludeNoModules = new string [] {
"Kerberos",
};
var macOSExclude = new string [] {
//"AccessorySetupKit", // not available on macOS, causes SHARPIE0014: The framework 'AccessorySetupKit' was specified in the excluded frameworks list but was not found in the SDK
"DriverKit", // must be compiled as C++?
"Tk", // depends on X11 headers, which don't exist anymore
};
var macCatalystExclude = new string [] {
// most of these frameworks are not available on Mac Catalyst
"AccessorySetupKit",
"AudioVideoBridging",
"Carbon",
"CompositorServices",
"DiscRecordingUI",
"DriverKit", // must be compiled as C++?
"FSKit",
"GLKit",
"Hypervisor",
"InputMethodKit",
"InstallerPlugins",
"LDAP",
"Tk", // depends on X11 headers, which don't exist anymore
"Quartz",
"QuickLookUI",
"Virtualization",
};
var sdkNames = new [] {
( Platform: "iOS", Sdk: "iphoneos" + SdkVersions.iOS, ExcludedFrameworks: [], NoModulesExcludedFrameworks: [], ClangArguments: [] ),
( Platform: "tvOS", Sdk: "appletvos" + SdkVersions.TVOS, ExcludedFrameworks: [], NoModulesExcludedFrameworks: [], ClangArguments: [] ),
( Platform: "macOS", Sdk: "macosx" + SdkVersions.OSX, ExcludedFrameworks: macOSExclude, NoModulesExcludedFrameworks: desktopExcludeNoModules, ClangArguments: desktopCompilerArguments ),
( Platform: "MacCatalyst", Sdk: "ios" + SdkVersions.MacCatalyst + "-macabi", ExcludedFrameworks: macCatalystExclude, NoModulesExcludedFrameworks: desktopExcludeNoModules, ClangArguments: desktopCompilerArguments ),
};
foreach (var sdk in sdkNames) {
yield return new TestCaseData (false, sdk.Sdk, sdk.ExcludedFrameworks.Union (sdk.NoModulesExcludedFrameworks).ToArray (), sdk.ClangArguments).SetName ($"{sdk.Platform} (no modules)");
yield return new TestCaseData (true, sdk.Sdk, sdk.ExcludedFrameworks, sdk.ClangArguments).SetName ($"{sdk.Platform} (with modules)");
}
}
}
[Test]
[TestCaseSource (nameof (TestCases))]
public void TestSdkPath (bool usingModules, string sdk, string []? excludedFrameworks = null, string []? clangArguments = null)
{
var tmpdir = Cache.CreateTemporaryDirectory ();
var binder = new SdkDbTool ();
if (clangArguments is not null)
binder.ClangArguments.AddRange (clangArguments);
binder.EnableModules = usingModules;
binder.ExcludedFrameworks.AddRange (excludedFrameworks ?? Array.Empty<string> ());
binder.Sdk = sdk;
binder.OutputDirectory = tmpdir;
binder.PlatformAssembly = Extensions.GetPlatformAssemblyPath (binder.Platform);
Configuration.IgnoreIfIgnoredPlatform (binder.Platform);
binder.ClangResourceDirectory = Extensions.GetClangResourceDirectory ();
var rv = binder.BindInOrOut ();
rv.AssertSuccess (null);
rv.AssertNoWarnings ();
}
}