-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[onnx] Support test build and rename features (#207)
* [onnx] change feature names * fix mistype, use INVERTED_FEATURES * [onnx] create patch for test build * [onnx] update baseline * ci: test onnx with its features
- Loading branch information
Showing
8 changed files
with
118 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index dd9fba2..651cb4e 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -125,8 +125,7 @@ if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE) | ||
endif() | ||
|
||
if(ONNX_BUILD_TESTS) | ||
- list(APPEND CMAKE_MODULE_PATH ${ONNX_ROOT}/cmake/external) | ||
- include(googletest) | ||
+ find_package(GTest CONFIG REQUIRED) | ||
endif() | ||
|
||
if((ONNX_USE_LITE_PROTO AND TARGET protobuf::libprotobuf-lite) OR ((NOT ONNX_USE_LITE_PROTO) AND TARGET protobuf::libprotobuf)) | ||
diff --git a/cmake/unittest.cmake b/cmake/unittest.cmake | ||
index e71b92a..afccacf 100644 | ||
--- a/cmake/unittest.cmake | ||
+++ b/cmake/unittest.cmake | ||
@@ -22,7 +22,7 @@ function(AddTest) | ||
list(REMOVE_DUPLICATES _UT_SOURCES) | ||
|
||
add_executable(${_UT_TARGET} ${_UT_SOURCES}) | ||
- add_dependencies(${_UT_TARGET} onnx onnx_proto googletest) | ||
+ add_dependencies(${_UT_TARGET} onnx onnx_proto) | ||
|
||
target_include_directories(${_UT_TARGET} | ||
PUBLIC ${googletest_INCLUDE_DIRS} | ||
@@ -30,7 +30,7 @@ function(AddTest) | ||
${PROTOBUF_INCLUDE_DIRS} | ||
${ONNX_ROOT} | ||
${CMAKE_CURRENT_BINARY_DIR}) | ||
- target_link_libraries(${_UT_TARGET} ${_UT_LIBS} ${CMAKE_THREAD_LIBS_INIT}) | ||
+ target_link_libraries(${_UT_TARGET} ${_UT_LIBS} ${CMAKE_THREAD_LIBS_INIT} GTest::gtest) | ||
if(TARGET protobuf::libprotobuf) | ||
target_link_libraries(${_UT_TARGET} protobuf::libprotobuf) | ||
else() | ||
@@ -84,3 +84,4 @@ function(AddTest) | ||
endfunction(AddTest) | ||
|
||
addtest(TARGET ${UT_NAME} SOURCES ${${UT_NAME}_src} LIBS ${${UT_NAME}_libs}) | ||
+install(TARGETS ${UT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
diff --git a/onnx/test/cpp/test_main.cc b/onnx/test/cpp/test_main.cc | ||
index cee5e79..d77d2f2 100644 | ||
--- a/onnx/test/cpp/test_main.cc | ||
+++ b/onnx/test/cpp/test_main.cc | ||
@@ -8,7 +8,7 @@ | ||
|
||
#include "gtest/gtest.h" | ||
|
||
-GTEST_API_ int main(int argc, char** argv) { | ||
+int main(int argc, char** argv) { | ||
std::cout << "Running main() from test_main.cc" << std::endl; | ||
::testing::InitGoogleTest(&argc, argv); | ||
return RUN_ALL_TESTS(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters