Move and fix NuGet test project

このコミットが含まれているのは:
Sergio Pedri committed 2022-06-25 16:55:15 +02:00
1 親 1649001722
コミット 3476aef589
6ファイル変更
+30 -22

検索条件に一致するファイルはありません

+8 -8
ファイルの表示
@@ -19,12 +19,12 @@ public class NativeLibrariesResolverTests
{
string path = Path.GetDirectoryName(typeof(NativeLibrariesResolverTests).Assembly.Location)!;
while (Path.GetFileName(path) is not "ComputeSharp.Tests.NativeLibrariesResolver")
while (Path.GetFileName(path) is not "tests")
{
path = Path.GetDirectoryName(path)!;
}
SampleProjectDirectory = Path.Combine(path, "Project", "ComputeSharp.Sample.NuGet");
SampleProjectDirectory = Path.Combine(path, "ComputeSharp.NuGet");
while (Path.GetFileName(path) is not "ComputeSharp")
{
@@ -42,7 +42,7 @@ public class NativeLibrariesResolverTests
}
/// <summary>
/// Gets the directory of the ComputeSharp.Sample.NuGet project.
/// Gets the directory of the ComputeSharp.NuGet project.
/// </summary>
private static string? SampleProjectDirectory { get; set; }
@@ -68,7 +68,7 @@ public class NativeLibrariesResolverTests
CleanSampleProject(configuration, rid);
BuildSampleProject(configuration, rid);
string realtivePathToDll = Path.Combine("bin", $"{configuration}", "net6.0", $"{ToDirectory(rid)}", "ComputeSharp.Sample.NuGet.dll");
string realtivePathToDll = Path.Combine("bin", $"{configuration}", "net6.0", $"{ToDirectory(rid)}", "ComputeSharp.NuGet.dll");
Assert.AreEqual(0, Exec(SampleProjectDirectory!, "dotnet", realtivePathToDll));
}
@@ -85,7 +85,7 @@ public class NativeLibrariesResolverTests
string pathToDllDirectory = Path.Combine(SampleProjectDirectory!, "bin", $"{configuration}", "net6.0", $"{ToDirectory(rid)}");
Assert.AreEqual(0, Exec(pathToDllDirectory, "dotnet", "ComputeSharp.Sample.NuGet.dll"));
Assert.AreEqual(0, Exec(pathToDllDirectory, "dotnet", "ComputeSharp.NuGet.dll"));
}
[TestMethod]
@@ -98,7 +98,7 @@ public class NativeLibrariesResolverTests
CleanSampleProject(configuration, rid);
BuildSampleProject(configuration, rid);
string relativePathToAppHost = Path.Combine("bin", $"{configuration}", "net6.0", $"{ToDirectory(rid)}", "ComputeSharp.Sample.NuGet.exe");
string relativePathToAppHost = Path.Combine("bin", $"{configuration}", "net6.0", $"{ToDirectory(rid)}", "ComputeSharp.NuGet.exe");
Assert.AreEqual(0, Exec(SampleProjectDirectory!, relativePathToAppHost, ""));
}
@@ -115,7 +115,7 @@ public class NativeLibrariesResolverTests
string pathToAppHostDirectory = Path.Combine(SampleProjectDirectory!, "bin", $"{configuration}", "net6.0", $"{ToDirectory(rid)}");
Assert.AreEqual(0, Exec(pathToAppHostDirectory, "ComputeSharp.Sample.NuGet.exe", ""));
Assert.AreEqual(0, Exec(pathToAppHostDirectory, "ComputeSharp.NuGet.exe", ""));
}
@@ -134,7 +134,7 @@ public class NativeLibrariesResolverTests
Exec(SampleProjectDirectory!, "dotnet", $"publish -c Release -f net6.0 -r win-x64 {ToOption(publishMode)} {ToOption(deploymentMode)} {ToOption(nativeLibsDeploymentMode)} /bl");
string pathToAppHost = Path.Combine("bin", $"Release", "net6.0", "win-x64", "publish", "ComputeSharp.Sample.NuGet.exe");
string pathToAppHost = Path.Combine("bin", $"Release", "net6.0", "win-x64", "publish", "ComputeSharp.NuGet.exe");
Assert.AreEqual(0, Exec(SampleProjectDirectory!, pathToAppHost, ""));
}
@@ -1,15 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net472;netcoreapp3.1;net6.0</TargetFrameworks>
<Platforms>AnyCPU;x64;ARM64</Platforms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ComputeSharp.Core" Version="$(PackageVersion)" />
<PackageReference Include="ComputeSharp" Version="$(PackageVersion)" />
<PackageReference Include="ComputeSharp.Dynamic" Version="$(PackageVersion)" />
</ItemGroup>
</Project>
-35
ファイルの表示
@@ -1,35 +0,0 @@
using System.Diagnostics;
using System.Linq;
using ComputeSharp;
float[] array = Enumerable.Range(1, 100).Select(static i => (float)i).ToArray();
// Create the graphics buffer
using ReadWriteBuffer<float> gpuBuffer = GraphicsDevice.Default.AllocateReadWriteBuffer(array);
// Run the shader
GraphicsDevice.Default.For(100, new MultiplyByTwo(gpuBuffer));
// Get the data back
float[] result = gpuBuffer.ToArray();
// Validate results
for (int i = 0; i < array.Length; i++)
{
Trace.Assert(result[i] == array[i] * 2);
}
/// <summary>
/// A sample kernel that requires dynamic compilation, as it's not precompiled.
/// </summary>
[AutoConstructor]
internal readonly partial struct MultiplyByTwo : IComputeShader
{
public readonly ReadWriteBuffer<float> buffer;
/// <inheritdoc/>
public void Execute()
{
buffer[ThreadIds.X] *= 2;
}
}
-8
ファイルの表示
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!-- This source is for the local NuGet packages, which are all generated in the centralized artifacts root folder -->
<add key="artifacts" value="..\..\..\artifacts" />
</packageSources>
</configuration>