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
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"csharpier": {
"version": "1.3.0",
"version": "1.4.1",
"commands": [
"csharpier"
],
Expand Down Expand Up @@ -31,4 +31,4 @@
"rollForward": false
}
}
}
}
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ARG TARGETARCH=amd64
# Pinned checksum for Microsoft package repository bootstrap package.
ARG MS_PACKAGES_DEB_SHA256=8434dcb8c346dc95fbd63dbece056c343704590b58b6a5c323d39acf52bf0b48
# Keep this in sync with global.json. scripts/lint/check-tooling-consistency.py enforces it.
ARG DOTNET_SDK_MAJOR_MINOR=9.0
ARG DOTNET_SDK_MAJOR_MINOR=10.0
# Pinned Lua source version and checksum.
ARG LUA55_VERSION=5.5.0
ARG LUA55_SHA256=57ccc32bbbd005cab75bcc52444052535af691789dba2b9016d5c50640d68b3d
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/nuget-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,13 @@ jobs:
run: dotnet build src/NovaSharp.sln -c Release -p:Version=${{ steps.version.outputs.version }}

- name: Run tests
env:
DOTNET_ROLL_FORWARD: Major
run: |
dotnet test \
dotnet test --project \
src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit.csproj \
-c Release \
--no-build \
-- \
--report-trx --report-trx-filename "test-results.trx"

- name: Pack NuGet packages
Expand Down
11 changes: 4 additions & 7 deletions .llm/skills/ci-workflow/references/REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,13 @@ NovaSharp uses TUnit on Microsoft.Testing.Platform.
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="..." />
```

### Platform Options Separator
### Microsoft.Testing.Platform options

Options for the test platform MUST come after `--`:
Run a specific project with `--project` and pass runner options directly to
`dotnet test`. When using `dotnet run`, place runner options after `--`.

```bash
# WRONG
dotnet test --results-directory ./results --report-trx

# CORRECT
dotnet test -- --results-directory ./results --report-trx
dotnet test --project path/to/TestProject.csproj --results-directory ./results --report-trx
```

______________________________________________________________________
Expand Down
5 changes: 2 additions & 3 deletions docs/Contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This project keeps the build/test tooling and documentation in lockstep. Use thi

## Environment & Tooling

- Install the .NET SDK pinned by `global.json` (currently 9.0.100 with latest-minor roll-forward).
- Install the .NET SDK pinned by `global.json` (currently 10.0.100 with latest-minor roll-forward).
- Install Python 3.10+ (CI uses 3.12) and restore the shared tooling dependencies once per clone:
```bash
python -m pip install -r requirements.tooling.txt
Expand All @@ -22,8 +22,7 @@ This project keeps the build/test tooling and documentation in lockstep. Use thi

- Full solution build: `dotnet build src/NovaSharp.sln -c Release`
- Interpreter-only build: `dotnet build src/runtime/WallstopStudios.NovaSharp.Interpreter/WallstopStudios.NovaSharp.Interpreter.csproj`
- Interpreter tests (Release):\
`dotnet test src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit.csproj -c Release -- --report-trx --report-trx-filename NovaSharpInterpreterTUnit.trx`
- Interpreter tests (Release): `./scripts/test/quick.sh`

## Coverage

Expand Down
17 changes: 9 additions & 8 deletions docs/Testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@ NovaSharp ships with a comprehensive test suite that blends historical Lua fixtu
## Running the Tests Locally

```bash
dotnet test src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit.csproj -c Release -- --report-trx --report-trx-filename NovaSharpInterpreterTUnit.trx
DOTNET_ROLL_FORWARD=Major dotnet test \
--project src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit.csproj \
-c Release --report-trx --report-trx-filename NovaSharpInterpreterTUnit.trx
```

- Produces a standards-based TRX file under `TestResults/` (or the supplied `--results-directory`) so failures can be inspected with the test explorer of your choice.
- Mirrors the test execution and TRX output that power CI. Use `scripts/coverage/coverage.ps1` or `scripts/coverage/coverage.sh` when you need branch/line coverage.

### Microsoft.Testing.Platform runner

- `global.json` pins `test.runner` to `Microsoft.Testing.Platform`, so every `dotnet test` invocation must pass an explicit target path, solution, or test module. Use the positional project path shown above; test-platform options still go after the `--` separator.
- The .NET 10 SDK selects Microsoft.Testing.Platform through `global.json`. Use `--project` when selecting a test project from the repository root and pass runner options directly to `dotnet test`.
- The interpreter TUnit suite completes quickly on a many-core workstation; expect a slower first run when a clean build is required because the Microsoft.Testing.Platform entry point is re-generated.
- Visual Studio and Rider inherit the same configuration because the runner is set in `global.json`; if a local command fails with “VSTest target is no longer supported”, re-run it with the explicit target path shown above so the Microsoft.Testing.Platform mode is engaged.
- IDEs that honor the SDK test runner configuration use the Microsoft.Testing.Platform setting in `global.json`.

### TUnit-first policy

Expand Down Expand Up @@ -59,17 +61,15 @@ bash ./scripts/build/build.sh
pwsh ./scripts/coverage/coverage.ps1
```

- If the host only has .NET 9 installed (common on new Ubuntu images), set `DOTNET_ROLL_FORWARD=Major` when invoking the script (PowerShell or Bash) so the .NET 9 runtime can execute the net8.0 testhost.

- Restores local tools, builds the solution in Release, and drives `dotnet test` through the `coverlet.console` wrapper so the TUnit suites execute exactly as they do in CI.
- Restores local tools, builds the solution in Release, and runs the TUnit test application through the `coverlet.console` wrapper.

- Emits LCOV, Cobertura, and OpenCover artefacts under `artifacts/coverage`, with the TRX test logs in `artifacts/coverage/test-results`.

- Produces HTML + Markdown + JSON summaries in `docs/coverage/latest`; `SummaryGithub.md` and `Summary.json` are also copied to `artifacts/coverage` for automation and PR reporting.

- Pass `-SkipBuild` to reuse existing binaries and `-Configuration Debug` to collect non-Release stats.

- On macOS/Linux without PowerShell, run `bash ./scripts/coverage/coverage.sh` (identical flags/behaviour). Both scripts automatically set `DOTNET_ROLL_FORWARD=Major` when it isn’t already defined so .NET 9 runtimes can execute the net8.0 testhost; override the variable if you need different roll-forward behaviour.
- On macOS/Linux without PowerShell, run `bash ./scripts/coverage/coverage.sh` (identical flags/behaviour). Both scripts automatically set `DOTNET_ROLL_FORWARD=Major` when it isn’t already defined so newer .NET runtimes can execute the .NET 8 test host. Set the variable explicitly to use a different roll-forward policy.

- Both coverage helpers honour gating settings: set `COVERAGE_GATING_MODE` to `monitor` (warn) or `enforce` (fail), and override the per-metric targets via `COVERAGE_GATING_TARGET_LINE`, `COVERAGE_GATING_TARGET_BRANCH`, and `COVERAGE_GATING_TARGET_METHOD`. CI now exports `COVERAGE_GATING_MODE=enforce` with **80 % line / 80 % branch / 80 % method** thresholds so coverage dips fail fast; set the mode to `monitor` locally if you need a warning-only rehearsal. To mirror the enforced gate (the default in CI), export the same settings before rerunning the script:

Expand Down Expand Up @@ -191,7 +191,8 @@ Validation checklist:
```powershell
dotnet build src/debuggers/WallstopStudios.NovaSharp.VsCodeDebugger/WallstopStudios.NovaSharp.VsCodeDebugger.csproj -c Release -nologo
dotnet build src/debuggers/WallstopStudios.NovaSharp.RemoteDebugger/WallstopStudios.NovaSharp.RemoteDebugger.csproj -c Release -nologo
dotnet test src/tests/WallstopStudios.NovaSharp.RemoteDebugger.Tests.TUnit/WallstopStudios.NovaSharp.RemoteDebugger.Tests.TUnit.csproj -c Release --filter "FullyQualifiedName~RemoteDebugger"
$env:DOTNET_ROLL_FORWARD = 'Major'
dotnet test --project src/tests/WallstopStudios.NovaSharp.RemoteDebugger.Tests.TUnit/WallstopStudios.NovaSharp.RemoteDebugger.Tests.TUnit.csproj -c Release
```

Document new suppressions or analyzer exclusions in the closest authoritative analyzer documentation (with the CA rule, justification, and follow-up owner) before merging.
58 changes: 29 additions & 29 deletions docs/audits/documentation_audit.log
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ Found 185 undocumented public/internal type declarations.
- src/runtime/WallstopStudios.NovaSharp.Interpreter/CompiledScript.cs
- line 621: missing XML docs for `ExecuteValues()`
- src/runtime/WallstopStudios.NovaSharp.Interpreter/CoreLib/DebugModule.cs
- line 1620: missing XML docs for `Value`
- line 1625: missing XML docs for `Function`
- line 1626: missing XML docs for `Mask`
- line 1627: missing XML docs for `Count`
- line 1640: missing XML docs for `Upvalue`
- line 1642: missing XML docs for `ReferenceId`
- line 1644: missing XML docs for `ToString()`
- line 1655: missing XML docs for `Name`
- line 1657: missing XML docs for `Type`
- line 1659: missing XML docs for `TryIndex()`
- line 1671: missing XML docs for `SetIndex()`
- line 1682: missing XML docs for `AsString()`
- line 1692: missing XML docs for `TryMetaIndex()`
- line 1698: missing XML docs for `IsTypeCompatible()`
- line 1617: missing XML docs for `Value`
- line 1622: missing XML docs for `Function`
- line 1623: missing XML docs for `Mask`
- line 1624: missing XML docs for `Count`
- line 1637: missing XML docs for `Upvalue`
- line 1639: missing XML docs for `ReferenceId`
- line 1641: missing XML docs for `ToString()`
- line 1652: missing XML docs for `Name`
- line 1654: missing XML docs for `Type`
- line 1656: missing XML docs for `TryIndex()`
- line 1668: missing XML docs for `SetIndex()`
- line 1679: missing XML docs for `AsString()`
- line 1689: missing XML docs for `TryMetaIndex()`
- line 1695: missing XML docs for `IsTypeCompatible()`
- src/runtime/WallstopStudios.NovaSharp.Interpreter/CoreLib/IO/FileUserDataDescriptor.cs
- line 22: missing XML docs for `Name`
- line 24: missing XML docs for `Type`
Expand Down Expand Up @@ -157,9 +157,9 @@ Found 185 undocumented public/internal type declarations.
- src/runtime/WallstopStudios.NovaSharp.Interpreter/Script.cs
- line 626: missing XML docs for `BeginDefaultOptionsScope()`
- line 734: missing XML docs for `RegisterCoroutineForMemoryStatistics()`
- line 4817: missing XML docs for `GetTrackedCoroutineCountForMemoryStatisticsForTests()`
- line 4825: missing XML docs for `GetEstimatedScriptRetainedBytesForMemoryStatisticsForTests()`
- line 4952: missing XML docs for `Dispose()`
- line 4811: missing XML docs for `GetTrackedCoroutineCountForMemoryStatisticsForTests()`
- line 4819: missing XML docs for `GetEstimatedScriptRetainedBytesForMemoryStatisticsForTests()`
- line 4946: missing XML docs for `Dispose()`
- src/runtime/WallstopStudios.NovaSharp.Interpreter/Utilities/OneOf/FastOneOf2.cs
- line 198: missing XML docs for `FromT0()`
- line 211: missing XML docs for `FromT1()`
Expand Down Expand Up @@ -210,15 +210,15 @@ Found 185 undocumented public/internal type declarations.
- line 110: missing XML docs for `DeleteFile()`
- line 112: missing XML docs for `MoveFile()`
- line 114: missing XML docs for `ExecuteCommand()`
- line 212: missing XML docs for `ExitFast()`
- line 252: missing XML docs for `class Program`
- line 393: missing XML docs for `Main()`
- line 1058: missing XML docs for `CanRead`
- line 1060: missing XML docs for `CanSeek`
- line 1062: missing XML docs for `CanWrite`
- line 1064: missing XML docs for `Length`
- line 1072: missing XML docs for `Flush()`
- line 1074: missing XML docs for `Write()`
- line 1079: missing XML docs for `Read()`
- line 1084: missing XML docs for `Seek()`
- line 1089: missing XML docs for `SetLength()`
- line 211: missing XML docs for `ExitFast()`
- line 251: missing XML docs for `class Program`
- line 392: missing XML docs for `Main()`
- line 1057: missing XML docs for `CanRead`
- line 1059: missing XML docs for `CanSeek`
- line 1061: missing XML docs for `CanWrite`
- line 1063: missing XML docs for `Length`
- line 1071: missing XML docs for `Flush()`
- line 1073: missing XML docs for `Write()`
- line 1078: missing XML docs for `Read()`
- line 1083: missing XML docs for `Seek()`
- line 1088: missing XML docs for `SetLength()`
2 changes: 1 addition & 1 deletion docs/testing/real-world-scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ NovaSharp executes a curated set of third-party Lua scripts to spot regressions
- Add new scripts under `src/tests/WallstopStudios.NovaSharp.Interpreter.Tests/Fixtures/RealWorld/<vendor-script>` with the upstream `LICENSE`.
- Extend `RealWorldScriptTests` with a descriptive `TestCaseData` entry that exercises a behaviour NovaSharp must support.
- Update the table above (and `docs/ThirdPartyLicenses.md`) with the script name, tag/commit, license, and source URL.
- Re-run `dotnet test src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit.csproj -c Release --filter RealWorld` after every corpus change.
- Re-run `./scripts/test/quick.sh -c RealWorld` after every corpus change.

## Completed Setup

Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "9.0.100",
"version": "10.0.100",
"rollForward": "latestMinor",
"allowPrerelease": false
},
Expand Down
2 changes: 1 addition & 1 deletion scripts/build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Use `quick.sh` for fast iterative development with incremental compilation:
- `--skip-tests` / `-SkipTests`: Build only; do not execute tests.
- `--skip-tool-restore` / `-SkipToolRestore`: Assume `dotnet tool restore` already ran for this checkout.

Both scripts automatically set `DOTNET_ROLL_FORWARD=Major` when the variable is unset so environments with only .NET 9 installed can still run the net8 test runner. Test logs are written to `artifacts/test-results`, matching the CI layout.
Both scripts automatically set `DOTNET_ROLL_FORWARD=Major` when the variable is unset so newer .NET runtimes can run the .NET 8 test host. Test logs are written to `artifacts/test-results`, matching the CI layout.

### Examples

Expand Down
7 changes: 3 additions & 4 deletions scripts/build/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ else {

if ([string]::IsNullOrWhiteSpace($env:DOTNET_ROLL_FORWARD)) {
$env:DOTNET_ROLL_FORWARD = "Major"
Write-Host "DOTNET_ROLL_FORWARD not set; defaulting to 'Major' so .NET 9 hosts can run the net8 test runner."
Write-Host "DOTNET_ROLL_FORWARD not set; defaulting to 'Major' so newer .NET runtimes can run the .NET 8 test host."
}

# Suppress TUnit ASCII banner and telemetry messages
Expand Down Expand Up @@ -96,9 +96,8 @@ NovaSharp test results were not generated. This placeholder file ensures CI arti
Set-Content -Path $placeholderPath -Value $placeholderContent

Write-Host "Running tests for $TestProject..."
# Microsoft.Testing.Platform options (--report-trx, --results-directory) must be passed after --
dotnet test $TestProject -c $Configuration --no-build `
-- --report-trx --report-trx-filename NovaSharpInterpreterTUnit.trx `
dotnet test --project $TestProject -c $Configuration --no-build `
--report-trx --report-trx-filename NovaSharpInterpreterTUnit.trx `
--results-directory $resultsDir
if ($LASTEXITCODE -ne 0) {
throw "dotnet test $TestProject failed with exit code $LASTEXITCODE."
Expand Down
12 changes: 3 additions & 9 deletions scripts/build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ EOF

if [[ -z "${DOTNET_ROLL_FORWARD:-}" ]]; then
export DOTNET_ROLL_FORWARD="Major"
echo "DOTNET_ROLL_FORWARD not set; defaulting to 'Major' so .NET 9 hosts can run the net8 test runner."
echo "DOTNET_ROLL_FORWARD not set; defaulting to 'Major' so newer .NET runtimes can run the .NET 8 test host."
fi

# Suppress TUnit ASCII banner and telemetry messages
Expand Down Expand Up @@ -113,14 +113,8 @@ dotnet build "$solution" -c "$configuration" -m "${build_restore_flag[@]}"

if (( run_tests )); then
echo "Running tests for $test_project..."
test_restore_flag=()
if (( ! restore_packages )); then
test_restore_flag=(--no-restore)
fi
# Microsoft.Testing.Platform options (--report-trx, --results-directory) must be passed after --
dotnet test "$test_project" -c "$configuration" --no-build \
"${test_restore_flag[@]}" \
-- --report-trx --report-trx-filename NovaSharpInterpreterTUnit.trx \
dotnet test --project "$test_project" -c "$configuration" --no-build \
--report-trx --report-trx-filename NovaSharpInterpreterTUnit.trx \
--results-directory "$test_results_dir"
rm -f "$test_results_placeholder"
fi
Expand Down
5 changes: 2 additions & 3 deletions scripts/coverage/coverage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ else {

if ([string]::IsNullOrWhiteSpace($env:DOTNET_ROLL_FORWARD)) {
$env:DOTNET_ROLL_FORWARD = "Major"
Write-Host "DOTNET_ROLL_FORWARD not set; defaulting to 'Major' so .NET 9 runtimes can host net8 test runners."
Write-Host "DOTNET_ROLL_FORWARD not set; defaulting to 'Major' so newer .NET runtimes can run .NET 8 test hosts."
}

# Suppress TUnit ASCII banner and telemetry messages
Expand Down Expand Up @@ -221,8 +221,7 @@ try {
$tunitCoverageDir = Join-Path $coverageRoot "tunit"
New-Item -ItemType Directory -Force -Path $tunitCoverageDir | Out-Null
$tunitCoverageBase = Join-Path $tunitCoverageDir "coverage"
# Use 'dotnet run' instead of 'dotnet test' because Microsoft.Testing.Platform
# (configured in global.json) does not support 'dotnet test --project' syntax.
# Launch the TUnit test application directly through coverlet.
$tunitTargetArgs =
"run --project `"$tunitRunnerProject`" -c $Configuration --no-build"
$remoteDebuggerTargetArgs =
Expand Down
5 changes: 2 additions & 3 deletions scripts/coverage/coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ trap 'popd >/dev/null' EXIT

