mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 11:27:24 +08:00
9f7c6adb58
As seen at https://github.com/ppy/osu/pull/13831/checks?check_run_id=3025050307. I can't confirm that this will fix the issue but it looks like the only plausible reason. I have confirmed that the logging is not coming from the local (first logging is guaranteed to be after `SetupForRun`).
36 lines
1.7 KiB
C#
36 lines
1.7 KiB
C#
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
using System.Runtime.CompilerServices;
|
|
using osu.Framework.Platform;
|
|
|
|
namespace osu.Game.Tests
|
|
{
|
|
/// <summary>
|
|
/// A headless host which cleans up before running (removing any remnants from a previous execution).
|
|
/// </summary>
|
|
public class CleanRunHeadlessGameHost : HeadlessGameHost
|
|
{
|
|
/// <summary>
|
|
/// Create a new instance.
|
|
/// </summary>
|
|
/// <param name="gameSuffix">An optional suffix which will isolate this host from others called from the same method source.</param>
|
|
/// <param name="bindIPC">Whether to bind IPC channels.</param>
|
|
/// <param name="realtime">Whether the host should be forced to run in realtime, rather than accelerated test time.</param>
|
|
/// <param name="callingMethodName">The name of the calling method, used for test file isolation and clean-up.</param>
|
|
public CleanRunHeadlessGameHost(string gameSuffix = @"", bool bindIPC = false, bool realtime = true, [CallerMemberName] string callingMethodName = @"")
|
|
: base(callingMethodName + gameSuffix, bindIPC, realtime)
|
|
{
|
|
}
|
|
|
|
protected override void SetupForRun()
|
|
{
|
|
Storage.DeleteDirectory(string.Empty);
|
|
|
|
// base call needs to be run *after* storage is emptied, as it updates the (static) logger's storage and may start writing
|
|
// log entries from another source if a unit test host is shared over multiple tests, causing a file access denied exception.
|
|
base.SetupForRun();
|
|
}
|
|
}
|
|
}
|