Run tests in a temporary directory (#7723)
Fix some tests to run in a temporary directory in case the root directory is not writable. Note that most of tests are already running in the temporary directory, so this PR just make them consistent.
This commit is contained in:
@@ -194,7 +194,8 @@ TEST(SimpleDMatrix, FromCSC) {
|
||||
}
|
||||
|
||||
TEST(SimpleDMatrix, FromFile) {
|
||||
std::string filename = "test.libsvm";
|
||||
dmlc::TemporaryDirectory tempdir;
|
||||
std::string filename = tempdir.path + "test.libsvm";
|
||||
CreateBigTestData(filename, 3 * 5);
|
||||
// Add an empty row at the end of the matrix
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@ void TestSparseDMatrixLoadFile() {
|
||||
data::fileiter::Next,
|
||||
std::numeric_limits<float>::quiet_NaN(),
|
||||
1,
|
||||
"cache"};
|
||||
tmpdir.path + "cache"};
|
||||
ASSERT_EQ(m.Info().num_col_, 5);
|
||||
ASSERT_EQ(m.Info().num_row_, 64);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user