Add travis sanitizers tests. (#3557)
* Add travis sanitizers tests. * Add gcc-7 in Travis. * Add SANITIZER_PATH for CMake. * Enable sanitizer tests in Travis. * Fix memory leaks in tests. * Fix all memory leaks reported by Address Sanitizer. * tests/cpp/helpers.h/CreateDMatrix now returns raw pointer.
This commit is contained in:
committed by
Rory Mitchell
parent
983cb0b374
commit
cf2d86a4f6
@@ -64,6 +64,8 @@ TEST(MetaInfo, SaveLoadBinary) {
|
||||
EXPECT_EQ(inforead.num_row_, info.num_row_);
|
||||
|
||||
std::remove(tmp_file.c_str());
|
||||
|
||||
delete fs;
|
||||
}
|
||||
|
||||
TEST(MetaInfo, LoadQid) {
|
||||
|
||||
@@ -29,4 +29,7 @@ TEST(SimpleCSRSource, SaveLoadBinary) {
|
||||
EXPECT_EQ(first_row[2].index, first_row_read[2].index);
|
||||
EXPECT_EQ(first_row[2].fvalue, first_row_read[2].fvalue);
|
||||
row_iter = nullptr; row_iter_read = nullptr;
|
||||
|
||||
delete dmat;
|
||||
delete dmat_read;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ TEST(SimpleDMatrix, MetaInfo) {
|
||||
EXPECT_EQ(dmat->Info().num_col_, 5);
|
||||
EXPECT_EQ(dmat->Info().num_nonzero_, 6);
|
||||
EXPECT_EQ(dmat->Info().labels_.size(), dmat->Info().num_row_);
|
||||
|
||||
delete dmat;
|
||||
}
|
||||
|
||||
TEST(SimpleDMatrix, RowAccess) {
|
||||
@@ -35,6 +37,8 @@ TEST(SimpleDMatrix, RowAccess) {
|
||||
EXPECT_EQ(first_row[2].index, 2);
|
||||
EXPECT_EQ(first_row[2].fvalue, 20);
|
||||
row_iter = nullptr;
|
||||
|
||||
delete dmat;
|
||||
}
|
||||
|
||||
TEST(SimpleDMatrix, ColAccessWithoutBatches) {
|
||||
@@ -76,4 +80,6 @@ TEST(SimpleDMatrix, ColAccessWithoutBatches) {
|
||||
}
|
||||
EXPECT_EQ(num_col_batch, 1) << "Expected number of batches to be 1";
|
||||
col_iter = nullptr;
|
||||
|
||||
delete dmat;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ TEST(SparsePageDMatrix, MetaInfo) {
|
||||
// Clean up of external memory files
|
||||
std::remove((tmp_file + ".cache").c_str());
|
||||
std::remove((tmp_file + ".cache.row.page").c_str());
|
||||
|
||||
delete dmat;
|
||||
}
|
||||
|
||||
TEST(SparsePageDMatrix, RowAccess) {
|
||||
@@ -48,6 +50,8 @@ TEST(SparsePageDMatrix, RowAccess) {
|
||||
// Clean up of external memory files
|
||||
std::remove((tmp_file + ".cache").c_str());
|
||||
std::remove((tmp_file + ".cache.row.page").c_str());
|
||||
|
||||
delete dmat;
|
||||
}
|
||||
|
||||
TEST(SparsePageDMatrix, ColAcess) {
|
||||
@@ -84,4 +88,6 @@ TEST(SparsePageDMatrix, ColAcess) {
|
||||
std::remove((tmp_file + ".cache").c_str());
|
||||
std::remove((tmp_file + ".cache.col.page").c_str());
|
||||
std::remove((tmp_file + ".cache.row.page").c_str());
|
||||
|
||||
delete dmat;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user