Files
frameledger/tests/FrameLedger.Infrastructure.Tests/Capture/RuntimeModuleSnapshotSourceTests.cs
poli0981andClaude Fable 5.2 1342979353 ci: Qodana - JetBrains' code analysis from a workflow of its own, and what its first run reported settled (D93) (#373)
* ci: Qodana - a workflow of its own from JetBrains' template, Qodana Community for .NET over FrameLedger.slnx (D93)

The first run: the linter in its Linux container, EnableWindowsTargeting passed
to it, no quality gate yet - what it builds and what it reports decides the rest.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* ci: Qodana's gate is zero problems, and the inspections this project argues with are off in .editorconfig, each with its reason (D93)

Pushed before the fixes on purpose: the run this starts has the settings and
none of the fixes, so it shows the gate failing on what is left.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix: what Qodana's first run reported, settled - about 400 fixes in 181 files, none changing behaviour; the documents (D93)

Redundant qualifiers, casts, using directives, nullable suppressions and unsafe
modifiers removed from the report's own positions; var for built-in types and
one-line block bodies brought to .editorconfig's style by dotnet format; every
XAML item template names its DataType and a binding that reached its page through
DataContext.ViewModel names the page's type; two unread fields, two overwritten
initialisers and an unused parameter removed; SpokenTextAutomationPeer no longer
assumes the base peer's name is a string.

docs/13_CI_CD.md §Qodana, CLAUDE.md, the wiki's workflow table, HANDOFF's
decisions index (D93) and the changelog entry.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 16:13:04 +00:00

55 lines
2.7 KiB
C#

// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.Runtime.InteropServices;
using FluentAssertions;
using FrameLedger.Application.Capture;
using FrameLedger.Infrastructure.Capture;
namespace FrameLedger.Infrastructure.Tests.Capture;
/// <summary>
/// D64 (beta.24), on this test's own process: every module under the NVIDIA override folder is recorded whatever its name
/// — on the owner's Silent Hill 2 session none of the override's libraries carried a census name — and every recorded
/// module carries its folder class.
/// </summary>
public sealed class RuntimeModuleSnapshotSourceTests
{
[Fact]
public void AModuleUnderTheOverrideFolderIsRecordedWhateverItsNameAndEachCarriesItsClass()
{
string programData = Path.Combine(Path.GetTempPath(), "fl-ngx-" + Guid.NewGuid().ToString("N"));
string folder = Path.Combine(programData, "NVIDIA", "NGX", "models", "dlss");
Directory.CreateDirectory(folder);
string copy = Path.Combine(folder, "fl_override_probe.dll");
File.Copy(Path.Combine(AppContext.BaseDirectory, "FrameLedger.ProcessStats.dll"), copy);
IntPtr handle = NativeLibrary.Load(copy);
try
{
RuntimeModuleSet set = RuntimeModuleSnapshot.Take(Environment.ProcessId, ["kernel32.dll"], Environment.GetFolderPath(Environment.SpecialFolder.Windows), programData);
set.Unreadable.Should().Be(0);
set.Find("fl_override_probe.dll")!.Source.Should().Be(RuntimeModuleSource.GraphicsDriver, "a name no list carries, caught by its folder");
set.Find("kernel32.dll")!.Source.Should().Be(RuntimeModuleSource.Windows);
set.Find("FrameLedger.ProcessStats.dll").Should().BeNull("outside the override folder, a name no list carries is not recorded");
RuntimeModuleSet noFolders = RuntimeModuleSnapshot.Take(Environment.ProcessId, ["kernel32.dll"], string.Empty, " ");
noFolders.Unreadable.Should().Be(0, "a folder Windows did not name is not a failure");
noFolders.Find("kernel32.dll")!.Source.Should().Be(RuntimeModuleSource.Unknown);
noFolders.Find("fl_override_probe.dll").Should().BeNull("nothing is caught by a folder nobody named");
}
finally
{
NativeLibrary.Free(handle);
try
{
Directory.Delete(programData, recursive: true);
}
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
{
// A mapped image can outlive the free for a moment; the temporary folder is the system's to clear.
}
}
}
}