-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove the main function inside the test file #1003
Conversation
@@ -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) | |||
|
There was a problem hiding this comment.
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 的时候报错。
There was a problem hiding this comment.
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()
There was a problem hiding this comment.
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都必须加这个?
There was a problem hiding this comment.
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
估计就有错了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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等目录里提取出来,也要找地方放。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
* add faq * add faq Co-authored-by: chenxiaozeng <[email protected]>
Fix #975
Fix #1031
Most of the rest of the tests require
initPython
to work. Others require weird initialization.