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

@@ -11,6 +11,7 @@ TEST(Metric, RMSE) {
{0.1f, 0.9f, 0.1f, 0.9f},
{ 0, 0, 1, 1}),
0.6403f, 0.001f);
delete metric;
}
TEST(Metric, MAE) {
@@ -21,6 +22,7 @@ TEST(Metric, MAE) {
{0.1f, 0.9f, 0.1f, 0.9f},
{ 0, 0, 1, 1}),
0.5f, 0.001f);
delete metric;
}
TEST(Metric, LogLoss) {
@@ -31,6 +33,7 @@ TEST(Metric, LogLoss) {
{0.1f, 0.9f, 0.1f, 0.9f},
{ 0, 0, 1, 1}),
1.2039f, 0.001f);
delete metric;
}
TEST(Metric, Error) {
@@ -56,6 +59,7 @@ TEST(Metric, Error) {
{0.1f, 0.2f, 0.1f, 0.2f},
{ 0, 0, 1, 1}),
0.5f, 0.001f);
delete metric;
}
TEST(Metric, PoissionNegLogLik) {
@@ -66,4 +70,5 @@ TEST(Metric, PoissionNegLogLik) {
{0.1f, 0.2f, 0.1f, 0.2f},
{ 0, 0, 1, 1}),
1.1280f, 0.001f);
delete metric;
}