mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
UnitTests: Add setup error checking
Check return value of calls to File::CreateTempDir() from CoreTiming, FileSystem, and MMIO test classes to verify the test user directory exists, and fail the tests otherwise.
This commit is contained in:
@ -25,15 +25,31 @@ class FileSystemTest : public testing::Test
|
||||
protected:
|
||||
FileSystemTest() : m_profile_path{File::CreateTempDir()}
|
||||
{
|
||||
if (UserDirectoryCreationFailed())
|
||||
{
|
||||
return;
|
||||
}
|
||||
UICommon::SetUserDirectory(m_profile_path);
|
||||
m_fs = IOS::HLE::Kernel{}.GetFS();
|
||||
}
|
||||
|
||||
virtual ~FileSystemTest()
|
||||
{
|
||||
if (UserDirectoryCreationFailed())
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_fs.reset();
|
||||
File::DeleteDirRecursively(m_profile_path);
|
||||
}
|
||||
void SetUp()
|
||||
{
|
||||
if (UserDirectoryCreationFailed())
|
||||
{
|
||||
FAIL();
|
||||
}
|
||||
}
|
||||
bool UserDirectoryCreationFailed() const { return m_profile_path.empty(); }
|
||||
|
||||
std::shared_ptr<FileSystem> m_fs;
|
||||
|
||||
|
Reference in New Issue
Block a user