UnitTests: Declare as CPU thread when using CPUThreadConfigCallback

This fixes a bunch of DEBUG_ASSERTs in the unit tests.
This commit is contained in:
JosJuice 2023-08-16 23:28:33 +02:00
parent 2b17e89336
commit 1104b93ee4
7 changed files with 38 additions and 0 deletions

View File

@ -5,7 +5,9 @@
#include <fmt/format.h>
#include "Common/CommonTypes.h"
#include "Common/ScopeGuard.h"
#include "Common/Timer.h"
#include "Core/Core.h"
#include "Core/MemTools.h"
#include "Core/PowerPC/JitCommon/JitBase.h"
#include "Core/PowerPC/JitInterface.h"
@ -75,6 +77,9 @@ TEST(PageFault, PageFault)
EXPECT_NE(data, nullptr);
Common::WriteProtectMemory(data, PAGE_GRAN, false);
Core::DeclareAsCPUThread();
Common::ScopeGuard cpu_thread_guard([] { Core::UndeclareAsCPUThread(); });
auto& system = Core::System::GetInstance();
auto unique_pfjit = std::make_unique<PageFaultFakeJit>(system);
auto& pfjit = *unique_pfjit;

View File

@ -5,7 +5,9 @@
#include <tuple>
#include "Common/CommonTypes.h"
#include "Common/ScopeGuard.h"
#include "Common/x64ABI.h"
#include "Core/Core.h"
#include "Core/PowerPC/Gekko.h"
#include "Core/PowerPC/Interpreter/Interpreter_FPUtils.h"
#include "Core/PowerPC/Jit64/Jit.h"
@ -52,6 +54,9 @@ public:
TEST(Jit64, ConvertDoubleToSingle)
{
Core::DeclareAsCPUThread();
Common::ScopeGuard cpu_thread_guard([] { Core::UndeclareAsCPUThread(); });
TestCommonAsmRoutines routines(Core::System::GetInstance());
for (const u64 input : double_test_values)

View File

@ -6,7 +6,9 @@
#include "Common/BitUtils.h"
#include "Common/CommonTypes.h"
#include "Common/FloatUtils.h"
#include "Common/ScopeGuard.h"
#include "Common/x64ABI.h"
#include "Core/Core.h"
#include "Core/PowerPC/Gekko.h"
#include "Core/PowerPC/Jit64/Jit.h"
#include "Core/PowerPC/Jit64Common/Jit64AsmCommon.h"
@ -59,6 +61,9 @@ public:
TEST(Jit64, Frsqrte)
{
Core::DeclareAsCPUThread();
Common::ScopeGuard cpu_thread_guard([] { Core::UndeclareAsCPUThread(); });
TestCommonAsmRoutines routines(Core::System::GetInstance());
UReg_FPSCR fpscr;

View File

@ -7,6 +7,8 @@
#include "Common/BitUtils.h"
#include "Common/CommonTypes.h"
#include "Common/FPURoundMode.h"
#include "Common/ScopeGuard.h"
#include "Core/Core.h"
#include "Core/PowerPC/Interpreter/Interpreter_FPUtils.h"
#include "Core/PowerPC/JitArm64/Jit.h"
#include "Core/System.h"
@ -120,6 +122,9 @@ private:
TEST(JitArm64, ConvertDoubleToSingle)
{
Core::DeclareAsCPUThread();
Common::ScopeGuard cpu_thread_guard([] { Core::UndeclareAsCPUThread(); });
TestConversion test(Core::System::GetInstance());
for (const u64 input : double_test_values)
@ -155,6 +160,9 @@ TEST(JitArm64, ConvertDoubleToSingle)
TEST(JitArm64, ConvertSingleToDouble)
{
Core::DeclareAsCPUThread();
Common::ScopeGuard cpu_thread_guard([] { Core::UndeclareAsCPUThread(); });
TestConversion test(Core::System::GetInstance());
for (const u32 input : single_test_values)

View File

@ -7,6 +7,8 @@
#include "Common/Arm64Emitter.h"
#include "Common/BitUtils.h"
#include "Common/CommonTypes.h"
#include "Common/ScopeGuard.h"
#include "Core/Core.h"
#include "Core/PowerPC/Interpreter/Interpreter_FPUtils.h"
#include "Core/PowerPC/JitArm64/Jit.h"
#include "Core/PowerPC/PowerPC.h"
@ -70,6 +72,9 @@ static u32 RunUpdateFPRF(PowerPC::PowerPCState& ppc_state, const std::function<v
TEST(JitArm64, FPRF)
{
Core::DeclareAsCPUThread();
Common::ScopeGuard cpu_thread_guard([] { Core::UndeclareAsCPUThread(); });
auto& system = Core::System::GetInstance();
auto& ppc_state = system.GetPPCState();
TestFPRF test(system);

View File

@ -6,6 +6,8 @@
#include "Common/Arm64Emitter.h"
#include "Common/BitUtils.h"
#include "Common/CommonTypes.h"
#include "Common/ScopeGuard.h"
#include "Core/Core.h"
#include "Core/PowerPC/Interpreter/Interpreter_FPUtils.h"
#include "Core/PowerPC/JitArm64/Jit.h"
#include "Core/PowerPC/PowerPC.h"
@ -51,6 +53,9 @@ public:
TEST(JitArm64, Fres)
{
Core::DeclareAsCPUThread();
Common::ScopeGuard cpu_thread_guard([] { Core::UndeclareAsCPUThread(); });
TestFres test(Core::System::GetInstance());
for (const u64 ivalue : double_test_values)

View File

@ -6,6 +6,8 @@
#include "Common/Arm64Emitter.h"
#include "Common/BitUtils.h"
#include "Common/CommonTypes.h"
#include "Common/ScopeGuard.h"
#include "Core/Core.h"
#include "Core/PowerPC/Interpreter/Interpreter_FPUtils.h"
#include "Core/PowerPC/JitArm64/Jit.h"
#include "Core/PowerPC/PowerPC.h"
@ -51,6 +53,9 @@ public:
TEST(JitArm64, Frsqrte)
{
Core::DeclareAsCPUThread();
Common::ScopeGuard cpu_thread_guard([] { Core::UndeclareAsCPUThread(); });
TestFrsqrte test(Core::System::GetInstance());
for (const u64 ivalue : double_test_values)