Skip to content

Commit

Permalink
Don't include dmlc filesystem directly.
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Sep 8, 2022
1 parent 9fe2023 commit bbad2dd
Show file tree
Hide file tree
Showing 28 changed files with 108 additions and 94 deletions.
1 change: 0 additions & 1 deletion tests/cpp/common/test_column_matrix.cc
@@ -1,7 +1,6 @@
/*!
* Copyright 2018-2022 by XGBoost Contributors
*/
#include <dmlc/filesystem.h>
#include <gtest/gtest.h>

#include "../../../src/common/column_matrix.h"
Expand Down
6 changes: 4 additions & 2 deletions tests/cpp/common/test_config.cc
@@ -1,11 +1,13 @@
/*!
* Copyright 2019 by Contributors
*/
#include <gtest/gtest.h>

#include <fstream>
#include <string>
#include <gtest/gtest.h>
#include <dmlc/filesystem.h>

#include "../../../src/common/config.h"
#include "../filesystem.h" // dmlc::TemporaryDirectory
#include "../helpers.h"

namespace xgboost {
Expand Down
21 changes: 10 additions & 11 deletions tests/cpp/common/test_hist_util.cu
@@ -1,26 +1,25 @@
/*!
* Copyright 2019-2022 by XGBoost Contributors
*/
#include <dmlc/filesystem.h>
#include <gtest/gtest.h>
#include <thrust/device_vector.h>
#include <xgboost/c_api.h>
#include <xgboost/data.h>

#include <algorithm>
#include <cmath>
#include <thrust/device_vector.h>

#include <xgboost/data.h>
#include <xgboost/c_api.h>

#include "test_hist_util.h"
#include "../helpers.h"
#include "../data/test_array_interface.h"
#include "../../../include/xgboost/logging.h"
#include "../../../src/common/device_helpers.cuh"
#include "../../../src/common/hist_util.h"
#include "../../../src/common/hist_util.cuh"
#include "../../../src/data/device_adapter.cuh"
#include "../../../src/common/hist_util.h"
#include "../../../src/common/math.h"
#include "../../../src/data/device_adapter.cuh"
#include "../../../src/data/simple_dmatrix.h"
#include "../../../include/xgboost/logging.h"
#include "../data/test_array_interface.h"
#include "../filesystem.h" // dmlc::TemporaryDirectory
#include "../helpers.h"
#include "test_hist_util.h"

namespace xgboost {
namespace common {
Expand Down
11 changes: 6 additions & 5 deletions tests/cpp/common/test_hist_util.h
Expand Up @@ -3,16 +3,17 @@
*/
#pragma once
#include <gtest/gtest.h>
#include <dmlc/filesystem.h>

#include <fstream>
#include <random>
#include <vector>
#include <string>
#include <fstream>
#include <vector>

#include "../helpers.h"
#include "../../../src/common/hist_util.h"
#include "../../../src/data/simple_dmatrix.h"
#include "../../../src/data/adapter.h"
#include "../../../src/data/simple_dmatrix.h"
#include "../filesystem.h" // dmlc::TemporaryDirectory
#include "../helpers.h"

#ifdef __CUDACC__
#include <xgboost/json.h>
Expand Down
4 changes: 2 additions & 2 deletions tests/cpp/common/test_io.cc
Expand Up @@ -2,12 +2,12 @@
* Copyright (c) by XGBoost Contributors 2019
*/
#include <gtest/gtest.h>
#include <dmlc/filesystem.h>

#include <fstream>

#include "../helpers.h"
#include "../../../src/common/io.h"
#include "../helpers.h"
#include "../filesystem.h" // dmlc::TemporaryDirectory

namespace xgboost {
namespace common {
Expand Down
11 changes: 6 additions & 5 deletions tests/cpp/common/test_json.cc
Expand Up @@ -2,16 +2,17 @@
* Copyright (c) by Contributors 2019-2022
*/
#include <gtest/gtest.h>
#include <dmlc/filesystem.h>

#include <fstream>
#include <map>

#include "../../../src/common/charconv.h"
#include "../../../src/common/io.h"
#include "../filesystem.h" // dmlc::TemporaryDirectory
#include "../helpers.h"
#include "xgboost/json.h"
#include "xgboost/logging.h"
#include "xgboost/json_io.h"
#include "../helpers.h"
#include "../../../src/common/io.h"
#include "../../../src/common/charconv.h"
#include "xgboost/logging.h"

namespace xgboost {

Expand Down
10 changes: 4 additions & 6 deletions tests/cpp/common/test_version.cc
@@ -1,18 +1,16 @@
/*!
* Copyright 2019 XGBoost contributors
*/
#include <gtest/gtest.h>

#include <dmlc/filesystem.h>
#include <dmlc/io.h>

#include <xgboost/version_config.h>
#include <xgboost/json.h>
#include <gtest/gtest.h>
#include <xgboost/base.h>
#include <xgboost/json.h>
#include <xgboost/version_config.h>

#include <string>

#include "../../../src/common/version.h"
#include "../filesystem.h" // dmlc::TemporaryDirectory

namespace xgboost {
TEST(Version, Basic) {
Expand Down
5 changes: 3 additions & 2 deletions tests/cpp/data/test_data.cc
Expand Up @@ -2,13 +2,14 @@
* Copyright 2019-2022 by XGBoost Contributors
*/
#include <gtest/gtest.h>
#include <dmlc/filesystem.h>

#include <fstream>
#include <memory>
#include <vector>

#include "xgboost/data.h"
#include "../filesystem.h" // dmlc::TemporaryDirectory
#include "../helpers.h"
#include "xgboost/data.h"

namespace xgboost {
TEST(SparsePage, PushCSC) {
Expand Down
5 changes: 2 additions & 3 deletions tests/cpp/data/test_ellpack_page_raw_format.cu
Expand Up @@ -2,12 +2,11 @@
* Copyright 2021 XGBoost contributors
*/
#include <gtest/gtest.h>
#include <dmlc/filesystem.h>
#include <xgboost/data.h>

#include "../../../src/data/sparse_page_source.h"
#include "../../../src/data/ellpack_page.cuh"

#include "../../../src/data/sparse_page_source.h"
#include "../filesystem.h" // dmlc::TemporaryDirectory
#include "../helpers.h"

namespace xgboost {
Expand Down
4 changes: 2 additions & 2 deletions tests/cpp/data/test_file_iterator.cc
Expand Up @@ -2,13 +2,13 @@
* Copyright 2021 XGBoost contributors
*/
#include <gtest/gtest.h>
#include <dmlc/filesystem.h>

#include <memory>

#include "../../../src/data/adapter.h"
#include "../../../src/data/file_iterator.h"
#include "../../../src/data/proxy_dmatrix.h"
#include "../../../src/data/adapter.h"
#include "../filesystem.h" // dmlc::TemporaryDirectory
#include "../helpers.h"

namespace xgboost {
Expand Down
7 changes: 4 additions & 3 deletions tests/cpp/data/test_metainfo.cc
Expand Up @@ -2,12 +2,13 @@
#include "test_metainfo.h"

#include <dmlc/io.h>
#include <dmlc/filesystem.h>
#include <xgboost/data.h>
#include <string>

#include <memory>
#include "../../../src/common/version.h"
#include <string>

#include "../../../src/common/version.h"
#include "../filesystem.h" // dmlc::TemporaryDirectory
#include "../helpers.h"
#include "xgboost/base.h"

Expand Down
7 changes: 4 additions & 3 deletions tests/cpp/data/test_simple_dmatrix.cc
@@ -1,12 +1,13 @@
// Copyright by Contributors
#include <dmlc/filesystem.h>
#include <xgboost/data.h>

#include <array>
#include "xgboost/base.h"
#include "../../../src/data/simple_dmatrix.h"

#include "../../../src/data/adapter.h"
#include "../../../src/data/simple_dmatrix.h"
#include "../filesystem.h" // dmlc::TemporaryDirectory
#include "../helpers.h"
#include "xgboost/base.h"

using namespace xgboost; // NOLINT

Expand Down
1 change: 0 additions & 1 deletion tests/cpp/data/test_simple_dmatrix.cu
@@ -1,5 +1,4 @@
// Copyright by Contributors
#include <dmlc/filesystem.h>
#include <xgboost/data.h>
#include "../../../src/data/simple_dmatrix.h"

Expand Down
8 changes: 5 additions & 3 deletions tests/cpp/data/test_sparse_page_dmatrix.cc
@@ -1,14 +1,16 @@
// Copyright by Contributors
#include <dmlc/filesystem.h>
#include <gtest/gtest.h>
#include <xgboost/data.h>
#include <thread>

#include <future>
#include <thread>

#include "../../../src/common/io.h"
#include "../../../src/data/adapter.h"
#include "../../../src/data/file_iterator.h"
#include "../../../src/data/simple_dmatrix.h"
#include "../../../src/data/sparse_page_dmatrix.h"
#include "../../../src/data/file_iterator.h"
#include "../filesystem.h" // dmlc::TemporaryDirectory
#include "../helpers.h"

using namespace xgboost; // NOLINT
Expand Down
4 changes: 2 additions & 2 deletions tests/cpp/data/test_sparse_page_dmatrix.cu
@@ -1,10 +1,10 @@
// Copyright by Contributors

#include <dmlc/filesystem.h>
#include "../helpers.h"
#include "../../../src/common/compressed_iterator.h"
#include "../../../src/data/ellpack_page.cuh"
#include "../../../src/data/sparse_page_dmatrix.h"
#include "../filesystem.h" // dmlc::TemporaryDirectory
#include "../helpers.h"

namespace xgboost {

Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/data/test_sparse_page_raw_format.cc
Expand Up @@ -2,10 +2,10 @@
* Copyright 2021 XGBoost contributors
*/
#include <gtest/gtest.h>
#include <dmlc/filesystem.h>
#include <xgboost/data.h>

#include "../../../src/data/sparse_page_source.h"
#include "../filesystem.h" // dmlc::TemporaryDirectory
#include "../helpers.h"

namespace xgboost {
Expand Down
9 changes: 9 additions & 0 deletions tests/cpp/filesystem.h
@@ -0,0 +1,9 @@
/*!
* Copyright (c) 2022 by XGBoost Contributors
*/
#pragma once

#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif // WIN32_LEAN_AND_MEAN
#include "dmlc/filesystem.h"
2 changes: 1 addition & 1 deletion tests/cpp/gbm/test_gbtree.cc
@@ -1,13 +1,13 @@
/*!
* Copyright 2019-2022 XGBoost contributors
*/
#include <dmlc/filesystem.h>
#include <gtest/gtest.h>
#include <xgboost/generic_parameters.h>

#include "../../../src/data/adapter.h"
#include "../../../src/data/proxy_dmatrix.h"
#include "../../../src/gbm/gbtree.h"
#include "../filesystem.h" // dmlc::TemporaryDirectory
#include "../helpers.h"
#include "xgboost/base.h"
#include "xgboost/host_device_vector.h"
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/helpers.cc
Expand Up @@ -3,7 +3,6 @@
*/
#include "helpers.h"

#include <dmlc/filesystem.h>
#include <gtest/gtest.h>
#include <xgboost/gbm.h>
#include <xgboost/json.h>
Expand All @@ -21,6 +20,7 @@
#include "../../src/data/simple_dmatrix.h"
#include "../../src/data/sparse_page_dmatrix.h"
#include "../../src/gbm/gbtree_model.h"
#include "filesystem.h" // dmlc::TemporaryDirectory
#include "xgboost/c_api.h"
#include "xgboost/predictor.h"

Expand Down
23 changes: 11 additions & 12 deletions tests/cpp/helpers.h
Expand Up @@ -4,25 +4,24 @@
#ifndef XGBOOST_TESTS_CPP_HELPERS_H_
#define XGBOOST_TESTS_CPP_HELPERS_H_

#include <iostream>
#include <fstream>
#include <cstdio>
#include <string>
#include <memory>
#include <vector>
#include <gtest/gtest.h>
#include <sys/stat.h>
#include <sys/types.h>

#include <gtest/gtest.h>

#include <dmlc/filesystem.h>
#include <xgboost/base.h>
#include <xgboost/json.h>
#include <xgboost/generic_parameters.h>
#include <xgboost/json.h>

#include <cstdio>
#include <fstream>
#include <iostream>
#include <memory>
#include <string>
#include <vector>

#include "../../src/common/common.h"
#include "../../src/gbm/gbtree_model.h"
#include "../../src/data/array_interface.h"
#include "../../src/gbm/gbtree_model.h"
#include "filesystem.h" // dmlc::TemporaryDirectory

#if defined(__CUDACC__)
#define DeclareUnifiedTest(name) GPU ## name
Expand Down
6 changes: 3 additions & 3 deletions tests/cpp/plugin/test_predictor_oneapi.cc
@@ -1,14 +1,14 @@
/*!
* Copyright 2017-2020 XGBoost contributors
*/
#include <dmlc/filesystem.h>
#include <gtest/gtest.h>
#include <xgboost/predictor.h>

#include "../../../src/data/adapter.h"
#include "../../../src/gbm/gbtree_model.h"
#include "../filesystem.h" // dmlc::TemporaryDirectory
#include "../helpers.h"
#include "../predictor/test_predictor.h"
#include "../../../src/gbm/gbtree_model.h"
#include "../../../src/data/adapter.h"

namespace xgboost {
TEST(Plugin, OneAPIPredictorBasic) {
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/predictor/test_cpu_predictor.cc
@@ -1,14 +1,14 @@
/*!
* Copyright 2017-2022 XGBoost contributors
*/
#include <dmlc/filesystem.h>
#include <gtest/gtest.h>
#include <xgboost/predictor.h>

#include "../../../src/data/adapter.h"
#include "../../../src/data/proxy_dmatrix.h"
#include "../../../src/gbm/gbtree.h"
#include "../../../src/gbm/gbtree_model.h"
#include "../filesystem.h" // dmlc::TemporaryDirectory
#include "../helpers.h"
#include "test_predictor.h"

Expand Down
1 change: 0 additions & 1 deletion tests/cpp/predictor/test_gpu_predictor.cu
@@ -1,7 +1,6 @@
/*!
* Copyright 2017-2020 XGBoost contributors
*/
#include <dmlc/filesystem.h>
#include <gtest/gtest.h>
#include <xgboost/c_api.h>
#include <xgboost/learner.h>
Expand Down

0 comments on commit bbad2dd

Please sign in to comment.