Skip to content
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

Merged
merged 6 commits into from
Dec 29, 2016

Conversation

hedaoyuan
Copy link
Contributor

@hedaoyuan hedaoyuan commented Dec 23, 2016

Fix #975
Fix #1031
Most of the rest of the tests require initPython to work. Others require weird initialization.

@hedaoyuan hedaoyuan changed the title move TestMain.cpp into utils and fix some tests for check Remove the main function inside the test file Dec 23, 2016
@@ -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
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
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
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
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
Contributor Author

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)
Copy link
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
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
Contributor Author

Choose a reason for hiding this comment

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

Done.

@hedaoyuan
Copy link
Contributor Author

hedaoyuan commented Dec 28, 2016

Follow comments and fix issue #1031 @backyes

@hedaoyuan hedaoyuan merged commit 54a2b1f into PaddlePaddle:develop Dec 29, 2016
wangxicoding pushed a commit to wangxicoding/Paddle that referenced this pull request Dec 9, 2021
* add faq

* add faq

Co-authored-by: chenxiaozeng <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants