fix(ut): fix null pointer crash and static variable bug in source - #499
Conversation
There was a problem hiding this comment.
Sorry @pengfeixx, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
Warning
详情 {
"export": {
"tests/test-prj-running.sh": {
"b": [
"export ASAN_OPTIONS=abort_on_error=0:detect_leaks=0",
"export UBSAN_OPTIONS=halt_on_error=0"
]
}
}
} |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds null-safety around TextEdit settings, fixes a static anchoring bug in Window creation, and adjusts test runner scripts/env to avoid crashes and noisy logs under ASAN/UBSAN. Sequence diagram for updated TextEdit::setTextFinished null-safetysequenceDiagram
participant TextEdit
participant m_settings
participant m_listBookmark
TextEdit->>TextEdit: setTextFinished()
TextEdit->>TextEdit: blockCount()
TextEdit->>TextEdit: update m_nLines and m_lastLeftAreaBlockCount
TextEdit->>TextEdit: [check m_settings]
alt m_settings is null
TextEdit->>TextEdit: qDebug
TextEdit-->>TextEdit: return
else m_settings is not null
TextEdit->>TextEdit: [check m_listBookmark.isEmpty]
alt m_listBookmark is not empty
TextEdit->>TextEdit: qDebug
TextEdit-->>TextEdit: return
else m_listBookmark is empty
TextEdit->>m_settings: apply text finished settings
end
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
6d79b10 to
acb1d14
Compare
|
Warning
详情 {
"export": {
"tests/test-prj-running.sh": {
"b": [
"export ASAN_OPTIONS=abort_on_error=0:detect_leaks=0",
"export UBSAN_OPTIONS=halt_on_error=0"
]
}
}
} |
acb1d14 to
8529ac4
Compare
|
Warning
详情 {
"export": {
"tests/test-prj-running.sh": {
"b": [
"export ASAN_OPTIONS=abort_on_error=0:detect_leaks=0",
"export UBSAN_OPTIONS=halt_on_error=0"
]
}
}
} |
8529ac4 to
a916d34
Compare
|
Warning
详情 {
"export": {
"tests/test-prj-running.sh": {
"b": [
"export ASAN_OPTIONS=abort_on_error=0:detect_leaks=0",
"export UBSAN_OPTIONS=halt_on_error=0"
]
}
}
} |
1f05239 to
7a0e220
Compare
|
Warning
详情 {
"export": {
"tests/test-prj-running.sh": {
"b": [
"export ASAN_OPTIONS=abort_on_error=0:detect_leaks=0",
"export UBSAN_OPTIONS=halt_on_error=0"
]
}
}
} |
7a0e220 to
b22e4ab
Compare
Add null guard for m_settings in setTextFinished to prevent SEGV. Fix static DAnchors<FindBar> causing bad-free on second Window. Disable debug log and set ASAN_OPTIONS in test runner. Log: 修复单元测试运行时的空指针崩溃和静态变量释放问题 Influence: 解决测试套件运行时因排队事件导致的SEGV崩溃
b22e4ab to
7f7f26a
Compare
|
Warning
详情 {
"export": {
"tests/test-prj-running.sh": {
"b": [
"export ASAN_OPTIONS=abort_on_error=0:detect_leaks=0",
"export UBSAN_OPTIONS=halt_on_error=0"
]
}
}
} |
deepin pr auto review★ 总体评分:85分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 #!/bin/bash
builddir=build
reportdir=build-ut
# 建议使用变量控制是否清理和重新构建,而不是直接注释
REBUILD=${REBUILD:-1}
if [ "$REBUILD" -eq 1 ]; then
rm -r $builddir 2>/dev/null || true
rm -r ../$builddir 2>/dev/null || true
rm -r $reportdir 2>/dev/null || true
rm -r ../$reportdir 2>/dev/null || true
mkdir -p ../$builddir
mkdir -p ../$reportdir
fi
cd ../$builddir
# 编译
if [ "$REBUILD" -eq 1 ]; then
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_SAFETYTEST_ARG="CMAKE_SAFETYTEST_ARG_ON" ..
fi
make -j8
# 生成asan日志和ut测试xml结果
export ASAN_OPTIONS=abort_on_error=0:detect_leaks=0
export UBSAN_OPTIONS=halt_on_error=0
./tests/deepin-editor-test --gtest_output=xml:./report/report_deepin-editor.xml
workdir=$(cd ../$(dirname $0)/$builddir; pwd)
# ... 其他逻辑保持不变 ...
cp asan*.log* ../$reportdir/asan_deepin-editor.log 2>/dev/null || true
exit 0 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lzwind, pengfeixx The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Add null guard for m_settings in setTextFinished to prevent SEGV. Fix static DAnchors causing bad-free on second Window. Disable debug log and set ASAN_OPTIONS in test runner.
Log: 修复单元测试运行时的空指针崩溃和静态变量释放问题
Influence: 解决测试套件运行时因排队事件导致的SEGV崩溃
Summary by Sourcery
Stabilize unit test execution by guarding against null settings in text finishing logic, fixing a static-anchor lifetime issue in the window find bar, and updating the test harness to be more robust and less noisy under sanitizers.
Bug Fixes:
Enhancements:
Tests: