mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Add some test code for file systems. Discovered that delete on scoped storage is always recursive! Dangerous.
This commit is contained in:
parent
558bcff368
commit
3b3373dde6
3 changed files with 56 additions and 0 deletions
|
@ -1778,6 +1778,7 @@ void DeveloperToolsScreen::CreateViews() {
|
|||
list->Add(new CheckBox(&g_Config.bVendorBugChecksEnabled, dev->T("Enable driver bug workarounds")));
|
||||
list->Add(new Choice(dev->T("Framedump tests")))->OnClick.Handle(this, &DeveloperToolsScreen::OnFramedumpTest);
|
||||
list->Add(new Choice(dev->T("Touchscreen Test")))->OnClick.Handle(this, &DeveloperToolsScreen::OnTouchscreenTest);
|
||||
// list->Add(new Choice(dev->T("Memstick Test")))->OnClick.Handle(this, &DeveloperToolsScreen::OnMemstickTest);
|
||||
|
||||
allowDebugger_ = !WebServerStopped(WebServerFlags::DEBUGGER);
|
||||
canAllowDebugger_ = !WebServerStopping(WebServerFlags::DEBUGGER);
|
||||
|
@ -1990,6 +1991,53 @@ void DeveloperToolsScreen::update() {
|
|||
canAllowDebugger_ = !WebServerStopping(WebServerFlags::DEBUGGER);
|
||||
}
|
||||
|
||||
static bool RunMemstickTest(std::string *error) {
|
||||
Path testRoot = GetSysDirectory(PSPDirectories::DIRECTORY_CACHE) / "test";
|
||||
|
||||
*error = "N/A";
|
||||
|
||||
File::CreateDir(testRoot);
|
||||
if (!File::Exists(testRoot)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Path testFilePath = testRoot / "temp.txt";
|
||||
File::CreateEmptyFile(testFilePath);
|
||||
|
||||
// Attempt to delete the test root. This should fail since it still contains files.
|
||||
File::DeleteDir(testRoot);
|
||||
if (!File::Exists(testRoot)) {
|
||||
*error = "testroot was deleted with a file in it!";
|
||||
return false;
|
||||
}
|
||||
|
||||
File::Delete(testFilePath);
|
||||
if (File::Exists(testFilePath)) {
|
||||
*error = "testfile wasn't deleted";
|
||||
return false;
|
||||
}
|
||||
|
||||
File::DeleteDir(testRoot);
|
||||
if (File::Exists(testRoot)) {
|
||||
*error = "testroot wasn't deleted, even when empty";
|
||||
return false;
|
||||
}
|
||||
|
||||
*error = "passed";
|
||||
return true;
|
||||
}
|
||||
|
||||
UI::EventReturn DeveloperToolsScreen::OnMemstickTest(UI::EventParams &e) {
|
||||
std::string error;
|
||||
if (RunMemstickTest(&error)) {
|
||||
g_OSD.Show(OSDType::MESSAGE_SUCCESS, "Memstick test passed", error, 6.0f);
|
||||
} else {
|
||||
g_OSD.Show(OSDType::MESSAGE_ERROR, "Memstick test failed", error, 6.0f);
|
||||
}
|
||||
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
void HostnameSelectScreen::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
using namespace UI;
|
||||
auto sy = GetI18NCategory(I18NCat::SYSTEM);
|
||||
|
|
|
@ -152,6 +152,7 @@ private:
|
|||
UI::EventReturn OnRemoteDebugger(UI::EventParams &e);
|
||||
UI::EventReturn OnGPUDriverTest(UI::EventParams &e);
|
||||
UI::EventReturn OnFramedumpTest(UI::EventParams &e);
|
||||
UI::EventReturn OnMemstickTest(UI::EventParams &e);
|
||||
UI::EventReturn OnTouchscreenTest(UI::EventParams &e);
|
||||
UI::EventReturn OnCopyStatesToRoot(UI::EventParams &e);
|
||||
|
||||
|
|
|
@ -118,6 +118,7 @@
|
|||
#include "UI/DiscordIntegration.h"
|
||||
#include "UI/EmuScreen.h"
|
||||
#include "UI/GameInfoCache.h"
|
||||
#include "UI/GameSettingsScreen.h"
|
||||
#include "UI/GPUDriverTestScreen.h"
|
||||
#include "UI/MiscScreens.h"
|
||||
#include "UI/MemStickScreen.h"
|
||||
|
@ -534,6 +535,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
|||
bool gotBootFilename = false;
|
||||
bool gotoGameSettings = false;
|
||||
bool gotoTouchScreenTest = false;
|
||||
bool gotoDeveloperTools = false;
|
||||
boot_filename.clear();
|
||||
|
||||
// Parse command line
|
||||
|
@ -603,6 +605,8 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
|||
gotoTouchScreenTest = true;
|
||||
if (!strcmp(argv[i], "--gamesettings"))
|
||||
gotoGameSettings = true;
|
||||
if (!strcmp(argv[i], "--developertools"))
|
||||
gotoDeveloperTools = true;
|
||||
if (!strncmp(argv[i], "--appendconfig=", strlen("--appendconfig=")) && strlen(argv[i]) > strlen("--appendconfig=")) {
|
||||
g_Config.SetAppendedConfigIni(Path(std::string(argv[i] + strlen("--appendconfig="))));
|
||||
g_Config.LoadAppendedConfig();
|
||||
|
@ -755,6 +759,9 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
|||
} else if (gotoTouchScreenTest) {
|
||||
g_screenManager->switchScreen(new MainScreen());
|
||||
g_screenManager->push(new TouchTestScreen(Path()));
|
||||
} else if (gotoDeveloperTools) {
|
||||
g_screenManager->switchScreen(new MainScreen());
|
||||
g_screenManager->push(new DeveloperToolsScreen(Path()));
|
||||
} else if (skipLogo) {
|
||||
g_screenManager->switchScreen(new EmuScreen(boot_filename));
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue