Permalink
Browse files

Fix running the CPU test from the UI.

  • Loading branch information...
hrydgard committed Jan 4, 2018
1 parent 604b3c3 commit 1a97f62dc9c2c989a38b0a67b9c2d3505160fd64
Showing with 37 additions and 21 deletions.
  1. +0 −1 Core/MIPS/IR/IRCompVFPU.cpp
  2. +3 −1 Core/System.cpp
  3. +1 −8 UI/GameSettingsScreen.cpp
  4. +31 −10 android/jni/TestRunner.cpp
  5. +2 −1 android/jni/TestRunner.h
@@ -333,7 +333,6 @@ namespace MIPSComp {
case 53: // lvl/lvr.q - highly unusual
case 61: // svl/svr.q - highly unusual
logBlocks = 1;
DISABLE;
break;
View
@@ -29,6 +29,7 @@
#include <mutex>
#include <condition_variable>
#include "base/timeutil.h"
#include "math/math_util.h"
#include "thread/threadutil.h"
#include "util/text/utf8.h"
@@ -465,7 +466,8 @@ bool PSP_Init(const CoreParameter &coreParam, std::string *error_string) {
CPU_WaitStatus(cpuThreadReplyCond, &CPU_IsReady);
}
PSP_InitUpdate(error_string);
while (!PSP_InitUpdate(error_string))
sleep_ms(10);
return pspIsInited;
}
@@ -1219,14 +1219,7 @@ void DeveloperToolsScreen::CreateViews() {
Choice *cpuTests = new Choice(dev->T("Run CPU Tests"));
list->Add(cpuTests)->OnClick.Handle(this, &DeveloperToolsScreen::OnRunCPUTests);
#ifdef IOS
const std::string testDirectory = g_Config.flash0Directory + "../";
#else
const std::string testDirectory = g_Config.memStickDirectory;
#endif
if (!File::Exists(testDirectory + "pspautotests/tests/")) {
cpuTests->SetEnabled(false);
}
cpuTests->SetEnabled(TestsAvailable());
#endif
list->Add(new CheckBox(&g_Config.bEnableLogging, dev->T("Enable Logging")))->OnClick.Handle(this, &DeveloperToolsScreen::OnLoggingChanged);
View
@@ -25,11 +25,12 @@
#include <sstream>
#include <iostream>
#include "ppsspp_config.h"
#include "base/basictypes.h"
#include "base/display.h"
#include "base/logging.h"
#include "gfx/gl_common.h"
#include "Common/FileUtil.h"
#include "Core/Core.h"
#include "Core/System.h"
#include "Core/Config.h"
@@ -58,21 +59,37 @@ static std::string TrimNewlines(const std::string &s) {
return s.substr(0, p + 1);
}
void RunTests()
{
bool TestsAvailable() {
#ifdef IOS
std::string testDirectory = g_Config.flash0Directory + "../";
#else
std::string testDirectory = g_Config.memStickDirectory;
#endif
// Hack to easily run the tests on Windows from the submodule
if (File::IsDirectory("../pspautotests")) {
testDirectory = "../";
}
return File::Exists(testDirectory + "pspautotests/tests/");
}
bool RunTests() {
std::string output;
#ifdef IOS
const std::string baseDirectory = g_Config.flash0Directory + "../";
std::string baseDirectory = g_Config.flash0Directory + "../";
#else
const std::string baseDirectory = g_Config.memStickDirectory;
std::string baseDirectory = g_Config.memStickDirectory;
// Hack to easily run the tests on Windows from the submodule
if (File::IsDirectory("../pspautotests")) {
baseDirectory = "../";
}
#endif
CoreParameter coreParam;
coreParam.cpuCore = (CPUCore)g_Config.iCpuCore;
coreParam.gpuCore = g_Config.bSoftwareRendering ? GPUCORE_SOFTWARE : GPUCORE_GLES;
coreParam.gpuCore = GPUCORE_NULL;
coreParam.enableSound = g_Config.bEnableSound;
coreParam.graphicsContext = PSP_CoreParameter().graphicsContext;
coreParam.graphicsContext = nullptr;
coreParam.mountIso = "";
coreParam.mountRoot = baseDirectory + "pspautotests/";
coreParam.startPaused = false;
@@ -95,17 +112,20 @@ void RunTests()
coreParam.fileToStart = baseDirectory + "pspautotests/tests/" + testName + ".prx";
std::string expectedFile = baseDirectory + "pspautotests/tests/" + testName + ".expected";
ILOG("Preparing to execute %s", testName);
ILOG("Preparing to execute '%s'", testName);
std::string error_string;
output = "";
if (!PSP_Init(coreParam, &error_string)) {
ELOG("Failed to init unittest %s : %s", testsToRun[i], error_string.c_str());
PSP_CoreParameter().pixelWidth = pixel_xres;
PSP_CoreParameter().pixelHeight = pixel_yres;
return;
return false;
}
PSP_BeginHostFrame();
// Run the emu until the test exits
ILOG("Test: Entering runloop.");
while (true) {
int blockTicks = usToCycles(1000000 / 10);
while (coreState == CORE_RUNNING) {
@@ -120,6 +140,7 @@ void RunTests()
break;
}
}
PSP_EndHostFrame();
std::ifstream expected(expectedFile.c_str(), std::ios_base::in);
if (!expected) {
@@ -152,9 +173,9 @@ void RunTests()
}
PSP_Shutdown();
}
glViewport(0,0,pixel_xres,pixel_yres);
PSP_CoreParameter().pixelWidth = pixel_xres;
PSP_CoreParameter().pixelHeight = pixel_yres;
PSP_CoreParameter().headLess = false;
g_Config.sReportHost = savedReportHost;
return true; // Managed to execute the tests. Says nothing about the result.
}
View
@@ -17,4 +17,5 @@
#pragma once
void RunTests();
bool RunTests();
bool TestsAvailable();

0 comments on commit 1a97f62

Please sign in to comment.