代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/iSulad 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From db952e8122e584dbb24d28d36abc2ac1b8ad0c77 Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Mon, 29 Nov 2021 16:07:39 +0800
Subject: [PATCH 11/14] add fuzz build in CI
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---
CI/make-and-install.sh | 9 +++++++++
CMakeLists.txt | 4 ++--
test/fuzz/CMakeLists.txt | 25 +++++++++++++++++++------
3 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/CI/make-and-install.sh b/CI/make-and-install.sh
index 602878bf..3fd88b84 100755
--- a/CI/make-and-install.sh
+++ b/CI/make-and-install.sh
@@ -74,12 +74,21 @@ rm -rf build
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_UT=ON -DENABLE_SHIM_V2=ON ..
make -j $(nproc)
+make install
ctest -T memcheck --output-on-failure
if [[ $? -ne 0 ]]; then
exit 1
fi
echo_success "===================RUN DT-LLT TESTCASES END========================="
+# build fuzz
+cd $ISULAD_COPY_PATH
+rm -rf build
+mkdir build
+cd build
+cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_FUZZ=ON ..
+make -j $(nproc)
+
# build rest version
cd $ISULAD_COPY_PATH
rm -rf build
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0f7d6b9c..8fc03f2d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -86,9 +86,9 @@ IF(ENABLE_UT)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test)
ENDIF(ENABLE_UT)
-IF(ENABLE_FUZZ)
+IF(ENABLE_FUZZ AND (NOT ENABLE_UT))
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test)
-ENDIF(ENABLE_FUZZ)
+ENDIF(ENABLE_FUZZ AND (NOT ENABLE_UT))
# install all files
install(FILES ${CMAKE_BINARY_DIR}/conf/isulad.pc
diff --git a/test/fuzz/CMakeLists.txt b/test/fuzz/CMakeLists.txt
index 816dd3cf..61ab47d7 100644
--- a/test/fuzz/CMakeLists.txt
+++ b/test/fuzz/CMakeLists.txt
@@ -20,9 +20,18 @@ SET(EXE1 im_config_image_exist_fuzz)
SET(EXE2 im_get_image_count_fuzz)
SET(EXE3 test_volume_mount_spec_fuzz)
SET(EXE4 test_volume_parse_volume_fuzz)
-add_executable(${EXE0} im_oci_image_exist_fuzz.cc)
-add_executable(${EXE1} im_config_image_exist_fuzz.cc)
-add_executable(${EXE2} im_get_image_count_fuzz.cc)
+add_executable(${EXE0}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/isulad_config.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/daemon_arguments.c
+ im_oci_image_exist_fuzz.cc)
+add_executable(${EXE1}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/isulad_config.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/daemon_arguments.c
+ im_config_image_exist_fuzz.cc)
+add_executable(${EXE2}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/isulad_config.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/daemon_arguments.c
+ im_get_image_count_fuzz.cc)
add_executable(${EXE3}
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/cutils/utils.c
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/cutils/path.c
@@ -36,6 +45,8 @@ add_executable(${EXE3}
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/cutils/utils_verify.c
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/sha256/sha256.c
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/cutils/utils_mount_spec.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/isulad_config.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/daemon_arguments.c
test_volume_mount_spec_fuzz.cc
)
add_executable(${EXE4}
@@ -51,6 +62,8 @@ add_executable(${EXE4}
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/cutils/utils_verify.c
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/sha256/sha256.c
${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/modules/spec/parse_volume.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/isulad_config.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/daemon_arguments.c
test_volume_parse_volume_fuzz.cc
)
@@ -96,15 +109,15 @@ target_include_directories(${EXE4} PUBLIC
set_target_properties(${EXE0} PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties(${EXE0} PROPERTIES LINK_FLAGS "-fsanitize=address -fsanitize-coverage=trace-pc")
-target_link_libraries(${EXE0} ${CMAKE_THREAD_LIBS_INIT} ${ISULA_LIBUTILS_LIBRARY} ${LIB_FUZZING_ENGINE} pthread rt -lisulad_img)
+target_link_libraries(${EXE0} ${CMAKE_THREAD_LIBS_INIT} ${ISULA_LIBUTILS_LIBRARY} ${LIB_FUZZING_ENGINE} pthread rt -lisulad_img -lgcov)
set_target_properties(${EXE1} PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties(${EXE1} PROPERTIES LINK_FLAGS "-fsanitize=address -fsanitize-coverage=trace-pc")
-target_link_libraries(${EXE1} ${CMAKE_THREAD_LIBS_INIT} ${ISULA_LIBUTILS_LIBRARY} ${LIB_FUZZING_ENGINE} pthread rt -lisulad_img)
+target_link_libraries(${EXE1} ${CMAKE_THREAD_LIBS_INIT} ${ISULA_LIBUTILS_LIBRARY} ${LIB_FUZZING_ENGINE} pthread rt -lisulad_img -lgcov)
set_target_properties(${EXE2} PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties(${EXE2} PROPERTIES LINK_FLAGS "-fsanitize=address -fsanitize-coverage=trace-pc")
-target_link_libraries(${EXE2} ${CMAKE_THREAD_LIBS_INIT} ${ISULA_LIBUTILS_LIBRARY} ${LIB_FUZZING_ENGINE} pthread rt -lisulad_img)
+target_link_libraries(${EXE2} ${CMAKE_THREAD_LIBS_INIT} ${ISULA_LIBUTILS_LIBRARY} ${LIB_FUZZING_ENGINE} pthread rt -lisulad_img -lgcov)
set_target_properties(${EXE3} PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties(${EXE3} PROPERTIES LINK_FLAGS "-fsanitize=address -fsanitize-coverage=trace-pc")
--
2.25.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。