Merge pull request #4566 from unknownbrackets/tests

Update tests, headless tweaks for fonts.
This commit is contained in:
Henrik Rydgård 2013-11-17 10:39:26 -08:00
commit 59a0795993
8 changed files with 71 additions and 47 deletions

View file

@ -641,21 +641,50 @@ bool SetCurrentDir(const std::string &directory)
return __chdir(directory.c_str()) == 0;
}
#ifdef _WIN32
std::wstring &GetExeDirectory()
const std::string &GetExeDirectory()
{
static std::wstring DolphinPath;
if (DolphinPath.empty())
static std::string ExePath;
if (ExePath.empty())
{
wchar_t Dolphin_exe_Path[2048];
GetModuleFileName(NULL, Dolphin_exe_Path, 2048);
DolphinPath = Dolphin_exe_Path;
DolphinPath = DolphinPath.substr(0, DolphinPath.find_last_of('\\'));
}
return DolphinPath;
}
#ifdef _WIN32
TCHAR program_path[4096] = {0};
GetModuleFileName(NULL, program_path, ARRAY_SIZE(program_path) - 1);
program_path[ARRAY_SIZE(program_path) - 1] = '\0';
TCHAR *last_slash = _tcsrchr(program_path, '\\');
if (last_slash != NULL)
*(last_slash + 1) = '\0';
#ifdef UNICODE
ExePath = ConvertWStringToUTF8(program_path);
#else
ExePath = program_path;
#endif
#elif (defined(__APPLE__) && !defined(IOS)) || defined(__linux__)
char program_path[4096];
uint32_t program_path_size = sizeof(program_path) - 1;
#if defined(__linux__)
if (readlink("/proc/self/exe", program_path, 4095) > 0)
#elif defined(__APPLE__) && !defined(IOS)
if (_NSGetExecutablePath(program_path, &program_path_size) == 0)
#else
#error Unmatched ifdef.
#endif
{
program_path[sizeof(program_path) - 1] = '\0';
char *last_slash = strrchr(program_path, '/');
if (last_slash != NULL)
*(last_slash + 1) = '\0';
ExePath = program_path;
}
#endif
}
return ExePath;
}
IOFile::IOFile()
: m_file(NULL), m_good(true)
{}

View file

@ -103,7 +103,7 @@ void CopyDir(const std::string &source_path, const std::string &dest_path);
bool SetCurrentDir(const std::string &directory);
#ifdef _WIN32
std::wstring &GetExeDirectory();
const std::string &GetExeDirectory();
#endif
// simple wrapper for cstdlib file functions to

View file

@ -392,17 +392,17 @@ void InitSysDirectories() {
if (!g_Config.memCardDirectory.empty() && !g_Config.flash0Directory.empty())
return;
const std::string path = ConvertWStringToUTF8(File::GetExeDirectory());
const std::string path = File::GetExeDirectory();
// Mount a filesystem
g_Config.flash0Directory = path + "/flash0/";
g_Config.flash0Directory = path + "flash0/";
// Detect the "My Documents"(XP) or "Documents"(on Vista/7/8) folder.
wchar_t myDocumentsPath[MAX_PATH];
const HRESULT result = SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, myDocumentsPath);
const std::string myDocsPath = ConvertWStringToUTF8(myDocumentsPath) + "/PPSSPP/";
const std::string installedFile = path + "/installed.txt";
const std::string installedFile = path + "installed.txt";
const bool installed = File::Exists(installedFile);
// If installed.txt exists(and we can determine the Documents directory)
@ -430,7 +430,7 @@ void InitSysDirectories() {
if (lastSlash != (g_Config.memCardDirectory.length() - 1))
g_Config.memCardDirectory.append("/");
} else {
g_Config.memCardDirectory = path + "/memstick/";
g_Config.memCardDirectory = path + "memstick/";
}
// Create the memstickpath before trying to write to it, and fall back on Documents yet again

View file

