Skip to content

Commit 9c2c6d7

Browse files
authored
Codecov (oceanbase#324)
### What problem were solved in this pull request? Issue Number: close oceanbase#172 Problem: 增加单元测试统计信息
1 parent 63b1f03 commit 9c2c6d7

File tree

4 files changed

+30
-29
lines changed

4 files changed

+30
-29
lines changed

.github/workflows/build.yml

+14
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,20 @@ jobs:
3939
cd build_debug
4040
make test
4141
42+
- name: lcov
43+
shell: bash
44+
run: |
45+
export DEBIAN_FRONTEND=noninteractive
46+
sudo apt-get update && sudo apt-get install -y lcov
47+
cd build_debug
48+
rm -rf unittest
49+
lcov -c -d ./ -o coverage.info
50+
51+
- uses: codecov/codecov-action@v3
52+
with:
53+
file: build_debug/coverage.info
54+
token: ${{ secrets.CODECOV_TOKEN }}
55+
4256
build-on-mac:
4357
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
4458
# You can convert this to a matrix build if you need cross-platform coverage.

CMakeLists.txt

+9-28
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,15 @@ ENDIF ()
126126

127127
INCLUDE_DIRECTORIES(. ${PROJECT_SOURCE_DIR}/deps /usr/local/include)
128128

129+
IF(WITH_UNIT_TESTS)
130+
SET(CMAKE_COMMON_FLAGS "${CMAKE_COMMON_FLAGS} -fprofile-arcs -ftest-coverage")
131+
enable_testing()
132+
ENDIF(WITH_UNIT_TESTS)
133+
134+
SET(CMAKE_CXX_FLAGS ${CMAKE_COMMON_FLAGS})
135+
SET(CMAKE_C_FLAGS ${CMAKE_COMMON_FLAGS})
136+
MESSAGE(STATUS "CMAKE_CXX_FLAGS is " ${CMAKE_CXX_FLAGS})
137+
129138
# ADD_SUBDIRECTORY(src bin) bin 为目标目录, 可以省略
130139
ADD_SUBDIRECTORY(deps)
131140
ADD_SUBDIRECTORY(src/obclient)
@@ -135,34 +144,6 @@ ADD_SUBDIRECTORY(benchmark)
135144
ADD_SUBDIRECTORY(tools)
136145

137146
IF(WITH_UNIT_TESTS)
138-
SET(CMAKE_COMMON_FLAGS "${CMAKE_COMMON_FLAGS} -fprofile-arcs -ftest-coverage")
139-
enable_testing()
140147
ADD_SUBDIRECTORY(unittest)
141148
ENDIF(WITH_UNIT_TESTS)
142149

143-
SET(CMAKE_CXX_FLAGS ${CMAKE_COMMON_FLAGS})
144-
SET(CMAKE_C_FLAGS ${CMAKE_COMMON_FLAGS})
145-
MESSAGE(STATUS "CMAKE_CXX_FLAGS is " ${CMAKE_CXX_FLAGS})
146-
147-
INSTALL(DIRECTORY etc DESTINATION .
148-
FILE_PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
149-
150-
#INSTALL([[SCRIPT <file>] [CODE <code>]] [...])
151-
# script 表示安装时,调用cmake 脚步
152-
# code 表示安装时,执行cmake 命令, 例如
153-
INSTALL(CODE "MESSAGE(\"Sample install message.\")")
154-
# EXEC_PROGRAM make时执行命令
155-
#EXEC_PROGRAM(Executable [directory in which to run]
156-
# [ARGS <arguments to executable>]
157-
# [OUTPUT_VARIABLE <var>]
158-
159-
#EXEC_PROGRAM(Executable [directory in which to run]
160-
# [ARGS <arguments to executable>]
161-
# [OUTPUT_VARIABLE <var>]
162-
# [RETURN_VALUE <var>])
163-
# 生产make时,执行
164-
#EXEC_PROGRAM(ls ARGS "*.c" OUTPUT_VARIABLE LS_OUTPUT RETURN_VALUE
165-
# LS_RVALUE)
166-
#IF(not LS_RVALUE)
167-
# MESSAGE(STATUS "ls result: " ${LS_OUTPUT})
168-
#ENDIF(not LS_RVALUE)

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
<div align="center">
2+
3+
[![Coverage Status](https://codecov.io/gh/oceanbase/miniob/branch/main/graph/badge.svg)](https://codecov.io/gh/oceanbase/miniob)
4+
5+
</div>
6+
17
# MiniOB 概述
28

39
MiniOB 是 [OceanBase](https://github.com/oceanbase/oceanbase) 团队基于华中科技大学数据库课程原型,联合多所高校重新开发的、专为零基础的同学设计的数据库入门学习项目。我们的目标是为在校学生、数据库从业者、爱好者或对基础技术感兴趣的人提供一个友好的数据库学习项目。

src/observer/storage/trx/mvcc_trx.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ RC MvccTrx::delete_record(Table *table, Record &record)
177177
begin_xid, end_xid, trx_id_, record.rid().to_string().c_str());
178178
rc = table->delete_record(record);
179179
ASSERT(rc == RC::SUCCESS, "failed to delete record in table.table id =%d, rid=%s, begin_xid=%d, end_xid=%d, current trx id = %d",
180-
table.->table_id(), record.rid().to_string().c_str(), begin_xid, end_xid, trx_id_);
180+
table->table_id(), record.rid().to_string().c_str(), begin_xid, end_xid, trx_id_);
181181
return rc;
182182
}
183183

0 commit comments

Comments
 (0)