Remove the main function inside the test file#1003
Remove the main function inside the test file#1003hedaoyuan merged 6 commits intoPaddlePaddle:developfrom
Conversation
paddle/utils/CMakeLists.txt
Outdated
| set(UTIL_RES enable_virtualenv.c) | ||
|
|
||
| add_library(paddle_test_main STATIC TestMain.cpp) | ||
|
|
There was a problem hiding this comment.
add_dependencies(paddle_test_main gen_proto_cpp)
加上这个dependency,gen_proto_cpp是生成protobuf的.h和.cc。否则会在make -j 的时候报错。
There was a problem hiding this comment.
另外这个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()There was a problem hiding this comment.
上面dependency那个,我现在都是make -j 方式,并没有报错啊。每个add_library都必须加这个?
There was a problem hiding this comment.
上面dependency那个,我现在都是make -j 方式,并没有报错啊。每个add_library都必须加这个?
make clean之后直接调用 make paddle_test_main 就出错了。
make -j不出错是因为Parallel的粒度不够,make -j 100000估计就有错了。
paddle/utils/CMakeLists.txt
Outdated
| create_resources(enable_virtualenv.py enable_virtualenv.c) | ||
| set(UTIL_RES enable_virtualenv.c) | ||
|
|
||
| add_library(paddle_test_main STATIC TestMain.cpp) |
There was a problem hiding this comment.
之前和 @reyoung @gangliao 讨论的时候,只出过我们有“没仔细起名的就叫util”和“什么东西都往util目录里放”的问题。
TestMain.cpp 是不是应该放在 /testing 子目录里?
我建议在根目录下开一个新的子目录,是因为看到貌似确实有些东西应该放进去,包括 #1017 (review) 这里提到的 third_party_dependencies_test.cc
There was a problem hiding this comment.
增加一个testing目录吗,好的。后续还有一个TestUtils的要从math/test和gserver/test等目录里提取出来,也要找地方放。
* add faq * add faq Co-authored-by: chenxiaozeng <[email protected]>
Fix #975
Fix #1031
Most of the rest of the tests require
initPythonto work. Others require weird initialization.