Skip to content

Commit

Permalink
Small Tsavorite project file clean-up (#297)
Browse files Browse the repository at this point in the history
* Remove all AssemblyInfo.cs from Tsavorite

* Tsavorite.benchmark: Remove app.config and simplify .csproj

* Tsavorite.core: Clean-up .csproj

* Tsavorite.devices.AzureStorageDevice: Clean-up .csproj

* Tsavorite.test: Remove app.config and clean-up .csproj

* Tsavorite.test: Use OperatingSystem APIs instead of preprocessor directives

* Update libs/storage/Tsavorite/cs/test/TestUtils.cs

Co-authored-by: Paulus Pärssinen <paulus.parssinen@gmail.com>

* Update libs/storage/Tsavorite/cs/test/BasicTests.cs
  • Loading branch information
PaulusParssinen authored Apr 24, 2024
1 parent 8fed778 commit b672777
Show file tree
Hide file tree
Showing 16 changed files with 16 additions and 266 deletions.
17 changes: 0 additions & 17 deletions libs/storage/Tsavorite/cs/benchmark/App.config

This file was deleted.

38 changes: 0 additions & 38 deletions libs/storage/Tsavorite/cs/benchmark/Properties/AssemblyInfo.cs

This file was deleted.

20 changes: 0 additions & 20 deletions libs/storage/Tsavorite/cs/benchmark/Tsavorite.benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,11 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RootNamespace>Tsavorite.benchmark</RootNamespace>
<ErrorReport>prompt</ErrorReport>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
<AssemblyOriginatorKeyFile>../../../../../Garnet.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<SignAssembly>true</SignAssembly>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<DefineConstants>TRACE</DefineConstants>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\x64\Release\</OutputPath>
</PropertyGroup>

<ItemGroup>
<None Include="App.config" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
</ItemGroup>
Expand Down
21 changes: 0 additions & 21 deletions libs/storage/Tsavorite/cs/src/core/Properties/AssemblyInfo.cs

This file was deleted.

14 changes: 0 additions & 14 deletions libs/storage/Tsavorite/cs/src/core/Tsavorite.core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,16 @@

<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RootNamespace>Tsavorite.core</RootNamespace>
<AssemblyName>Tsavorite.core</AssemblyName>
<ErrorReport>prompt</ErrorReport>
<SignAssembly>true</SignAssembly>
<ApplicationIcon />
<OutputType>Library</OutputType>
<StartupObject />
<AssemblyOriginatorKeyFile>../../../../../../Garnet.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<DocumentationFile>bin\$(Platform)\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DefineConstants>DEBUG</DefineConstants>
<DebugType>full</DebugType>
<WarningsAsErrors>;NU1605</WarningsAsErrors>
<OutputPath>bin\$(Platform)\Debug\</OutputPath>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<DefineConstants></DefineConstants>
<Optimize>true</Optimize>
<OutputPath>bin\$(Platform)\Release\</OutputPath>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,14 @@
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RootNamespace>Tsavorite.devices</RootNamespace>
<AssemblyName>Tsavorite.devices.AzureStorageDevice</AssemblyName>
<ErrorReport>prompt</ErrorReport>
<SignAssembly>true</SignAssembly>
<ApplicationIcon />
<OutputType>Library</OutputType>
<StartupObject />
<AssemblyOriginatorKeyFile>../../../../../../../Garnet.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<DocumentationFile>bin\$(Platform)\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DebugType>full</DebugType>
<OutputPath>bin\$(Platform)\Debug\</OutputPath>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<OutputPath>bin\$(Platform)\Release\</OutputPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Storage.Blobs" Version="12.14.1" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
Expand Down
6 changes: 4 additions & 2 deletions libs/storage/Tsavorite/cs/test/BasicTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Linq;
using System.Threading.Tasks;
using NUnit.Framework;
using NUnit.Framework.Internal;
using Tsavorite.core;
using static Tsavorite.test.TestUtils;

Expand Down Expand Up @@ -796,16 +797,17 @@ public static void KVBasicsSampleEndToEndInDocs()
Assert.AreEqual(10, output);
}

#if WINDOWS
[Test]
[Category("TsavoriteKV")]
public static void LogPathtooLong()
{
if (!OperatingSystem.IsWindows())
Assert.Ignore("Skipped");

string testDir = new('x', Native32.WIN32_MAX_PATH - 11); // As in LSD, -11 for ".<segment>"
using var log = Devices.CreateLogDevice(testDir, deleteOnClose: true); // Should succeed
Assert.Throws(typeof(TsavoriteException), () => Devices.CreateLogDevice(testDir + "y", deleteOnClose: true));
}
#endif

[Test]
[Category("TsavoriteKV")]
Expand Down
5 changes: 2 additions & 3 deletions libs/storage/Tsavorite/cs/test/EnqueueTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,9 @@ public async Task EnqueueAsyncBasicTest([Values] TestUtils.DeviceType deviceType
device = TestUtils.CreateTestDevice(deviceType, filename);
log = new TsavoriteLog(new TsavoriteLogSettings { LogDevice = device, SegmentSizeBits = 22, LogCommitDir = TestUtils.MethodTestDir });

#if WINDOWS
if (deviceType == TestUtils.DeviceType.EmulatedAzure)
if (OperatingSystem.IsWindows() && deviceType == TestUtils.DeviceType.EmulatedAzure)
return;
#endif

CancellationToken cancellationToken = default;
ReadOnlyMemory<byte> readOnlyMemoryEntry = entry;
ReadOnlySpanBatch spanBatch = new ReadOnlySpanBatch(5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void TearDown()
[Test]
[Category("TsavoriteKV")]
[Category("Smoke")]
public void LogCompactBasicTest([Values] DeviceType deviceType, [Values] CompactionType compactionType)
public void LogCompactBasicTest([Values] CompactionType compactionType)
{
MyInput input = new();

Expand Down
46 changes: 0 additions & 46 deletions libs/storage/Tsavorite/cs/test/Properties/AssemblyInfo.cs

This file was deleted.

16 changes: 2 additions & 14 deletions libs/storage/Tsavorite/cs/test/ReadCacheChainTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -751,13 +751,7 @@ unsafe void PopulateAndEvict()
//[Repeat(300)]
#pragma warning disable IDE0060 // Remove unused parameter (modRange is used by Setup())
public void LongRcMultiThreadTest([Values] HashModulo modRange, [Values(0, 1, 2, 8)] int numReadThreads, [Values(0, 1, 2, 8)] int numWriteThreads,
[Values(UpdateOp.Upsert, UpdateOp.RMW)] UpdateOp updateOp,
#if WINDOWS
[Values(DeviceType.LSD
#else
[Values(DeviceType.MLSD
#endif
)] DeviceType deviceType)
[Values(UpdateOp.Upsert, UpdateOp.RMW)] UpdateOp updateOp)
#pragma warning restore IDE0060 // Remove unused parameter
{
if (numReadThreads == 0 && numWriteThreads == 0)
Expand Down Expand Up @@ -978,13 +972,7 @@ static void ClearCountsOnError(ClientSession<SpanByte, SpanByte, SpanByte, SpanB
[Category(StressTestCategory)]
//[Repeat(300)]
public void SpanByteRcMultiThreadTest([Values] HashModulo modRange, [Values(0, 1, 2, 8)] int numReadThreads, [Values(0, 1, 2, 8)] int numWriteThreads,
[Values(UpdateOp.Upsert, UpdateOp.RMW)] UpdateOp updateOp,
#if WINDOWS
[Values(DeviceType.LSD
#else
[Values(DeviceType.MLSD
#endif
)] DeviceType deviceType)
[Values(UpdateOp.Upsert, UpdateOp.RMW)] UpdateOp updateOp)
{
if (numReadThreads == 0 && numWriteThreads == 0)
Assert.Ignore("Skipped due to 0 threads for both read and update");
Expand Down
8 changes: 1 addition & 7 deletions libs/storage/Tsavorite/cs/test/ReproReadCacheTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,7 @@ public void TearDown()
[Category(StressTestCategory)]
//[Repeat(300)]
public unsafe void RandomReadCacheTest([Values(1, 2, 8)] int numThreads, [Values] KeyContentionMode keyContentionMode,
[Values] ConcurrencyControlMode concurrencyControlMode, [Values] ReadCacheMode readCacheMode,
#if WINDOWS
[Values(DeviceType.LSD
#else
[Values(DeviceType.MLSD
#endif
)] DeviceType deviceType)
[Values] ConcurrencyControlMode concurrencyControlMode, [Values] ReadCacheMode readCacheMode)
{
if (numThreads == 1 && keyContentionMode == KeyContentionMode.Contention)
Assert.Ignore("Skipped because 1 thread cannot have contention");
Expand Down
15 changes: 5 additions & 10 deletions libs/storage/Tsavorite/cs/test/TestUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

using System;
using System.IO;
#if WINDOWS
using System.Runtime.InteropServices;
#endif
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
Expand Down Expand Up @@ -115,9 +112,7 @@ internal static void IgnoreIfNotRunningAzureTests()
// Cannot use LocalStorageDevice from non-Windows OS platform
public enum DeviceType
{
#if WINDOWS
LSD,
#endif
EmulatedAzure,
MLSD,
LocalMemory
Expand All @@ -134,14 +129,14 @@ internal static IDevice CreateTestDevice(DeviceType testDeviceType, string filen

switch (testDeviceType)
{
#if WINDOWS
case DeviceType.LSD:
case DeviceType.LSD when !OperatingSystem.IsWindows():
Assert.Ignore($"Skipping {nameof(DeviceType.LSD)} on non-Windows platforms");
break;
case DeviceType.LSD when OperatingSystem.IsWindows():
bool useIoCompletionPort = false;
bool disableFileBuffering = true;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) // avoids CA1416 // Validate platform compatibility
device = new LocalStorageDevice(filename, preallocateFile, deleteOnClose, disableFileBuffering, capacity, recoverDevice, useIoCompletionPort);
device = new LocalStorageDevice(filename, preallocateFile, deleteOnClose, disableFileBuffering, capacity, recoverDevice, useIoCompletionPort);
break;
#endif
case DeviceType.EmulatedAzure:
IgnoreIfNotRunningAzureTests();
device = new AzureStorageDevice(AzureEmulatedStorageString, AzureTestContainer, AzureTestDirectory, Path.GetFileName(filename), deleteOnClose: deleteOnClose, logger: TestLoggerFactory.CreateLogger("asd"));
Expand Down
4 changes: 1 addition & 3 deletions libs/storage/Tsavorite/cs/test/TryEnqueueBasicTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,9 @@ public void TryEnqueueBasicTest([Values] TryEnqueueIteratorType iteratorType, [V
device = TestUtils.CreateTestDevice(deviceType, filename);
log = new TsavoriteLog(new TsavoriteLogSettings { LogDevice = device, SegmentSizeBits = 22, LogCommitDir = TestUtils.MethodTestDir });

#if WINDOWS
// Issue with Non Async Commit and Emulated Azure so don't run it - at least put after device creation to see if crashes doing that simple thing
if (deviceType == TestUtils.DeviceType.EmulatedAzure)
if (OperatingSystem.IsWindows() && deviceType == TestUtils.DeviceType.EmulatedAzure)
return;
#endif

// Reduce SpanBatch to make sure entry fits on page
if (iteratorType == TryEnqueueIteratorType.SpanBatch)
Expand Down
Loading

0 comments on commit b672777

Please sign in to comment.