Skip to content

Commit

Permalink
Remove runtime test discovery, other fixes (flashlight#329)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: flashlight#329

`gtest_discover_tests` actually invokes the test binaries to find tests, but it sometimes fails to find things as it should along `LD_LIBRARY_PATH`s, and is quite flakey. ~~Switch to `gtest_add_tests`, which does almost the same thing but statically. We shouldn't be using test fixtures or parameterizations [yet] that are so complicated that the result is any different from discovery.~~

Also having problems making this work — I'm going to make things stable then work on adding this back later.

Also fix some straggler issues that weirdly were never changedin D25409790 (flashlight@15d4ba0).

Reviewed By: tlikhomanenko

Differential Revision: D25507227

fbshipit-source-id: 9eb4c64092cf1084a766ce0947942f0d3c6ee32a
  • Loading branch information
jacobkahn authored and facebook-github-bot committed Dec 11, 2020
1 parent 68ea6fb commit e2a4905
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
16 changes: 9 additions & 7 deletions cmake/TestUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ if (NOT GTEST_FOUND)
endif()
else()
message(STATUS "gtest found: (include: ${GTEST_INCLUDE_DIRS}, lib: ${GTEST_BOTH_LIBRARIES}")
# Try again with a config to make sure there isn't some broken module in the way
find_package(GTest CONFIG 1.10.0)
if (TARGET GTest::GTest)
# We found the differently-named CMake targets from FindGTest
if (NOT TARGET GTest::Main)
Expand Down Expand Up @@ -61,9 +59,13 @@ function(build_test)
PUBLIC
${build_test_PREPROC}
)
if (build_test_NO_DISCOVERY)
add_test(${target} ${target})
else()
gtest_discover_tests(${target})
endif()
# TODO(jacobkahn): investigate and bring back either gtest_discover_tests
# or gtest_add_tests once I can figure out what's wrong with the invocation
# failing to find dynamically-linked or runtime deps
# if (build_test_NO_DISCOVERY)
# add_test(${target} ${target})
# else()
# gtest_add_tests(${target})
# endif()
add_test(${target} ${target})
endfunction(build_test)
2 changes: 1 addition & 1 deletion flashlight/app/lm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ target_include_directories(
flashlight-app-lm
PUBLIC
${GLOG_INCLUDE_DIRS}
${gflags_LIBRARIES}
${gflags_INCLUDE_DIRS}
)
# ------------------------ Components ------------------------

Expand Down
10 changes: 2 additions & 8 deletions flashlight/fl/autograd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,8 @@ if (FL_USE_CPU)

target_link_libraries(
flashlight
PUBLIC
${DNNL_LIBRARIES} # also contains MKL or mklml libraries
)

target_include_directories(
flashlight
PUBLIC
${DNNL_INCLUDE_DIR} # includes MKL headers if found
PRIVATE
DNNL::dnnl
)
endif ()

Expand Down

0 comments on commit e2a4905

Please sign in to comment.