Files
sharpemu/tests/SharpEmu.Libs.Tests/Kernel/KernelGameLogPathTests.cs
T
Berk 2b6bd5a532 Sdl backend (#670)
* [audio] added sdl audio backend and in-tree atrac9 decoder

* [input] replaced per-platform pad readers with sdl gamepad input

* [video] added sdl window and host display plumbing

* [gui] added host display options and per-game render settings

* [bink] synced host movie playback to the guest audio clock

* [cpu] hooked windows write faults into guest image tracking

* [perf] added guest and render profiling, reserved host cpu lanes

* [kernel] fixed stale pthread mutex handle alias

* [host] wired the sdl session, save-data paths and project references

* [audio] hoisted ajm trace stackalloc out of its loop

* [video] Add guest image sync setting

* [build] Strip native symbols

* reuse
2026-07-28 03:33:26 +03:00

97 lines
2.9 KiB
C#

// Copyright (C) 2026 SharpEmu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
using SharpEmu.Libs.Kernel;
using Xunit;
namespace SharpEmu.Libs.Tests.Kernel;
[Collection(KernelMemoryCompatStateCollection.Name)]
public sealed class KernelGameLogPathTests : IDisposable
{
private readonly string? _previousHostappRoot =
Environment.GetEnvironmentVariable("SHARPEMU_HOSTAPP_DIR");
private readonly string? _previousDevlogRoot =
Environment.GetEnvironmentVariable("SHARPEMU_DEVLOG_APP_DIR");
public KernelGameLogPathTests()
{
Environment.SetEnvironmentVariable("SHARPEMU_HOSTAPP_DIR", null);
Environment.SetEnvironmentVariable("SHARPEMU_DEVLOG_APP_DIR", null);
KernelMemoryCompatExports.ConfigureApplicationInfo("ppsa/01:342");
}
public void Dispose()
{
Environment.SetEnvironmentVariable("SHARPEMU_HOSTAPP_DIR", _previousHostappRoot);
Environment.SetEnvironmentVariable("SHARPEMU_DEVLOG_APP_DIR", _previousDevlogRoot);
KernelMemoryCompatExports.ConfigureApplicationInfo(null);
var testRoot = Path.Combine(
AppContext.BaseDirectory,
"user",
"game_logs",
"PPSA_01_342");
if (Directory.Exists(testRoot))
{
Directory.Delete(testRoot, recursive: true);
}
}
[Fact]
public void HostappUsesPerTitleGameLogDirectory()
{
var path = KernelMemoryCompatExports.ResolveGuestPath("/hostapp/logs/game.log");
Assert.Equal(
Path.GetFullPath(Path.Combine(
AppContext.BaseDirectory,
"user",
"game_logs",
"PPSA_01_342",
"hostapp",
"logs",
"game.log")),
path);
}
[Fact]
public void DevlogUsesPerTitleGameLogDirectory()
{
var path = KernelMemoryCompatExports.ResolveGuestPath("/devlog/app/debug.log");
Assert.Equal(
Path.GetFullPath(Path.Combine(
AppContext.BaseDirectory,
"user",
"game_logs",
"PPSA_01_342",
"devlog",
"app",
"debug.log")),
path);
}
[Fact]
public void ExplicitHostappOverrideIsPreserved()
{
var root = Path.Combine(Path.GetTempPath(), "SharpEmuTests", Guid.NewGuid().ToString("N"));
try
{
Environment.SetEnvironmentVariable("SHARPEMU_HOSTAPP_DIR", root);
Assert.Equal(
Path.Combine(Path.GetFullPath(root), "logs", "game.log"),
KernelMemoryCompatExports.ResolveGuestPath("/hostapp/logs/game.log"));
}
finally
{
Environment.SetEnvironmentVariable("SHARPEMU_HOSTAPP_DIR", null);
if (Directory.Exists(root))
{
Directory.Delete(root, recursive: true);
}
}
}
}