Skip to content
Snippets Groups Projects
Commit 2d10c8e1 authored by Eric Cano's avatar Eric Cano
Browse files

Fixed a missing closedir.

Added a compulsory valgrind run in the build of rpms.
This build should fail on memory leak.
parent e70838d5
Branches
Tags
No related merge requests found
......@@ -223,6 +223,7 @@ namespace SCSI {
}
}
}
m_sysWrapper.closedir(dirp);
}
/**
......
......@@ -52,7 +52,7 @@ TEST(DeviceList, ScansCorrectly) {
/* We expect the following calls: */
EXPECT_CALL(sysWrapper, opendir(_)).Times(3);
EXPECT_CALL(sysWrapper, readdir(_)).Times(AtLeast(30));
EXPECT_CALL(sysWrapper, closedir(_)).Times(1);
EXPECT_CALL(sysWrapper, closedir(_)).Times(3);
EXPECT_CALL(sysWrapper, realpath(_, _)).Times(3);
EXPECT_CALL(sysWrapper, open(_, _)).Times(10);
EXPECT_CALL(sysWrapper, read(_, _, _)).Times(20);
......
......@@ -57,3 +57,8 @@ TEST(Regex, OperationalTest) {
ASSERT_EQ(ret2[1], "st124");
ASSERT_EQ(ret3.size(), 0);
}
TEST(Regex,MemoryLeak) {
char * oops = new char[10];
oops[0] = '\0';
}
......@@ -14,6 +14,7 @@ BuildRequires: gtest >= 1.5.0
BuildRequires: gmock >= 1.5.0
BuildRequires: gtest-devel >= 1.5.0
BuildRequires: gmock-devel >= 1.5.0
BuildRequires: valgrind >= 3.5.0
%description
The CERN tape server project.
......@@ -50,6 +51,7 @@ echo "Installed!"
%check
cd build
test/unitTest
valgrind --leak-check=full --show-reachable=yes --error-exitcode=1 test/unitTest
%clean
rm -rf $RPM_BUILD_ROOT
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment