diff --git a/.github/workflows/build-ubuntu.yml b/.github/workflows/build-ubuntu.yml index 6d4df17..4a7cfc0 100644 --- a/.github/workflows/build-ubuntu.yml +++ b/.github/workflows/build-ubuntu.yml @@ -33,16 +33,9 @@ jobs: dotnet test --no-build --configuration ${{matrix.configuration}} --verbosity normal - --blame --blame-crash + --blame-crash --results-directory "TestResults-${{ matrix.configuration}}-${{ matrix.dotnet-version }}" src/ManagedObjectSize.Tests/ManagedObjectSize.Tests.csproj - # - name: Upload dotnet test results - # uses: actions/upload-artifact@v3 - # with: - # name: dotnet-testoutput-${{ matrix.configuration}}-${{ matrix.dotnet-version }} - # path: TestOutput-${{ matrix.configuration}}-${{ matrix.dotnet-version }} - # # Use always() to always run this step to publish test results when there are test failures - # if: ${{ always() }} - name: Upload dotnet test results uses: actions/upload-artifact@v3 with: diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index dcd97f5..bc25166 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -29,7 +29,26 @@ jobs: - name: Build run: dotnet build --no-restore --configuration ${{matrix.configuration}} src/ManagedObjectSize.sln - name: Test - run: dotnet test --no-build --configuration ${{matrix.configuration}} --verbosity normal src/ManagedObjectSize.Tests/ManagedObjectSize.Tests.csproj + run: > + dotnet test --no-build + --configuration ${{matrix.configuration}} + --verbosity normal + --blame-crash + --results-directory "TestResults-${{ matrix.configuration}}-${{ matrix.dotnet-version }}" + src/ManagedObjectSize.Tests/ManagedObjectSize.Tests.csproj + - name: Upload dotnet test results + uses: actions/upload-artifact@v3 + with: + name: dotnet-testresults-${{ matrix.configuration}}-${{ matrix.dotnet-version }} + path: TestResults-${{ matrix.configuration}}-${{ matrix.dotnet-version }} + # Use always() to always run this step to publish test results when there are test failures + if: ${{ always() }} + - if: ${{ matrix.dotnet-version == '8.0.x' && matrix.configuration == 'Release' }} name: Publish - run: dotnet nuget push **/*.nupkg -k ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json --skip-duplicate --no-symbols + run: > + dotnet nuget push **/*.nupkg + -k ${{secrets.NUGET_API_KEY}} + --source https://api.nuget.org/v3/index.json + --skip-duplicate + --no-symbols diff --git a/src/ManagedObjectSize.Tests/ObjectSizeTests.cs b/src/ManagedObjectSize.Tests/ObjectSizeTests.cs index c3e04d7..35ba691 100644 --- a/src/ManagedObjectSize.Tests/ObjectSizeTests.cs +++ b/src/ManagedObjectSize.Tests/ObjectSizeTests.cs @@ -1,11 +1,8 @@ -using System.Diagnostics; +using ManagedObjectSize.ObjectPool; +using Microsoft.Diagnostics.Runtime; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; -using ManagedObjectSize.ObjectPool; -using ManagedObjectSize.Pooling; -using Microsoft.Diagnostics.Runtime; -using Microsoft.Extensions.ObjectPool; namespace ManagedObjectSize.Tests { @@ -252,11 +249,6 @@ static object CreateData(bool equal, int count) [DataRow(true, false)] public unsafe void ObjectSize_ReportsCorrectSize(bool useRtHelpers, bool useObjectPool) { - if (useRtHelpers && !RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - return; - } - var data = new Dictionary(); // References are on stack and won't be moved by GC. @@ -317,7 +309,7 @@ public unsafe void ObjectSize_ReportsCorrectSize(bool useRtHelpers, bool useObje // We require the addresses of the test objects to not change. We determine the address during GetSize() // and need it to stay the same until we have created a memory snapshot. - if (!GC.TryStartNoGCRegion(100_000_000)) + if (!GC.TryStartNoGCRegion(500_000_000)) { throw new InvalidOperationException("Failed to start no GC region"); }