Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions paddle/function/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ endif()

add_library(paddle_function STATIC ${cpp_files} ${cu_objs})

add_library(paddle_test_main STATIC TestMain.cpp)

if(WITH_GPU)
# TODO:
# file(GLOB test_files . *_op_test.cpp)
Expand Down
6 changes: 0 additions & 6 deletions paddle/gserver/tests/test_LinearChainCRF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,3 @@ TEST(LinearChainCRF, decoding) {
}
}
}

int main(int argc, char** argv) {
initMain(argc, argv);
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
6 changes: 0 additions & 6 deletions paddle/gserver/tests/test_ProtoDataProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -730,9 +730,3 @@ TEST(ProtoSequenceDataProvider, test) {
} // end for (int numIdSlots : numSlotsArray)
} // end for (int numSparseNonValueVecSlots : numSlotsArray)
}

int main(int argc, char** argv) {
initMain(argc, argv);
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
6 changes: 0 additions & 6 deletions paddle/gserver/tests/test_WarpCTCLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,3 @@ TEST(Layer, WarpCTCLayer) {
}
}
}

int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
initMain(argc, argv);
return RUN_ALL_TESTS();
}
6 changes: 0 additions & 6 deletions paddle/math/tests/test_Allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,3 @@ TEST(MemoryHandle, Gpu) {
}
}
#endif

int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
initMain(argc, argv);
return RUN_ALL_TESTS();
}
6 changes: 0 additions & 6 deletions paddle/math/tests/test_BaseMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,4 @@ TEST(BaseMatrix, Other) {
}
}

int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
paddle::initMain(argc, argv);
return RUN_ALL_TESTS();
}

#endif
7 changes: 0 additions & 7 deletions paddle/math/tests/test_CpuGpuVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,4 @@ TEST(CpuGpuVector, subCreate) {
checkDataEqual(v1Check->getData() + offset, v2Check->getData(), size2);
}

int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
initMain(argc, argv);
int ret = RUN_ALL_TESTS();
return ret;
}

#endif
6 changes: 0 additions & 6 deletions paddle/math/tests/test_ExecViaCpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,3 @@ TEST(ExecViaCpu, test1) {
testWrapper(functor);
}
#endif

int main(int argc, char** argv) {
paddle::initMain(argc, argv);
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
6 changes: 0 additions & 6 deletions paddle/math/tests/test_Matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,4 @@ TEST(Matrix, multiBinaryCrossEntropy) {
}
}

int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
paddle::initMain(argc, argv);
return RUN_ALL_TESTS();
}

#endif
6 changes: 0 additions & 6 deletions paddle/math/tests/test_SIMDFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,3 @@ TEST(SIMDFunction, decayL1_WithoutLR) {
ASSERT_NEAR(dest[i], simd_dest[i], EPSILON);
}
}

int main(int argc, char** argv) {
paddle::initMain(argc, argv);
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
6 changes: 0 additions & 6 deletions paddle/math/tests/test_SparseMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,3 @@ TEST(Matrix, SparseMatrixCSCFormatTrimFrom) {
checkSMatrixEqual2(matA, matD);
#endif
}

int main(int argc, char** argv) {
paddle::initMain(argc, argv);
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
8 changes: 0 additions & 8 deletions paddle/math/tests/test_Tensor.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1163,11 +1163,3 @@ TEST(Quaternary, CompareOp) {
TestQuaternaryMatrix<GpuMatrix> testGpu(testQuaternaryCompareOp<GpuMatrix>);
#endif
}

int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
hl_start();
hl_init(0);
return RUN_ALL_TESTS();
}

8 changes: 0 additions & 8 deletions paddle/math/tests/test_TrainingAlgorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,11 +459,3 @@ void testSparseMomentum(size_t size, bool useGpu) {
}

TEST(Training, SparseMomentum) { testCase(testSparseMomentum); }

int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
initMain(argc, argv);
hl_start();
hl_init(FLAGS_gpu_id);
return RUN_ALL_TESTS();
}
6 changes: 0 additions & 6 deletions paddle/math/tests/test_batchTranspose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,3 @@ TEST(MatrixBatchTransTest, test_batch_matrix_transpose) {
checkMatrixEqual(cBatchTransMat, cMat_d2h);
}
#endif

int main(int argc, char** argv) {
paddle::initMain(argc, argv);
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
8 changes: 0 additions & 8 deletions paddle/math/tests/test_lazyAssign.cu
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,3 @@ TEST(sgdUpdate, GPU) {
testMatrixCase(testSgdUpdate<GpuMatrix>);
}
#endif

int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
hl_start();
hl_init(0);
return RUN_ALL_TESTS();
}

6 changes: 0 additions & 6 deletions paddle/math/tests/test_matrixCompare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1262,10 +1262,4 @@ TEST(Matrix, MaxOutFwdBwd) {
}
}

int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
initMain(argc, argv);
return RUN_ALL_TESTS();
}

#endif
7 changes: 0 additions & 7 deletions paddle/math/tests/test_sparseMatrixCompare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,4 @@ TEST(SMatrix, sMatrixCollectBias) {
}
}

int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
initMain(argc, argv);
int ret = RUN_ALL_TESTS();
return ret;
}

#endif
9 changes: 0 additions & 9 deletions paddle/parameter/tests/test_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@ limitations under the License. */

using namespace paddle; // NOLINT

int main(int argc, char** argv) {
paddle::initMain(argc, argv);
testing::InitGoogleTest(&argc, argv);

int ret = RUN_ALL_TESTS();

return ret;
}

class CommonTest : public ::testing::Test {
protected:
CommonTest() : testStat_("test") {}
Expand Down
2 changes: 2 additions & 0 deletions paddle/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ file(GLOB UTIL_SOURCES . *.cpp)
create_resources(enable_virtualenv.py enable_virtualenv.c)
set(UTIL_RES enable_virtualenv.c)

add_library(paddle_test_main STATIC TestMain.cpp)
Copy link
Copy Markdown
Collaborator

@wangkuiyi wangkuiyi Dec 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

之前和 @reyoung @gangliao 讨论的时候,只出过我们有“没仔细起名的就叫util”和“什么东西都往util目录里放”的问题。

TestMain.cpp 是不是应该放在 /testing 子目录里?

我建议在根目录下开一个新的子目录,是因为看到貌似确实有些东西应该放进去,包括 #1017 (review) 这里提到的 third_party_dependencies_test.cc

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

增加一个testing目录吗,好的。后续还有一个TestUtils的要从math/test和gserver/test等目录里提取出来,也要找地方放。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add_dependencies(paddle_test_main gen_proto_cpp)

加上这个dependency,gen_proto_cpp是生成protobuf的.h和.cc。否则会在make -j 的时候报错。

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

另外这个library,应该被if来包装一下。 https://github.com/PaddlePaddle/Paddle/blob/develop/CMakeLists.txt#L144 主要是如果不开启TESTING模式的话,GTEST的header很可能没有。

if(WITH_TESTING)
    add_library(paddle_test_main STATIC TestMain.cpp)
    add_dependencies(paddle_test_main gen_proto_cpp)
endif()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

上面dependency那个,我现在都是make -j 方式,并没有报错啊。每个add_library都必须加这个?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

上面dependency那个,我现在都是make -j 方式,并没有报错啊。每个add_library都必须加这个?

make clean之后直接调用 make paddle_test_main 就出错了。

make -j不出错是因为Parallel的粒度不够,make -j 100000估计就有错了。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

if(APPLE)
file(GLOB UTIL_ARCH_SOURCES . arch/osx/*.cpp)
else()
Expand Down
File renamed without changes.
6 changes: 0 additions & 6 deletions paddle/utils/tests/test_CustomStackTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,3 @@ TEST(CustomStackTrace, normalTest) {
}
});
}

int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
paddle::initMain(argc, argv);
return RUN_ALL_TESTS();
}
5 changes: 0 additions & 5 deletions paddle/utils/tests/test_SIMDFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,3 @@ TEST(SIMDFlags, normalPrint) {
LOG(INFO) << "Has AVX2: " << std::boolalpha << HAS_AVX2;
LOG(INFO) << "Has AVX512: " << std::boolalpha << HAS_AVX512;
}

int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
6 changes: 0 additions & 6 deletions paddle/utils/tests/test_SpinLock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,3 @@ TEST(ThreadSpinLock, normalTest) {
});
}
}

int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
paddle::initMain(argc, argv);
return RUN_ALL_TESTS();
}
5 changes: 0 additions & 5 deletions paddle/utils/tests/test_Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,3 @@ TEST(AsyncThreadPool, addBatchJobWithResults) {
ASSERT_EQ(res[i], i);
}
}

int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
6 changes: 0 additions & 6 deletions paddle/utils/tests/test_ThreadBarrier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,3 @@ TEST(ThreadBarrier, normalTest) {
});
}
}

int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
paddle::initMain(argc, argv);
return RUN_ALL_TESTS();
}