mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-09-08 18:45:48 +00: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:
parent
caff472dbf
commit
83f912b58a
3 changed files with 32 additions and 0 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue