Skip to content

Commit 704aae2

Browse files
committed
Check in stout file for the MS job
1 parent b90bbb2 commit 704aae2

File tree

9 files changed

+109
-48
lines changed

9 files changed

+109
-48
lines changed
31.1 MB
Binary file not shown.

generator.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"Jobs": {
33
"Microsoft": {
44
"Solution": "Silk.NET.sln",
5-
"SourceProject": "TODO.csproj",
6-
"TestProject": "tests/TODO.csproj",
5+
"SourceProject": "sources/Win32/Win32/Silk.NET.Win32.csproj",
6+
"TestProject": "tests/Win32/Win32/Silk.NET.Win32.UnitTests.csproj",
77
"DefaultLicenseHeader": "eng/silktouch/header.txt",
88
"Mods": [
99
"AddIncludes",
@@ -18,7 +18,8 @@
1818
"sources/Windows/um/icm/Windows.gen.cs": "eng/submodules/terrafx.interop.windows/sources/Interop/Windows/Windows/um/icm/Windows.cs",
1919
"sources/Gdiplus/um/gdiplustypes/GpRect.gen.cs": "eng/submodules/terrafx.interop.windows/sources/Interop/Windows/Gdiplus/um/gdiplustypes/GpRect.cs",
2020
"sources/Gdiplus/um/gdiplustypes/GpRectF.gen.cs": "eng/submodules/terrafx.interop.windows/sources/Interop/Windows/Gdiplus/um/gdiplustypes/GpRectF.cs",
21-
"sources/Gdiplus/um/gdiplustypes/GpPathData.gen.cs": "eng/submodules/terrafx.interop.windows/sources/Interop/Windows/Gdiplus/um/gdiplustypes/GpPathData.cs"
21+
"sources/Gdiplus/um/gdiplustypes/GpPathData.gen.cs": "eng/submodules/terrafx.interop.windows/sources/Interop/Windows/Gdiplus/um/gdiplustypes/GpPathData.cs",
22+
"sources/Windows/shared/strsafe/Windows.gen.cs": "eng/submodules/terrafx.interop.windows/sources/Interop/Windows/Windows/shared/strsafe/Windows.gen.cs"
2223
},
2324
"InputSourceRoot": "eng/submodules/terrafx.interop.windows/sources/Interop/Windows",
2425
"InputTestRoot": "eng/submodules/terrafx.interop.windows/tests/Interop/Windows",

tests/SilkTouch/SilkTouch/ArrayParameterTransformerTests.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
namespace Silk.NET.SilkTouch.UnitTests;
1414

15-
[TestFixture]
1615
public class ArrayParameterTransformerTests
1716
{
1817
[
@@ -247,7 +246,7 @@ public bool TryGetChildSymbolMetadata(
247246
IsOut: childNativeName.Contains('o'),
248247
IsIn: childNativeName.Contains('i')
249248
)
250-
)
249+
),
251250
],
252251
ElementTypeConstraints: new SymbolConstraints(
253252
[
@@ -257,7 +256,7 @@ public bool TryGetChildSymbolMetadata(
257256
null,
258257
null,
259258
new UsageConstraints()
260-
)
259+
),
261260
]
262261
),
263262
IsMutable: childNativeName.Contains('m')
@@ -279,7 +278,7 @@ public bool TryGetChildSymbolMetadata(
279278
IsOut: childNativeName.Contains('o'),
280279
IsIn: childNativeName.Contains('i')
281280
)
282-
)
281+
),
283282
],
284283
ElementTypeConstraints: new SymbolConstraints(
285284
[
@@ -289,7 +288,7 @@ public bool TryGetChildSymbolMetadata(
289288
null,
290289
null,
291290
new UsageConstraints()
292-
)
291+
),
293292
]
294293
),
295294
IsMutable: childNativeName.Contains('m')
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using System.Collections;
5+
using System.Runtime.CompilerServices;
6+
using Microsoft.Extensions.Logging.Abstractions;
7+
using Silk.NET.SilkTouch.Caching;
8+
9+
namespace Silk.NET.SilkTouch.UnitTests.Caching;
10+
11+
public class CacheTests
12+
{
13+
static CacheTests() => Init();
14+
15+
private static void Init([CallerFilePath] string filePath = "") =>
16+
FileSystemCacheProvider.CommonDir = Path.Combine(
17+
Path.GetDirectoryName(filePath)!,
18+
"TestData.tmp"
19+
);
20+
21+
[Test]
22+
public async Task ShouldNotCreateNewCacheWithoutAllowNewAsync()
23+
{
24+
var provider = new FileSystemCacheProvider(new NullLogger<FileSystemCacheProvider>());
25+
foreach (
26+
var intent in (IEnumerable<CacheIntent>)
27+
[CacheIntent.ResolvedForeignInput, CacheIntent.StageIntermediateOutput]
28+
)
29+
{
30+
foreach (
31+
var flag in (IEnumerable<CacheFlags>)
32+
[CacheFlags.None, CacheFlags.RequireHostDirectory]
33+
)
34+
{
35+
foreach (
36+
var access in (IEnumerable<FileAccess>)
37+
[FileAccess.Read, FileAccess.Write, FileAccess.ReadWrite]
38+
)
39+
{
40+
var dir = await provider.GetDirectoryAsync(
41+
"ShouldNotCreateNewCacheWithoutAllowNew",
42+
intent,
43+
flag,
44+
access
45+
);
46+
Assert.That(dir, Is.Null);
47+
}
48+
}
49+
}
50+
}
51+
}

tests/SilkTouch/SilkTouch/DummyModContext.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ public class DummyModContext : IModContext
1212
public ValueTask DisposeAsync() => ValueTask.CompletedTask;
1313

1414
public string JobKey { get; set; } = string.Empty;
15-
public string JobCacheKey { get; set; } = string.Empty;
1615
public string? ConfigurationDirectory { get; set; }
1716
public Project? SourceProject { get; set; }
1817
public Project? TestProject { get; set; }

tests/SilkTouch/SilkTouch/Khronos/MixKhronosDataTests.cs

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
namespace Silk.NET.SilkTouch.UnitTests.Khronos;
1616

17-
[TestFixture]
1817
public class MixKhronosDataTests
1918
{
2019
struct Options : IOptionsSnapshot<MixKhronosData.Configuration>
@@ -50,41 +49,44 @@ private static IAsyncEnumerable<object[]> TestCases()
5049
IEnumerable<string> files = ["gl.xml", "wgl.xml", "glx.xml", "cl.xml", "vk.xml"];
5150
return files
5251
.ToAsyncEnumerable()
53-
.Select(async (x, ct) =>
54-
{
55-
var mod = new MixKhronosData(
56-
new NullLogger<MixKhronosData>(),
57-
new Options
58-
{
59-
Value = new MixKhronosData.Configuration { SpecPath = TestFile(x) },
60-
}
61-
);
62-
await mod.InitializeAsync(new DummyModContext(), ct);
63-
return (object[])[x, mod.Jobs[""]];
64-
});
52+
.Select(
53+
async (x, ct) =>
54+
{
55+
var mod = new MixKhronosData(
56+
new NullLogger<MixKhronosData>(),
57+
new Options
58+
{
59+
Value = new MixKhronosData.Configuration { SpecPath = TestFile(x) },
60+
}
61+
);
62+
await mod.InitializeAsync(new DummyModContext(), ct);
63+
return (object[])[x, mod.Jobs[""]];
64+
}
65+
);
6566
}
6667

6768
private static IAsyncEnumerable<object[]> EnumTestCases() =>
6869
TestCases().Where(x => x[0] is "gl.xml" or "wgl.xml" or "glx.xml" or "cl.xml");
6970

7071
private static IAsyncEnumerable<object[]> RegressionTestCases() =>
7172
TestCases()
72-
.Select(async (object[] s, CancellationToken ct) =>
73-
s[0] is "gl.xml" or "cl.xml"
74-
? (object[])
75-
[
76-
s[0],
77-
s[1],
78-
await Task.WhenAll(
79-
TestFiles(
80-
new Regex(
81-
$@"regression\.2\.21\.{((string)s[0])[..^4]}.*\.json\.gz"
73+
.Select(
74+
async (object[] s, CancellationToken ct) =>
75+
s[0] is "gl.xml" or "cl.xml"
76+
? (object[])
77+
[
78+
s[0],
79+
s[1],
80+
await Task.WhenAll(
81+
TestFiles(
82+
new Regex(
83+
$@"regression\.2\.21\.{((string)s[0])[..^4]}.*\.json\.gz"
84+
)
8285
)
83-
)
84-
.Select(ReadProfile)
85-
),
86-
]
87-
: null
86+
.Select(ReadProfile)
87+
),
88+
]
89+
: null
8890
)
8991
.OfType<object[]>();
9092

tests/SilkTouch/SilkTouch/MetadataUtilsTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Silk.NET.SilkTouch.UnitTests;
99

10-
[TestFixture]
1110
public class MetadataUtilsTests
1211
{
1312
[

tests/SilkTouch/SilkTouch/ModUtilsTests.cs

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,32 @@
33

44
namespace Silk.NET.SilkTouch.UnitTests;
55

6-
[TestFixture]
76
public class ModUtilsTests
87
{
9-
private static readonly (string Input, string EffectiveName, string Directory, string Remainder)[]
10-
GetEffectiveNameTests = [
11-
("hello/GL.gen.cs", "GL", "hello/", ".gen.cs"),
12-
("hello/GL.Manual.cs", "GL.Manual", "hello/", ".cs"),
13-
("hello/GL.Interfaces.gen.cs", "GL.Interfaces", "hello/", ".gen.cs")
14-
];
8+
private static readonly (
9+
string Input,
10+
string EffectiveName,
11+
string Directory,
12+
string Remainder
13+
)[] GetEffectiveNameTests =
14+
[
15+
("hello/GL.gen.cs", "GL", "hello/", ".gen.cs"),
16+
("hello/GL.Manual.cs", "GL.Manual", "hello/", ".cs"),
17+
("hello/GL.Interfaces.gen.cs", "GL.Interfaces", "hello/", ".gen.cs"),
18+
];
1519

1620
[Test]
1721
public void GetEffectiveName(
18-
[ValueSource(nameof(GetEffectiveNameTests))] (string Input, string EffectiveName, string Directory, string Remainder) testData)
22+
[ValueSource(nameof(GetEffectiveNameTests))]
23+
(string Input, string EffectiveName, string Directory, string Remainder) testData
24+
)
1925
{
20-
ModUtils.GetEffectiveName(testData.Input, out var effectiveName, out var directory, out var remainder);
26+
ModUtils.GetEffectiveName(
27+
testData.Input,
28+
out var effectiveName,
29+
out var directory,
30+
out var remainder
31+
);
2132
Assert.That(effectiveName.ToString(), Is.EqualTo(testData.EffectiveName));
2233
Assert.That(directory.ToString(), Is.EqualTo(testData.Directory));
2334
Assert.That(remainder.ToString(), Is.EqualTo(testData.Remainder));

tests/SilkTouch/SilkTouch/Naming/NameTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
namespace Silk.NET.SilkTouch.UnitTests.Naming;
88

9-
[TestFixture]
109
public class NameTests : NameTrimmer
1110
{
1211
[Test, TestCase(null), TestCase("glfw")]

0 commit comments

Comments
 (0)