-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Migrate test in cpp/api/ to use gtest #11556
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
Conversation
For ease of reviewing, can we avoid moving the location of these files? It thwarts diff. |
Oh sure, I thought it is better to have a seperate repo for gtest at beginning, but actually it doesnt matter |
test/cpp/api/static.cpp
Outdated
for (size_t i = 0; i < v.size(); ++i) { | ||
REQUIRE(v.at(i) == 1 + i); | ||
} | ||
// TEST_CASE("static") { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
test/cpp/api/static.cpp
Outdated
REQUIRE(v.at(i) == 1 + i); | ||
} | ||
// TEST_CASE("static") { | ||
TEST(static, static){ |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -471,19 +472,36 @@ if (BUILD_TEST AND NOT NO_API AND NOT USE_ROCM) | |||
|
|||
target_link_libraries(test_api torch ${TORCH_CUDA_LIBRARIES} ${CUDA_NVRTC_LIB} ${CUDA_CUDA_LIB}) | |||
|
|||
#Google test of api. | |||
set(TORCH_API_GTEST_DIR "${TORCH_ROOT}/test/cpp/api/") |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/CMakeLists.txt
Outdated
add_executable(gtest_api | ||
${TORCH_API_GTEST_DIR}/static.cpp | ||
) | ||
target_include_directories(gtest_api PUBLIC ${ATen_CPU_INCLUDE}) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/CMakeLists.txt
Outdated
if (NOT MSVC) | ||
if (APPLE) | ||
target_compile_options(test_api PRIVATE | ||
# Clang has an unfixed bug leading to spurious missing braces | ||
# warnings, see https://bugs.llvm.org/show_bug.cgi?id=21629 | ||
-Wno-missing-braces) | ||
else() | ||
target_compile_options(gtest_api PRIVATE |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Thanks for working on this! It's a good start. A couple things need to be improved. |
@goldsborough Any more comments? =) |
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.
Cool, let's merge this asap
test/cpp/api/static.cpp
Outdated
REQUIRE(v.at(i) == 1 + i); | ||
} | ||
TEST(TestStatic, All_Of){ | ||
EXPECT_EQ(torch::all_of<>::value, true); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
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.
zrphercule is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
The second part of T32009899