Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
lcr
提交
9cfc4a93
L
lcr
项目概览
openeuler
/
lcr
通知
3
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
lcr
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9cfc4a93
编写于
6月 15, 2020
作者:
O
openeuler-ci-bot
提交者:
Gitee
6月 15, 2020
浏览文件
操作
浏览文件
下载
差异文件
!50 回退 'Pull Request !49 : change name of testcases'
Merge pull request !50 from lifeng_isula/revert-merge-49-master
上级
824d6708
c1cd034c
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
35 addition
and
39 deletion
+35
-39
CMakeLists.txt
CMakeLists.txt
+4
-2
cmake/checker.cmake
cmake/checker.cmake
+1
-1
cmake/set_build_flags.cmake
cmake/set_build_flags.cmake
+2
-2
src/CMakeLists.txt
src/CMakeLists.txt
+4
-0
tests/CMakeLists.txt
tests/CMakeLists.txt
+22
-32
tests/json_llt.cpp
tests/json_llt.cpp
+2
-2
tests/log_llt.cpp
tests/log_llt.cpp
+0
-0
未找到文件。
CMakeLists.txt
浏览文件 @
9cfc4a93
...
...
@@ -85,8 +85,10 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party)
add_subdirectory
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/src
)
# ut and gcoverage
add_subdirectory
(
tests
)
# llt and gcoverage
if
(
LCR_GCOV
)
add_subdirectory
(
tests
)
endif
()
# install all files
install
(
FILES
${
CMAKE_BINARY_DIR
}
/conf/lcr.pc
...
...
cmake/checker.cmake
浏览文件 @
9cfc4a93
...
...
@@ -69,7 +69,7 @@ find_library(LIBYAJL_LIBRARY yajl
HINTS
${
PC_LIBYAJL_LIBDIR
}
${
PC_LIBYAJL_LIBRARY_DIRS
}
)
_CHECK
(
LIBYAJL_LIBRARY
"LIBYAJL_LIBRARY-NOTFOUND"
"libyajl.so"
)
if
(
ENABLE
_GCOV
)
if
(
LCR
_GCOV
)
pkg_check_modules
(
PC_GTEST
"gtest"
)
find_path
(
GTEST_INCLUDE_DIR gtest/gtest.h
HINTS
${
PC_GTEST_INCLUDEDIR
}
${
PC_GTEST_INCLUDE_DIRS
}
)
...
...
cmake/set_build_flags.cmake
浏览文件 @
9cfc4a93
...
...
@@ -29,8 +29,8 @@ set(CMAKE_EXE_LINKER_FLAGS "-Wl,-E -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -W
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-D__FILENAME__='
\"
$(subst
${
CMAKE_SOURCE_DIR
}
/,,$(abspath $<))
\"
'"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-D__FILENAME__='
\"
$(subst
${
CMAKE_SOURCE_DIR
}
/,,$(abspath $<))
\"
'"
)
option
(
ENABLE
_GCOV
"set lcr gcov option"
OFF
)
if
(
ENABLE
_GCOV
)
option
(
LCR
_GCOV
"set lcr gcov option"
OFF
)
if
(
LCR
_GCOV
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-Wall -fprofile-arcs -ftest-coverage"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wall -fprofile-arcs -ftest-coverage"
)
SET
(
CMAKE_EXE_LINKER_FLAGS
"
${
CMAKE_EXE_LINKER_FLAGS
}
-lgcov"
)
...
...
src/CMakeLists.txt
浏览文件 @
9cfc4a93
...
...
@@ -103,6 +103,10 @@ if (CMAKE_TOOLCHAIN_FILE)
target_link_libraries
(
liblcr
${
EXTRAL_LINK_LIBS
}
)
endif
()
if
(
LCR_GCOV
)
target_link_libraries
(
liblcr -lgcov
)
endif
()
# install all files
install
(
TARGETS liblcr
LIBRARY DESTINATION
${
LIB_INSTALL_DIR_DEFAULT
}
PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
)
...
...
tests/CMakeLists.txt
浏览文件 @
9cfc4a93
...
...
@@ -61,48 +61,38 @@ endmacro()
# --------------- testcase add here -----------------
# api testcase
_DEFINE_NEW_TEST
(
log_ut log_testcase
)
_DEFINE_NEW_TEST
(
libocispec_ut json_testcase
)
_DEFINE_NEW_TEST
(
log_llt log_testcase
)
_DEFINE_NEW_TEST
(
json_llt json_testcase
)
# mock test for run lcov to generate html
add_executable
(
mock_
u
t main.cpp
)
target_include_directories
(
mock_
u
t PUBLIC
add_executable
(
mock_
ll
t main.cpp
)
target_include_directories
(
mock_
ll
t PUBLIC
${
GTEST_INCLUDE_DIR
}
PUBLIC
${
CMAKE_CURRENT_SOURCE_DIR
}
)
target_link_libraries
(
mock_
u
t
target_link_libraries
(
mock_
ll
t
gtest
pthread
)
add_dependencies
(
mock_
ut log_ut libocispec_u
t
)
add_dependencies
(
mock_
llt log_llt json_ll
t
)
# run ut and gcov
if
(
ENABLE_GCOV
)
set
(
result isula_libutils.info
)
set
(
result_dir lcr_gcovs
)
set
(
target_dir src/CMakeFiles/isula_libutils.dir
)
set
(
result isula_libutils.info
)
set
(
result_dir lcr_gcovs
)
set
(
target_dir src/CMakeFiles/isula_libutils.dir
)
add_custom_command
(
TARGET mock_ut
POST_BUILD
COMMAND
${
CMAKE_COMMAND
}
-E remove -f
${
result
}
COMMAND
${
CMAKE_COMMAND
}
-E make_directory
${
result_dir
}
COMMAND
"ctest"
COMMAND
${
CMD_LCOV
}
--gcov-tool
${
CMD_GCOV
}
--exclude
"/usr/*"
--exclude
"*/src/utils.c"
--exclude
"*/json/*"
-d
${
CMAKE_BINARY_DIR
}
/
${
target_dir
}
-c -o
${
result
}
COMMAND
${
CMD_GENHTML
}
--ignore-errors source -o
${
result_dir
}
${
result
}
COMMAND
${
CMAKE_COMMAND
}
-E echo run gcov finish
VERBATIM
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
/tests
)
else
()
add_custom_command
(
TARGET mock_ut
PRE_BUILD
COMMAND
"ctest"
COMMAND
${
CMAKE_COMMAND
}
-E echo UT finish
VERBATIM
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
/tests
)
endif
()
# generate gcov
add_custom_command
(
TARGET mock_llt
POST_BUILD
COMMAND
${
CMAKE_COMMAND
}
-E remove -f
${
result
}
COMMAND
${
CMAKE_COMMAND
}
-E make_directory
${
result_dir
}
COMMAND
"ctest"
COMMAND
${
CMD_LCOV
}
--gcov-tool
${
CMD_GCOV
}
--exclude
"/usr/*"
--exclude
"*/src/utils.c"
--exclude
"*/json/*"
-d
${
CMAKE_BINARY_DIR
}
/
${
target_dir
}
-c -o
${
result
}
COMMAND
${
CMD_GENHTML
}
--ignore-errors source -o
${
result_dir
}
${
result
}
COMMAND
${
CMAKE_COMMAND
}
-E echo LLT finish
VERBATIM
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
/tests
)
# --------------- testcase add finish -----------------
tests/
libocispec_u
t.cpp
→
tests/
json_ll
t.cpp
浏览文件 @
9cfc4a93
...
...
@@ -30,7 +30,7 @@
#include "read_file.h"
#include "oci_runtime_hooks.h"
TEST
(
libocispec
_testcase
,
test_oci_runtime_spec_hooks
)
TEST
(
json
_testcase
,
test_oci_runtime_spec_hooks
)
{
const
char
*
fname
=
"./ocihook.json"
;
oci_runtime_spec_hooks
*
hooks
=
nullptr
;
...
...
@@ -79,7 +79,7 @@ TEST(libocispec_testcase, test_oci_runtime_spec_hooks)
free
(
jstr
);
}
TEST
(
libocispec
_testcase
,
test_json_readfile
)
TEST
(
json
_testcase
,
test_json_readfile
)
{
const
char
*
fname
=
"./ocihook.json"
;
const
char
*
not_exist
=
"/tmp/not_exist.json"
;
...
...
tests/log_
u
t.cpp
→
tests/log_
ll
t.cpp
浏览文件 @
9cfc4a93
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录