@ -222,28 +222,6 @@ void NativeGetAppInfo(std::string *app_dir_name, std::string *app_nice_name, boo
#endif
}
const std::string NativeProgramPath() {
#if (defined(__APPLE__) && !defined(IOS)) || defined(__linux__)
char program_path[4096];
uint32_t program_path_size = sizeof(program_path) - 1;
#if defined(__linux__)
if (readlink("/proc/self/exe", program_path, 4095) > 0) {
#elif defined(__APPLE__) && !defined(IOS)
if (_NSGetExecutablePath(program_path, &program_path_size) == 0) {
#else
#error Unmatched ifdef.
#endif
program_path[sizeof(program_path) - 1] = '\0';
char *last_slash = strrchr(program_path, '/');
if (last_slash != NULL)
*(last_slash + 1) = '\0';
return program_path;
}
#endif
return "";
}
void NativeInit(int argc, const char *argv[],
const char *savegame_directory, const char *external_directory, const char *installID) {
#ifdef ANDROID_NDK_PROFILER
@ -261,11 +239,11 @@ void NativeInit(int argc, const char *argv[],
#ifdef IOS
user_data_path += "/";
#elif defined(__APPLE__)
if (File::Exists(NativeProgramPath() + "assets"))
VFSRegister("", new DirectoryAssetReader((NativeProgramPath() + "assets/").c_str()));
if (File::Exists(File::GetExeDirectory() + "assets"))
VFSRegister("", new DirectoryAssetReader((File::GetExeDirectory() + "assets/").c_str()));
// It's common to be in a build-xyz/ directory.
else
VFSRegister("", new DirectoryAssetReader((NativeProgramPath() + "../assets/").c_str()));
VFSRegister("", new DirectoryAssetReader((File::GetExeDirectory() + "../assets/").c_str()));
#endif
// We want this to be FIRST.
@ -293,7 +271,7 @@ void NativeInit(int argc, const char *argv[],
g_Config.flash0Directory = std::string(external_directory) + "/flash0/";
#elif !defined(_WIN32)
g_Config.memCardDirectory = std::string(getenv("HOME")) + "/.ppsspp/";
std::string program_path = NativeProgramPath();
std::string program_path = File::GetExeDirectory();
if (program_path.empty())
g_Config.flash0Directory = g_Config.memCardDirectory + "/flash0/";
else if (File::Exists(program_path + "flash0"))

View file

@ -454,7 +454,7 @@ void CtrlDisAsmView::parseDisasm(const char* disasm, char* opcode, char* argumen
std::string trimString(std::string input)
{
int pos = input.find_first_not_of(" \t");
size_t pos = input.find_first_not_of(" \t");
if (pos != 0 && pos != std::string::npos)
{
input = input.erase(0,pos);
@ -463,7 +463,7 @@ std::string trimString(std::string input)
pos = input.find_last_not_of(" \t");
if (pos != std::string::npos)
{
int size = input.length()-pos-1;
size_t size = input.length()-pos-1;
input = input.erase(pos+1,size);
}

View file

@ -6,6 +6,7 @@
#include <cstdlib>
#include <limits>
#include "Common/FileUtil.h"
#include "Core/Config.h"
#include "Core/Core.h"
#include "Core/CoreTiming.h"
@ -336,6 +337,7 @@ int main(int argc, const char* argv[])
g_Config.iLockParentalLevel = 9;
g_Config.iInternalResolution = 1;
g_Config.bFrameSkipUnthrottle = false;
g_Config.bEnableLogging = fullLog;
#ifdef _WIN32
InitSysDirectories();
@ -345,10 +347,18 @@ int main(int argc, const char* argv[])
#elif defined(BLACKBERRY) || defined(__SYMBIAN32__)
#elif !defined(_WIN32)
g_Config.memCardDirectory = std::string(getenv("HOME")) + "/.ppsspp/";
// TODO: This isn't a great place.
g_Config.flash0Directory = g_Config.memCardDirectory + "/flash0/";
#endif
// Try to find the flash0 directory. Often this is from a subdirectory.
for (int i = 0; i < 3; ++i)
{
if (!File::Exists(g_Config.flash0Directory))
g_Config.flash0Directory += "../../flash0/";
}
// Or else, maybe in the executable's dir.
if (!File::Exists(g_Config.flash0Directory))
g_Config.flash0Directory = File::GetExeDirectory() + "flash0/";
if (screenshotFilename != 0)
headlessHost->SetComparisonScreenshot(screenshotFilename);

@ -1 +1 @@
Subproject commit 4488741f832cdb4e366fd57fc8caeb7295437758
Subproject commit 5cc6ce498379ee195709d17042c2342c4c00c873

View file

@ -88,13 +88,16 @@ tests_good = [
"hash/hash",
"hle/check_not_used_uids",
"intr/intr",
"intr/suspended",
"intr/vblank/vblank",
"io/cwd/cwd",
"loader/bss/bss",
"malloc/malloc",
"misc/testgp",
"misc/libc",
"misc/deadbeef",
"misc/dcache",
"misc/timeconv",
"mstick/mstick",
"rtc/rtc",
"string/string",
@ -217,13 +220,17 @@ tests_good = [
tests_next = [
# These are the next tests up for fixing. These run by default.
"cpu/cpu_alu/cpu_branch",
"cpu/fpu/fcr",
"audio/atrac/atractest",
"audio/atrac/decode",
"audio/atrac/resetting",
"audio/sceaudio/datalen",
"audio/sceaudio/output",
"audio/sceaudio/reserve",
"ctrl/vblank",
"display/hcount",
"intr/waits",
"threads/callbacks/cancel",
"threads/callbacks/count",
"threads/callbacks/notify",