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:
trivialfis
2018-08-19 12:40:30 +08:00
committed by Rory Mitchell
parent 983cb0b374
commit cf2d86a4f6
30 changed files with 221 additions and 76 deletions

View File

@@ -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;
}