Skip to content

Commit 944db4f

Browse files
zrpherculehouseroad
authored andcommitted
cmake (#1401)
1 parent 8ccc8dd commit 944db4f

6 files changed

Lines changed: 16 additions & 5 deletions

File tree

.travis/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export CMAKE_ARGS="-DONNX_WERROR=ON"
1010
if [[ -n "USE_LITE_PROTO" ]]; then
1111
export CMAKE_ARGS="${CMAKE_ARGS} -DONNX_USE_LITE_PROTO=ON"
1212
fi
13-
13+
export CMAKE_ARGS="${CMAKE_ARGS} -DONNXIFI_DUMMY_BACKEND=ON"
1414
export ONNX_NAMESPACE=ONNX_NAMESPACE_FOO_BAR_FOR_CI
1515

1616
time python setup.py bdist_wheel --universal --dist-dir .

.travis/script.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ source "${script_path%/*}/setup.sh"
55

66
# onnx c++ API tests
77
export LD_LIBRARY_PATH="${top_dir}/.setuptools-cmake-build/:$LD_LIBRARY_PATH"
8-
find .setuptools-cmake-build/ -name "onnx_gtests" -ls -exec {} \;
8+
# do not use find -exec here, it would ignore the segement fault of gtest.
9+
./.setuptools-cmake-build/onnx_gtests
10+
./.setuptools-cmake-build/onnxifi_test_driver_gtests onnx/backend/test/data/node
911

1012
# onnx python API tests
1113
pip install pytest-cov nbval

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ option(ONNX_WERROR "Build with Werror" OFF)
2323
option(ONNX_COVERAGE "Build with coverage instrumentation" OFF)
2424
option(ONNX_BUILD_TESTS "Build ONNX C++ APIs Tests" OFF)
2525
option(ONNX_USE_LITE_PROTO "Use lite protobuf instead of full." OFF)
26+
option(ONNXIFI_DUMMY_BACKEND "Use dummy backend in onnxifi test driver." OFF)
2627

2728
set(ONNX_NAMESPACE "onnx" CACHE STRING "onnx namespace")
2829

@@ -560,7 +561,9 @@ if(NOT ANDROID AND NOT IOS)
560561
install(TARGETS onnxifi_wrapper
561562
EXPORT ONNXTargets DESTINATION lib)
562563
endif()
563-
564+
if(ONNXIFI_DUMMY_BACKEND)
565+
add_definitions(-DONNXIFI_DUMMY_BACKEND=1)
566+
endif()
564567
if(ONNX_BUILD_TESTS)
565568
include(${ONNX_ROOT}/cmake/unittest.cmake)
566569
endif()

cmake/summary.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ function (onnx_print_configuration_summary)
2020
message(STATUS " ONNX_BUILD_TESTS : ${ONNX_BUILD_TESTS}")
2121
message(STATUS " ONNX_BUILD_BENCHMARKS : ${ONNX_BUILD_BENCHMARKS}")
2222
message(STATUS " ONNX_USE_LITE_PROTO : ${ONNX_USE_LITE_PROTO}")
23+
message(STATUS " ONNXIFI_DUMMY_BACKEND : ${ONNXIFI_DUMMY_BACKEND}")
2324
message(STATUS "")
2425
message(STATUS " Protobuf compiler : ${PROTOBUF_PROTOC_EXECUTABLE}")
2526
message(STATUS " Protobuf includes : ${PROTOBUF_INCLUDE_DIRS}")

cmake/unittest.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ function(AddTest)
7777
# unsigned from include\google\protob
7878
# uf\wire_format_lite.h
7979
)
80+
8081
endif()
8182

8283
set(TEST_ARGS)

onnx/backend/test/cpp/driver/test_driver.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ namespace testing {
1414
* includng input and output.
1515
* No real data was loaded in this type of class,
1616
* but only data location.
17+
* Data loading is unsolved, this class CANNOT be treated as real data.
1718
*/
1819
struct UnsolvedTestData {
1920
std::vector<std::string> input_filenames_;
@@ -31,6 +32,7 @@ struct UnsolvedTestData {
3132
* including one model file and several chunks of test data
3233
* No real data was loaded in this type of class,
3334
* but only data location.
35+
* Data loading is unsolved, this class CANNOT be treated as real data.
3436
*/
3537
struct UnsolvedTestCase {
3638
UnsolvedTestCase(
@@ -50,8 +52,9 @@ struct UnsolvedTestCase {
5052

5153
/**
5254
* Store one chunk of test data,
53-
* including raw input/output and protos
54-
* Real data was loaded in this type of class..
55+
* including raw input/output and protos.
56+
* Real data was loaded in this type of class.
57+
* Data loading is resolved, this class may contains large chunk of data.
5558
*/
5659
struct ResolvedTestData {
5760
std::vector<ONNX_NAMESPACE::TensorProto> inputs_;
@@ -62,6 +65,7 @@ struct ResolvedTestData {
6265
* Store one test model,
6366
* including raw model, model proto and several chunks of test data.
6467
* Real data was loaded in this type of class.
68+
* Data loading is resolved, this class may contains large chunk of data.
6569
*/
6670
struct ResolvedTestCase {
6771
ONNX_NAMESPACE::ModelProto model_;

0 commit comments

Comments
 (0)