Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dotnet run --project .\Sdk\tests\SmokeTests\SmokeTests.csproj -- --filter-trait
dotnet pack .\Sdk\SVappsLAB.iRacingTelemetrySDK\SVappsLAB.iRacingTelemetrySDK.csproj
```

Run `Category=live` smoke tests only with iRacing running in an active Windows session. Run `Category=manual` tests only when the local developer setup matches the test requirements.
`Category=live` smoke tests need iRacing running in an active Windows session; without it they report as skipped (via `Assert.SkipUnless`), not failed. `Category=manual` tests are marked `Explicit = true`, so they never run by default - add `--explicit on` to run them, and only when the local developer setup matches the test requirements.

`global.json` pins `test.runner` to `Microsoft.Testing.Platform`, so `dotnet test` needs `--project`/`--solution` (a bare positional path is rejected) and does not understand VSTest-style `--filter`. Use `dotnet run --project`, not `dotnet test`, for `SmokeTests` - its `launchSettings.json` injects a default `--filter-class` that `dotnet test` combines with (rather than overrides with) any `--filter-trait` you add, silently yielding "zero tests ran". See `Sdk/tests/README.md` for details.

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,10 @@ dotnet test --project .\Sdk\tests\UnitTests\UnitTests.csproj
# repeatable offline smoke tests using bundled IBT files
dotnet run --project .\Sdk\tests\SmokeTests\SmokeTests.csproj -- --filter-trait Category=ibt

# live smoke tests, requires an active iRacing session
# live smoke tests, requires an active iRacing session (reported as skipped otherwise)
dotnet run --project .\Sdk\tests\SmokeTests\SmokeTests.csproj -- --filter-trait Category=live

# all test projects, including tests that may require live/manual setup
# all test projects (live tests skip without iRacing; manual tests are explicit and do not run)
dotnet test --solution .\Sdk\SVappsLAB.iRacingTelemetrySDK.slnx
```
See [Sdk/tests/README.md](./Sdk/tests/README.md) for manual test commands and filtering notes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.8" />
<PackageReference Include="SVappsLAB.iRacingTelemetrySDK" Version="2.3.0" />
<PackageReference Include="SVappsLAB.iRacingTelemetrySDK" Version="2.4.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Samples/LocationAndWarnings/LocationAndWarnings.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.8" />
<PackageReference Include="SVappsLAB.iRacingTelemetrySDK" Version="2.3.0" />
<PackageReference Include="SVappsLAB.iRacingTelemetrySDK" Version="2.4.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Samples/MinimalExampleAsync/MinimalExampleAsync.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.8" />
<PackageReference Include="SVappsLAB.iRacingTelemetrySDK" Version="2.3.0" />
<PackageReference Include="SVappsLAB.iRacingTelemetrySDK" Version="2.4.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Samples/MinimalExampleSync/MinimalExampleSync.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.8" />
<PackageReference Include="SVappsLAB.iRacingTelemetrySDK" Version="2.3.0" />
<PackageReference Include="SVappsLAB.iRacingTelemetrySDK" Version="2.4.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Samples/SimControl/SimControl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.8" />
<PackageReference Include="SVappsLAB.iRacingTelemetrySDK" Version="2.3.0" />
<PackageReference Include="SVappsLAB.iRacingTelemetrySDK" Version="2.4.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Samples/SpeedRPMGear/SpeedRPMGear.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageReference Include="Microsoft.Extensions.Diagnostics" Version="10.0.8" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.8" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.8" />
<PackageReference Include="SVappsLAB.iRacingTelemetrySDK" Version="2.3.0" />
<PackageReference Include="SVappsLAB.iRacingTelemetrySDK" Version="2.4.0" />
</ItemGroup>

</Project>
3 changes: 1 addition & 2 deletions Sdk/SVappsLAB.iRacingTelemetrySDK/Models/WeekendInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* limitations under the License.
**/

using System;

#nullable disable
namespace SVappsLAB.iRacingTelemetrySDK;