if [[ -z "${DOTNET_ROLL_FORWARD:-}" ]]; then
export DOTNET_ROLL_FORWARD=Major
log "DOTNET_ROLL_FORWARD not set; defaulting to 'Major' so .NET 9 runtimes can host net8 test runners."
log "DOTNET_ROLL_FORWARD not set; defaulting to 'Major' so newer .NET runtimes can run .NET 8 test hosts."
fi

# Suppress TUnit ASCII banner and telemetry messages
Expand Down Expand Up @@ -252,8 +252,7 @@ mkdir -p "$tunit_coverage_dir"
tunit_coverage_base="$tunit_coverage_dir/coverage"
tunit_coverage_json="${tunit_coverage_base}.json"

# Use 'run' instead of 'test' because Microsoft.Testing.Platform
# (configured in global.json) does not support 'dotnet test <project>' syntax.
# Launch the TUnit test application directly through coverlet.
tunit_target_args=(
run --project "$tunit_runner_project"
-c "$configuration"
Expand Down
2 changes: 1 addition & 1 deletion scripts/test/quick.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_NOLOGO=1
export TESTINGPLATFORM_NOBANNER=1

# Ensure .NET 9 can run .NET 8 test host
# Allow newer .NET runtimes to run the .NET 8 test host
if [[ -z "${DOTNET_ROLL_FORWARD:-}" ]]; then
export DOTNET_ROLL_FORWARD="Major"
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -680,9 +680,8 @@ private static string GetWatchElementName(WatchType watchType)
return known;
}

return WatchElementNameCache.GetOrAdd(
watchType,
static wt => InvariantString.ToLowerInvariantIfNeeded(wt.ToString())
return WatchElementNameCache.GetOrAdd(watchType, static wt =>
InvariantString.ToLowerInvariantIfNeeded(wt.ToString())
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ private static byte[] GetResourceData(string resourceName)
{
Assembly assembly = Assembly.GetExecutingAssembly();

using Stream stream =
assembly.GetManifestResourceStream(
"WallstopStudios.NovaSharp.RemoteDebugger.Resources." + resourceName
)
using Stream stream = assembly.GetManifestResourceStream(
"WallstopStudios.NovaSharp.RemoteDebugger.Resources." + resourceName
)
?? throw new InvalidOperationException(
$"Embedded resource '{resourceName}' could not be located."
);
Expand Down
Loading
Loading