Skip to content

Commit

Permalink
Record more details on test results
Browse files Browse the repository at this point in the history
Mainly to support the investigation of weird crashes of test runners on MacOS environments.
---
On MacOS, `dotnet  test` often crashed with an output like this:
--------------
The active test run was aborted. Reason: Test host process crashed : #
# Fatal error in , line 0
# Check failed: 12 == (*__error()).
#
#
#
#FailureMessage Object: 0x7000099fac00

Results File: /Users/runner/work/elm-time/elm-time/implement/test-elm-time/TestResults/_Mac-1684933830638_2023-05-24_13_11_43.trx

Test Run Aborted with error System.Exception: One or more errors occurred.
Passed!  - Failed:     0, Passed:     4, Skipped:     0, Total:     4, Duration: 4 s - test-elm-time.dll (net7.0)
 ---> System.Exception: Unable to read beyond the end of the stream.
   at System.IO.BinaryReader.Read7BitEncodedInt()
   at System.IO.BinaryReader.ReadString()
   at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.LengthPrefixCommunicationChannel.NotifyDataAvailable()
   at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TcpClientExtensions.MessageLoopAsync(TcpClient client, ICommunicationChannel channel, Action`1 errorHandler, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---.
Error: Process completed with exit code 1.
------------
See microsoft/vstest#4376 and microsoft/vstest#2952
  • Loading branch information
Viir committed May 24, 2023
1 parent b53ff67 commit d1bd42c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/test-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: dotnet clean ./implement/test-elm-time/test-elm-time.csproj && dotnet nuget locals all --clear

- name: Run tests with dotnet test
run: dotnet test ./implement/test-elm-time/test-elm-time.csproj --logger trx
run: dotnet test ./implement/test-elm-time/test-elm-time.csproj --logger "trx" --diag "./implement/test-elm-time/TestResults/diag-log.txt" --verbosity diagnostic

- name: Publish test results
uses: actions/upload-artifact@v3
Expand All @@ -45,6 +45,16 @@ jobs:
name: test-results-${{ github.sha }}-${{ matrix.environment }}
path: ./implement/test-elm-time/TestResults

- name: Summarize Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v2
if: always()
with:
check_name: "Test Results Summaries ${{ matrix.environment }}"
files: |
./implement/test-elm-time/TestResults/**/*.xml
./implement/test-elm-time/TestResults/**/*.trx
./implement/test-elm-time/TestResults/**/*.json
- name: dotnet publish
run: dotnet publish -c Debug -r ${{ matrix.publish-runtime-id }} --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:IncludeAllContentForSelfExtract=true -p:PublishReadyToRun=true -p:PublishReadyToRunShowWarnings=true --output ./publish ./implement/elm-time

Expand Down
2 changes: 1 addition & 1 deletion implement/elm-time/elm-time.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.5.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="7.0.5" />
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
<PackageReference Include="ReadLine" Version="2.0.1" />
<PackageReference Include="SharpCompress" Version="0.33.0" />
<PackageReference Include="TupleAsJsonArray" Version="1.0.2" />
Expand Down
13 changes: 2 additions & 11 deletions implement/test-elm-time/JavaScriptEngineTest.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using ElmTime;
using Microsoft.ClearScript;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace TestElmTime;

Expand All @@ -11,15 +9,8 @@ public class JavaScriptEngineTest
[TestMethod]
public void Evaluate_in_JavaScriptEngine()
{
try
{
var jsEngine = JsEngineFromJavaScriptEngineSwitcher.ConstructJsEngine();
var jsEngine = JsEngineFromJavaScriptEngineSwitcher.ConstructJsEngine();

Assert.AreEqual(4, jsEngine.Evaluate("3 + 1"));
}
finally
{
Console.WriteLine("HostSettings.AuxiliarySearchPath: " + HostSettings.AuxiliarySearchPath);
}
Assert.AreEqual(4, jsEngine.Evaluate("3 + 1"));
}
}
4 changes: 2 additions & 2 deletions implement/test-elm-time/test-elm-time.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
<PackageReference Include="morelinq" Version="3.3.2" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down

0 comments on commit d1bd42c

Please sign in to comment.