summaryrefslogtreecommitdiff
path: root/src/utils/virtfs_unittest.cc
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-02-20 15:51:27 +0300
committerAndrei Karas <akaras@inbox.ru>2017-02-20 15:51:27 +0300
commitcf772ab6f9fdfe1647b9b7b79aab685ebc831f31 (patch)
tree25cdb35a8733efe3a4cb90e36cbb89e8e0c24c10 /src/utils/virtfs_unittest.cc
parent80ba4766d8ce9861f6d026e791abc741e3fed0f4 (diff)
downloadmv-cf772ab6f9fdfe1647b9b7b79aab685ebc831f31.tar.gz
mv-cf772ab6f9fdfe1647b9b7b79aab685ebc831f31.tar.bz2
mv-cf772ab6f9fdfe1647b9b7b79aab685ebc831f31.tar.xz
mv-cf772ab6f9fdfe1647b9b7b79aab685ebc831f31.zip
Fix some leaks in unit tests.
Add support for suppression some leaks in asan.
Diffstat (limited to 'src/utils/virtfs_unittest.cc')
-rw-r--r--src/utils/virtfs_unittest.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/utils/virtfs_unittest.cc b/src/utils/virtfs_unittest.cc
index af2c22dee..e8af0bb1d 100644
--- a/src/utils/virtfs_unittest.cc
+++ b/src/utils/virtfs_unittest.cc
@@ -21,6 +21,7 @@
#include "catch.hpp"
#include "utils/checkutils.h"
+#include "utils/delete2.h"
#include "utils/virtfs.h"
#include "utils/virtfstools.h"
#include "utils/virtlist.h"
@@ -75,6 +76,7 @@ TEST_CASE("VirtFs exists")
VirtFs::removeDirFromSearchPath("data");
VirtFs::removeDirFromSearchPath("../data");
+ delete2(logger);
}
static void removeTemp(StringVect &restrict list)
@@ -105,6 +107,8 @@ static void removeTemp(StringVect &restrict list)
TEST_CASE("VirtFs enumerateFiles")
{
+ logger = new Logger;
+
VirtFs::addDirToSearchPath("data", Append_false);
VirtFs::addDirToSearchPath("../data", Append_false);
@@ -134,6 +138,7 @@ TEST_CASE("VirtFs enumerateFiles")
VirtFs::removeDirFromSearchPath("data");
VirtFs::removeDirFromSearchPath("../data");
+ delete2(logger);
}
TEST_CASE("VirtFs isDirectory")
@@ -191,6 +196,7 @@ TEST_CASE("VirtFs isDirectory")
VirtFs::removeDirFromSearchPath("data");
VirtFs::removeDirFromSearchPath("../data");
+ delete2(logger);
}
TEST_CASE("VirtFs openRead")
@@ -252,6 +258,7 @@ TEST_CASE("VirtFs openRead")
VirtFs::removeDirFromSearchPath("data");
VirtFs::removeDirFromSearchPath("../data");
+ delete2(logger);
}
TEST_CASE("VirtFs addZipToSearchPath")
@@ -266,6 +273,7 @@ TEST_CASE("VirtFs removeZipFromSearchPath")
TEST_CASE("VirtFs getRealDir")
{
+ logger = new Logger();
REQUIRE(VirtFs::getRealDir(".") == "");
REQUIRE(VirtFs::getRealDir("..") == "");
const bool dir1 = VirtFs::addDirToSearchPath("data", Append_false);
@@ -324,10 +332,12 @@ TEST_CASE("VirtFs getRealDir")
VirtFs::removeDirFromSearchPath("data");
VirtFs::removeDirFromSearchPath("../data");
+ delete2(logger);
}
TEST_CASE("VirtFs permitLinks")
{
+ logger = new Logger();
VirtFs::addDirToSearchPath("data", Append_false);
VirtFs::addDirToSearchPath("../data", Append_false);
@@ -355,10 +365,12 @@ TEST_CASE("VirtFs permitLinks")
VirtFs::removeDirFromSearchPath("data");
VirtFs::removeDirFromSearchPath("../data");
+ delete2(logger);
}
TEST_CASE("VirtFs read")
{
+ logger = new Logger();
VirtFs::addDirToSearchPath("data", Append_false);
VirtFs::addDirToSearchPath("../data", Append_false);
@@ -389,4 +401,5 @@ TEST_CASE("VirtFs read")
VirtFs::removeDirFromSearchPath("data");
VirtFs::removeDirFromSearchPath("../data");
+ delete2(logger);
}