Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi OS tests #466

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: "Paprika Tests"


concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -17,7 +18,7 @@
jobs:
tests:
timeout-minutes: 20
name: "Run Paprika tests"
name: "Paprika tests"
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down Expand Up @@ -56,3 +57,25 @@
header: Code Coverage
recreate: true
path: code-coverage-results.md

os-tests:
timeout-minutes: 10
name: "OS dependent tests"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Check out repository
uses: actions/checkout@v4
with:
submodules: true

- name: Test (OS Category Only)
run: dotnet test src/Paprika.OS.Tests -c ${{ env.BUILD_CONFIG }}
Fixed Show fixed Hide fixed
15 changes: 15 additions & 0 deletions src/Paprika.OS.Tests/OsTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Runtime.InteropServices;

namespace Paprika.Tests.OS;

/// <summary>
/// A dummy suite testing execution on different systems.
/// </summary>
public class OsTests
{
[Test]
public void Test()
{
Console.WriteLine(RuntimeInformation.OSDescription);
}
}
43 changes: 43 additions & 0 deletions src/Paprika.OS.Tests/PageManagerTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using Paprika.Store;
using Paprika.Store.PageManagers;

namespace Paprika.Tests.OS;

public class PageManagerTests
{
private string _path;
private const long Mb8 = 8 * 1024 * 1024;

[TestCase(true)]
[TestCase(false)]
public async Task WritePages(bool continuous)
{
const long size = Mb8;

using var manager = new MemoryMappedPageManager(size, 2, _path, PersistenceOptions.FlushFile);

const long pageCount = size / Page.PageSize / 4;

var pages = new DbAddress[pageCount];
for (uint i = 0; i < pageCount; i++)
{
pages[i] = new DbAddress(continuous ? i : i * 2);
}

await manager.WritePages(pages, CommitOptions.FlushDataOnly);
}

[SetUp]
public void SetUp()
{
var ctx = TestContext.CurrentContext;
_path = Path.Combine(ctx.TestDirectory, ctx.Test.Name);

if (Directory.Exists(_path))
{
Directory.Delete(_path, true);
}

Directory.CreateDirectory(_path);
}
}
29 changes: 29 additions & 0 deletions src/Paprika.OS.Tests/Paprika.OS.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<RootNamespace>Paprika.Tests.OS</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="[7.1.0]" />
<PackageReference Include="JetBrains.dotMemoryUnit" Version="3.2.20220510" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" version="4.6.0" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NUnit.Analyzers" Version="4.4.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Spectre.Console" Version="0.49.1" />
<PackageReference Include="Verify.NUnit" Version="28.4.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Paprika\Paprika.csproj" />
</ItemGroup>

</Project>
10 changes: 10 additions & 0 deletions src/Paprika.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Paprika.Runner.Pareto", "Pa
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Paprika.Cli", "Paprika.Cli\Paprika.Cli.csproj", "{DD0B1FB7-6D29-47A1-B467-03F28B15FCAE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Paprika.OS.Tests", "Paprika.OS.Tests\Paprika.OS.Tests.csproj", "{D58DCCC7-D131-476E-87FE-C08EBD00CDEF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{B1E3D229-DF3A-4ADA-9DF3-91210D571670}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -48,7 +52,13 @@ Global
{DD0B1FB7-6D29-47A1-B467-03F28B15FCAE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DD0B1FB7-6D29-47A1-B467-03F28B15FCAE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DD0B1FB7-6D29-47A1-B467-03F28B15FCAE}.Release|Any CPU.Build.0 = Release|Any CPU
{D58DCCC7-D131-476E-87FE-C08EBD00CDEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D58DCCC7-D131-476E-87FE-C08EBD00CDEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D58DCCC7-D131-476E-87FE-C08EBD00CDEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D58DCCC7-D131-476E-87FE-C08EBD00CDEF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{44B0A996-A65A-4BFE-B9F6-708D5A7E54C5} = {B1E3D229-DF3A-4ADA-9DF3-91210D571670}
{D58DCCC7-D131-476E-87FE-C08EBD00CDEF} = {B1E3D229-DF3A-4ADA-9DF3-91210D571670}
EndGlobalSection
EndGlobal
Loading