Skip to content

Commit

Permalink
link cpp test to libpaddle.so/dll
Browse files Browse the repository at this point in the history
  • Loading branch information
risemeup1 committed Sep 27, 2023
1 parent 34210af commit 1a59e26
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 19 deletions.
4 changes: 3 additions & 1 deletion paddle/fluid/imperative/var_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <vector>

#include "paddle/fluid/framework/variable.h"
#include "paddle/utils/test_macros.h"

namespace egr {
class EagerVariable;
Expand Down Expand Up @@ -66,7 +67,8 @@ template <typename VarType>
phi::DataLayout GetDataLayout(std::shared_ptr<VarType> var);

template <typename VarType>
void SetDataLayout(std::shared_ptr<VarType> var, const phi::DataLayout layout);
void TEST_API SetDataLayout(std::shared_ptr<VarType> var,
const phi::DataLayout layout);

template <typename VarType>
const std::shared_ptr<VariableWrapper>& GetVariableWrapper(
Expand Down
3 changes: 2 additions & 1 deletion paddle/phi/core/allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ limitations under the License. */
#include <memory>

#include "paddle/phi/common/place.h"
#include "paddle/utils/test_macros.h"

namespace phi {

/// \brief Fancy pointer with deleter. The use of this data type
/// is to be compatible with allocators from different frameworks
/// without significant performance loss. This class does not
/// support being inherited.
class Allocation {
class TEST_API Allocation {
public:
using Place = phi::Place;
using DeleterFnPtr = void (*)(Allocation*);
Expand Down
3 changes: 2 additions & 1 deletion paddle/phi/core/extended_tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ limitations under the License. */
#include "paddle/phi/core/allocator.h"
#include "paddle/phi/core/tensor_base.h"
#include "paddle/phi/core/tensor_meta.h"
#include "paddle/utils/test_macros.h"
namespace phi {

/// \brief The ExtendedTensor is a interface for custom designed class.
/// If you want to pass some self-designed data as input/output to kernels,
/// you can inherit from this class to store your self-designed data.
class ExtendedTensor : public TensorBase {
class TEST_API ExtendedTensor : public TensorBase {
public:
ExtendedTensor() = default;
virtual ~ExtendedTensor() = default;
Expand Down
5 changes: 3 additions & 2 deletions paddle/phi/core/selected_rows.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ limitations under the License. */
#include <vector>

#include "paddle/phi/core/selected_rows_impl.h"
#include "paddle/utils/test_macros.h"

namespace phi {
class SelectedRows : public TensorBase,
public TypeInfoTraits<TensorBase, SelectedRows> {
class TEST_API SelectedRows : public TensorBase,
public TypeInfoTraits<TensorBase, SelectedRows> {
/*
* @brief We can use the SelectedRows structure to reproduce a sparse table.
* A sparse table is a key-value structure that the key is an `int64_t`,
Expand Down
4 changes: 2 additions & 2 deletions paddle/phi/core/selected_rows_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ limitations under the License. */
#include "paddle/phi/core/dense_tensor.h"
#include "paddle/phi/core/enforce.h"
#include "paddle/phi/core/utils/rw_lock.h"

#include "paddle/utils/test_macros.h"
namespace phi {
class SelectedRowsImpl {
class TEST_API SelectedRowsImpl {
/*
* @brief We can use the SelectedRowsImpl structure to reproduce a sparse
* table.
Expand Down
4 changes: 2 additions & 2 deletions paddle/phi/core/utils/type_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License. */
#pragma once

#include <string>

#include "paddle/utils/test_macros.h"
namespace phi {

template <typename BaseT>
Expand All @@ -40,7 +40,7 @@ class TypeInfo {
};

template <typename BaseT, typename DerivedT>
class TypeInfoTraits {
class TEST_API TypeInfoTraits {
public:
static const TypeInfo<BaseT> kType;
TypeInfoTraits();
Expand Down
4 changes: 2 additions & 2 deletions paddle/testing/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# for paddle test case

if(WITH_TESTING)
get_property(paddle_lib GLOBAL PROPERTY PADDLE_LIB_NAME)
set(paddle_gtest_main_deps
device_context
gtest
Expand All @@ -22,7 +22,7 @@ if(WITH_TESTING)
cc_library(
paddle_gtest_main_new
SRCS paddle_gtest_main.cc
DEPS gtest xxhash framework_proto eigen3 dlpack)
DEPS ${paddle_lib})
if(WITH_MKLDNN)
add_dependencies(paddle_gtest_main_new mkldnn)
endif()
Expand Down
9 changes: 1 addition & 8 deletions test/cpp/eager/data_structure_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
if(WITH_CINN)
set(eager_deps ${eager_deps} cinn_compiler python)
endif()
cc_test_old(
test_egr_ds_eager_tensor
SRCS
eager_tensor_test.cc
DEPS
fleet_executor
final_dygraph_function
${eager_deps})
paddle_test(test_egr_ds_eager_tensor SRCS eager_tensor_test.cc)
cc_test_old(
test_egr_ds_auotgrad_meta
SRCS
Expand Down

0 comments on commit 1a59e26

Please sign in to comment.