mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-03-03 19:47:59 +00:00
Basic testrunner for Android.
Running it as-is reveals that clo and rotrv are broken in ARMJIT.
This commit is contained in:
parent
a972d211c5
commit
57d4544ef4
@ -962,6 +962,7 @@ endif()
|
||||
set(NativeAppSource
|
||||
android/jni/NativeApp.cpp
|
||||
android/jni/EmuScreen.cpp
|
||||
android/jni/TestRunner.cpp
|
||||
android/jni/MenuScreens.cpp
|
||||
android/jni/GamepadEmu.cpp
|
||||
android/jni/UIShader.cpp
|
||||
|
@ -33,6 +33,7 @@ enum GPUCore {
|
||||
|
||||
struct CoreParameter
|
||||
{
|
||||
CoreParameter() : collectEmuLog(0) {}
|
||||
// 0 = Interpreter
|
||||
// 1 = Jit
|
||||
// 2 = JitIL
|
||||
@ -47,6 +48,7 @@ struct CoreParameter
|
||||
bool disableG3Dlog;
|
||||
bool enableDebugging; // enables breakpoints and other time-consuming debugger features
|
||||
bool printfEmuLog; // writes "emulator:" logging to stdout
|
||||
std::string *collectEmuLog;
|
||||
bool headLess; // Try to avoid messageboxes etc
|
||||
bool useMediaEngine;
|
||||
|
||||
|
@ -864,9 +864,9 @@ u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 outPtr,
|
||||
{
|
||||
host->SendDebugOutput(data.c_str());
|
||||
}
|
||||
else
|
||||
if (PSP_CoreParameter().collectEmuLog)
|
||||
{
|
||||
DEBUG_LOG(HLE, "%s", data.c_str());
|
||||
*PSP_CoreParameter().collectEmuLog += data;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -249,6 +249,12 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\android\jni\TestRunner.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\android\jni\UIShader.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@ -307,6 +313,7 @@
|
||||
<ClInclude Include="..\android\jni\EmuScreen.h" />
|
||||
<ClInclude Include="..\android\jni\GamepadEmu.h" />
|
||||
<ClInclude Include="..\android\jni\MenuScreens.h" />
|
||||
<ClInclude Include="..\android\jni\TestRunner.h" />
|
||||
<ClInclude Include="..\android\jni\UIShader.h" />
|
||||
<ClInclude Include="Debugger\CtrlDisAsmView.h" />
|
||||
<ClInclude Include="Debugger\CtrlMemView.h" />
|
||||
|
@ -107,6 +107,9 @@
|
||||
<ClCompile Include="..\android\jni\ArmEmitterTest.cpp">
|
||||
<Filter>Android</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\android\jni\TestRunner.cpp">
|
||||
<Filter>Android</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Debugger\CtrlDisAsmView.h">
|
||||
@ -188,6 +191,9 @@
|
||||
<ClInclude Include="..\android\jni\ARMEmitterTest.h">
|
||||
<Filter>Android</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\android\jni\TestRunner.h">
|
||||
<Filter>Android</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="icon1.ico">
|
||||
|
@ -50,6 +50,7 @@ LOCAL_SRC_FILES := \
|
||||
UIShader.cpp \
|
||||
GamepadEmu.cpp \
|
||||
ArmEmitterTest.cpp \
|
||||
TestRunner.cpp \
|
||||
ui_atlas.cpp \
|
||||
$(SRC)/native/android/app-android.cpp \
|
||||
$(SRC)/ext/disarm.cpp \
|
||||
|
@ -15,6 +15,8 @@
|
||||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "base/logging.h"
|
||||
|
||||
#include "gfx_es2/glsl_program.h"
|
||||
#include "gfx_es2/gl_state.h"
|
||||
#include "gfx_es2/fbo.h"
|
||||
@ -167,8 +169,14 @@ void EmuScreen::render()
|
||||
if (coreState == CORE_NEXTFRAME) {
|
||||
// set back to running for the next frame
|
||||
coreState = CORE_RUNNING;
|
||||
} else if (coreState == CORE_POWERDOWN) {
|
||||
ILOG("SELF-POWERDOWN!");
|
||||
screenManager()->switchScreen(new MenuScreen());
|
||||
}
|
||||
|
||||
if (invalid_)
|
||||
return;
|
||||
|
||||
if (g_Config.bBufferedRendering)
|
||||
fbo_unbind();
|
||||
|
||||
@ -202,5 +210,6 @@ void EmuScreen::render()
|
||||
|
||||
void EmuScreen::deviceLost()
|
||||
{
|
||||
ILOG("EmuScreen::deviceLost()");
|
||||
gpu->DeviceLost();
|
||||
}
|
||||
|
@ -42,6 +42,7 @@
|
||||
|
||||
#include "MenuScreens.h"
|
||||
#include "EmuScreen.h"
|
||||
#include "TestRunner.h"
|
||||
|
||||
#ifdef USING_QT_UI
|
||||
#include <QFileDialog>
|
||||
@ -344,6 +345,44 @@ void SettingsScreen::render() {
|
||||
if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres-10), LARGE_BUTTON_WIDTH, "Back", ALIGN_RIGHT | ALIGN_BOTTOM)) {
|
||||
screenManager()->finishDialog(this, DR_OK);
|
||||
}
|
||||
if (UIButton(GEN_ID, Pos(10, dp_yres-10), LARGE_BUTTON_WIDTH, "Developer Menu", ALIGN_BOTTOMLEFT)) {
|
||||
screenManager()->push(new DeveloperScreen());
|
||||
}
|
||||
|
||||
UIEnd();
|
||||
|
||||
glsl_bind(UIShader_Get());
|
||||
ui_draw2d.Flush(UIShader_Get());
|
||||
}
|
||||
|
||||
void DeveloperScreen::update(InputState &input) {
|
||||
if (input.pad_buttons_down & PAD_BUTTON_BACK) {
|
||||
g_Config.Save();
|
||||
screenManager()->finishDialog(this, DR_OK);
|
||||
}
|
||||
}
|
||||
|
||||
void DeveloperScreen::render() {
|
||||
UIShader_Prepare();
|
||||
UIBegin();
|
||||
DrawBackground(1.0f);
|
||||
|
||||
ui_draw2d.DrawText(UBUNTU48, "Developer Tools", dp_xres / 2, 20, 0xFFFFFFFF, ALIGN_HCENTER);
|
||||
|
||||
if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres-10), LARGE_BUTTON_WIDTH, "Back", ALIGN_RIGHT | ALIGN_BOTTOM)) {
|
||||
screenManager()->finishDialog(this, DR_OK);
|
||||
}
|
||||
|
||||
if (UIButton(GEN_ID, Pos(dp_xres / 2, 100), LARGE_BUTTON_WIDTH, "Run CPU tests", ALIGN_CENTER | ALIGN_TOP)) {
|
||||
// TODO: Run tests
|
||||
RunTests();
|
||||
// screenManager()->push(new EmuScreen())
|
||||
}
|
||||
|
||||
|
||||
if (UIButton(GEN_ID, Pos(10, dp_yres-10), LARGE_BUTTON_WIDTH, "Dump frame to log", ALIGN_BOTTOMLEFT)) {
|
||||
gpu->DumpNextFrame();
|
||||
}
|
||||
|
||||
UIEnd();
|
||||
|
||||
|
@ -67,6 +67,14 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class DeveloperScreen : public Screen
|
||||
{
|
||||
public:
|
||||
void update(InputState &input);
|
||||
void render();
|
||||
};
|
||||
|
||||
|
||||
struct FileSelectScreenOptions {
|
||||
const char* filter; // Enforced extension filter. Case insensitive, extensions separated by ":".
|
||||
bool allowChooseDirectory;
|
||||
|
129
android/jni/TestRunner.cpp
Normal file
129
android/jni/TestRunner.cpp
Normal file
@ -0,0 +1,129 @@
|
||||
// Copyright (c) 2012- PPSSPP Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0 or later versions.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
|
||||
// TO USE:
|
||||
// Simply copy pspautotests to the root of the USB memory / SD card of your android device.
|
||||
// Then go to Settings / Developer Menu / Run CPU tests.
|
||||
// It currently just runs one test but that can be easily changed.
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/logging.h"
|
||||
|
||||
#include "Core/Core.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "TestRunner.h"
|
||||
|
||||
|
||||
const char *testsToRun[] = {
|
||||
"cpu/cpu_alu/cpu_alu",
|
||||
"cpu/fpu/fpu",
|
||||
"cpu/icache/icache",
|
||||
"cpu/lsu/lsu",
|
||||
"cpu/vfpu/base/vfpu",
|
||||
"cpu/vfpu/colors/vfpu_colors",
|
||||
"cpu/vfpu/convert/vfpu_convert",
|
||||
"cpu/vfpu/prefixes/vfpu_prefixes",
|
||||
};
|
||||
|
||||
void RunTests()
|
||||
{
|
||||
std::string output;
|
||||
|
||||
CoreParameter coreParam;
|
||||
coreParam.cpuCore = g_Config.bJit ? CPU_JIT : CPU_INTERPRETER;
|
||||
coreParam.gpuCore = GPU_GLES;
|
||||
coreParam.enableSound = g_Config.bEnableSound;
|
||||
coreParam.mountIso = "";
|
||||
coreParam.startPaused = false;
|
||||
coreParam.enableDebugging = false;
|
||||
coreParam.printfEmuLog = false;
|
||||
coreParam.headLess = false;
|
||||
coreParam.renderWidth = 480;
|
||||
coreParam.renderHeight = 272;
|
||||
coreParam.outputWidth = 480;
|
||||
coreParam.outputHeight = 272;
|
||||
coreParam.pixelWidth = 480;
|
||||
coreParam.pixelHeight = 272;
|
||||
coreParam.useMediaEngine = false;
|
||||
coreParam.collectEmuLog = &output;
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(testsToRun); i++) {
|
||||
const char *testName = testsToRun[i];
|
||||
coreParam.fileToStart = g_Config.memCardDirectory + "/pspautotests/tests/" + testName + ".prx";
|
||||
std::string expectedFile = g_Config.memCardDirectory + "/pspautotests/tests/" + testName + ".expected";
|
||||
|
||||
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());
|
||||
return;
|
||||
}
|
||||
|
||||
// Run the emu until the test exits
|
||||
while (true) {
|
||||
int blockTicks = usToCycles(1000000 / 10);
|
||||
while (coreState == CORE_RUNNING) {
|
||||
u64 nowTicks = CoreTiming::GetTicks();
|
||||
mipsr4k.RunLoopUntil(nowTicks + blockTicks);
|
||||
}
|
||||
// Hopefully coreState is now CORE_NEXTFRAME
|
||||
if (coreState == CORE_NEXTFRAME) {
|
||||
// set back to running for the next frame
|
||||
coreState = CORE_RUNNING;
|
||||
} else if (coreState == CORE_POWERDOWN) {
|
||||
ILOG("Finished running test %s", testName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::ifstream expected(expectedFile.c_str(), std::ios_base::in);
|
||||
if (!expected) {
|
||||
ELOG("Error opening expectedFile %s", expectedFile.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
std::istringstream logoutput(output);
|
||||
|
||||
while (true) {
|
||||
std::string e, o;
|
||||
std::getline(expected, e);
|
||||
std::getline(logoutput, o);
|
||||
e = e.substr(0, e.size() - 1); // For some reason we get some extra character
|
||||
if (e != o) {
|
||||
ELOG("DIFF! %i vs %i, %s vs %s", (int)e.size(), (int)o.size(), e.c_str(), o.c_str());
|
||||
}
|
||||
if (expected.eof()) {
|
||||
break;
|
||||
}
|
||||
if (logoutput.eof()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ILOG("Test executed.");
|
||||
return;
|
||||
}
|
||||
}
|
18
android/jni/TestRunner.h
Normal file
18
android/jni/TestRunner.h
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright (c) 2012- PPSSPP Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0 or later versions.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
void RunTests();
|
Loading…
x
Reference in New Issue
Block a user