Expand Down Expand Up @@ -76,6 +74,7 @@ public class WeekendInfo
public int NumCarTypes { get; set; } // 1
public string AIRosterName { get; set; } // ""
public int HeatRacing { get; set; } // 0
public string AltAssetTag { get; set; } // "(blank), IMSA, NEC, NOTC, PMNA, INDY, NOABSTC, NOABS, ROOKIE, WSC2017, DTM"
public string BuildType { get; set; } // Release
public string BuildTarget { get; set; } // Members
public string BuildVersion { get; set; } // 2020.12.08.06
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Diagnostics.Abstractions" Version="10.0.11" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.11" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.Abstractions" Version="10.0.12" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.12" />
<PackageReference Include="YamlDotNet" Version="18.1.0" />
<ProjectReference Include="..\SVappsLAB.iRacingTelemetrySDK.CodeGen\SVappsLAB.iRacingTelemetrySDK.CodeGen.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference Include="..\SVappsLAB.iRacingTelemetrySDK.EnumsAndFlags\SVappsLAB.iRacingTelemetrySDK.EnumsAndFlags.csproj" PrivateAssets="all" />
Expand All @@ -43,7 +43,7 @@
<PackageTags>iRacing iRacingSDK irsdk IBT telemetry SDK API sim-control replay broadcast</PackageTags>
<PackageReadmeFile>NUGET.md</PackageReadmeFile>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<Version>2.3.0</Version>
<Version>2.4.0</Version>
<Authors>Scott Velez</Authors>
<Company>SVappsLAB</Company>
<Copyright>Copyright (c) 2026 SVappsLAB</Copyright>
Expand Down
13 changes: 9 additions & 4 deletions Sdk/tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,23 @@ Live tests require iRacing running on Windows in an active session. Load a track
dotnet run --project .\Sdk\tests\SmokeTests\SmokeTests.csproj -- --filter-trait Category=live
```

If iRacing isn't running (its shared-memory status isn't "connected"), the live tests are reported as
**skipped** via `Assert.SkipUnless` rather than timing out and failing. Being in iRacing doesn't guarantee
telemetry is flowing, though - you still need to be in the car.

## Manual Tests

Manual tests depend on local developer setup, local telemetry files, timing-sensitive behavior, or deliberate inspection. Run them intentionally:
Manual tests depend on local developer setup, local telemetry files, timing-sensitive behavior, or deliberate inspection.
They are marked `Explicit = true`, so no test run includes them unless you pass `--explicit on`:

```powershell
dotnet run --project .\Sdk\tests\SmokeTests\SmokeTests.csproj -- --filter-trait Category=manual
dotnet run --project .\Sdk\tests\UnitTests\UnitTests.csproj -- --filter-trait Category=manual
dotnet run --project .\Sdk\tests\SmokeTests\SmokeTests.csproj -- --filter-trait Category=manual --explicit on
dotnet run --project .\Sdk\tests\UnitTests\UnitTests.csproj -- --filter-trait Category=manual --explicit on
```

## All Tests

The full solution test run may include tests that require live iRacing data or local manual-test setup.
The full solution test run skips live tests when iRacing isn't running and never runs explicit (manual) tests.

```powershell
dotnet test --solution .\Sdk\SVappsLAB.iRacingTelemetrySDK.slnx
Expand Down
9 changes: 2 additions & 7 deletions Sdk/tests/SmokeTests/IBT/IBTYamlValidation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,10 @@ public class IBTYamlValidation

public IBTYamlValidation(ITestOutputHelper output) => _output = output;

[Fact]
[Fact(Explicit = true)]
public async Task ValidateYamlInAllIbtFiles()
{
// skip if directory doesn't exist
if (!Directory.Exists(TelemetryDir))
{
_output.WriteLine($"skipping: telemetry directory not found: {TelemetryDir}");
return;
}
Assert.SkipUnless(Directory.Exists(TelemetryDir), $"telemetry directory not found: {TelemetryDir}");

var ibtFiles = Directory.GetFiles(TelemetryDir, "*.ibt");
Assert.True(ibtFiles.Length > 0, "no IBT files found");
Expand Down
22 changes: 22 additions & 0 deletions Sdk/tests/SmokeTests/Live/Live.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
**/

using System.IO.MemoryMappedFiles;
using Microsoft.Extensions.Logging;
using SVappsLAB.iRacingTelemetrySDK;

Expand All @@ -26,6 +27,27 @@ public class Live : Base<Live>

public Live(ITestOutputHelper output) : base(output)
{
Assert.SkipUnless(IsIRacingConnected(), "iRacing is not running with an active session");
}

static bool IsIRacingConnected()
{
const int STATUS_OFFSET = 4; // irsdk_header.status follows the int 'ver' field
const int STATUS_CONNECTED = 1;

if (!OperatingSystem.IsWindows())
return false;

try
{
using var mmFile = MemoryMappedFile.OpenExisting(@"Local\IRSDKMemMapFileName");
using var accessor = mmFile.CreateViewAccessor(0, STATUS_OFFSET + sizeof(int), MemoryMappedFileAccess.Read);
return (accessor.ReadInt32(STATUS_OFFSET) & STATUS_CONNECTED) != 0;
}
catch (FileNotFoundException)
{
return false;
}
}

public static TheoryData<string, Func<ILogger, ITelemetryClient<TelemetryData>>> TestModes =>
Expand Down
8 changes: 4 additions & 4 deletions Sdk/tests/SmokeTests/SmokeTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="xunit.analyzers" Version="2.0.0">
<PackageReference Include="xunit.analyzers" Version="2.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit.v3" Version="4.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.11" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.11" />
<PackageReference Include="xunit.v3" Version="4.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.12" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.12" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Sdk/tests/UnitTests/IBTPlaybackGovernor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public IBTPlaybackGovernor(LogFixture logFixture)
{1000, 5}
};

[Theory]
[Theory(Explicit = true)]
[Trait("Category", "manual")]
[MemberData(nameof(Data))]
public async Task GovernorTests(int speedMultiplier, int secsOfDataToSimulate)
Expand Down
6 changes: 3 additions & 3 deletions Sdk/tests/UnitTests/UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
<ItemGroup>
<!-- for running the source generator in-process (CodeGenTests) -->
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="5.9.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.11" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.12" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="10.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
<PackageReference Include="xunit.analyzers" Version="2.0.0">
<PackageReference Include="xunit.analyzers" Version="2.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit.v3" Version="4.0.0" />
<PackageReference Include="xunit.v3" Version="4.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading