Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [UT] add UT after build #812

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ Build-Depends:
libpcre3-dev,
deepin-anything-dev[i386 amd64],
deepin-anything-server-dev[i386 amd64],
deepin-desktop-base | deepin-desktop-server | deepin-desktop-device
deepin-desktop-base | deepin-desktop-server | deepin-desktop-device,
xvfb <!nocheck>,
lcov <!nocheck>
Standards-Version: 3.9.8
Homepage: http://www.deepin.org

Expand Down
9 changes: 8 additions & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,11 @@ override_dh_auto_configure:
-DAPP_VERSION=$(DEB_VERSION_UPSTREAM) -DVERSION=$(DEB_VERSION_UPSTREAM) LIB_INSTALL_DIR=/usr/lib/$(DEB_HOST_MULTIARCH)

override_dh_auto_build:
dh_auto_build -- -j8
dh_auto_build -- -j8

ifeq ($(filter nocheck,$(DEB_BUILD_PROFILES)),)
override_dh_auto_test:
ifeq ($(DEB_BUILD_ARCH), amd64)
cd tests && bash test-prj-running.sh
endif
endif
18 changes: 13 additions & 5 deletions tests/all-ut-prj-running.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later

export DISPLAY=":0"
set -x
export DISPLAY=":1"
export QT_QPA_PLATFORM=

# 定位脚本所在父目录
Expand Down Expand Up @@ -91,12 +92,12 @@ regList=(
# dfm-extension
dfm-framework

plugins/common/dfmplugin-burn
# plugins/common/dfmplugin-burn

plugins/filemanager/core/dfmplugin-computer
# plugins/filemanager/core/dfmplugin-computer
plugins/filemanager/core/dfmplugin-sidebar
plugins/filemanager/dfmplugin-myshares
plugins/filemanager/dfmplugin-smbbrowser
# plugins/filemanager/dfmplugin-myshares
# plugins/filemanager/dfmplugin-smbbrowser
plugins/filemanager/dfmplugin-optical

# services
Expand All @@ -105,6 +106,13 @@ regList=(
# services/dfm-common-service
)

# test prepare
echo "recompile gsettings for test"
mkdir -p $BUILD_DIR/glib-2.0/schemas
for f in $(find $PROJECT_FOLDER -name "*.xml");do cp $f $BUILD_DIR/glib-2.0/schemas/;done
glib-compile-schemas $BUILD_DIR/glib-2.0/schemas
export XDG_DATA_DIRS=$BUILD_DIR:$XDG_DATA_DIRS

# register test folders.
for((i=0; i<${#regList[@]}; i++))
do
Expand Down
2 changes: 1 addition & 1 deletion tests/cppcheck-prj-running.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later

export DISPLAY=":0"
export DISPLAY=":1"
export QT_QPA_PLATFORM=

# cppcheck检测目录
Expand Down
5 changes: 3 additions & 2 deletions tests/test-prj-running.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later

export DISPLAY=":0"
Xvfb :1 &
export DISPLAY=":1"
export QT_QPA_PLATFORM=

#get --help
Expand All @@ -27,7 +28,7 @@ CLEAR_COMMAND="yes"; #是否清场 no 就不清场
UT_COMMAND="all"; #运行UT类型 no all dde-file-manager
REBUILD_PTJ="yes";
CPP_CHECK_COMMAND="no"; #是否运行cppcheck,no就不运行
CPU_NUMBER=16; #当前使用CPU数目,默认为16
CPU_NUMBER=$(nproc);
SHOW_REPORT="no"; #默认为no 不显示报表

while [ $# -ge 2 ] ; do
Expand Down
6 changes: 3 additions & 3 deletions tests/ut-target-running.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later

export DISPLAY=":0"
export DISPLAY=":1"
export QT_QPA_PLATFORM=

#报告生成的地方
Expand Down Expand Up @@ -38,7 +38,7 @@ RESULT_UT_REPORT_FILE=$REPORT_DIR/report/report_$REPORT_NAME.xml
ASAN_OPTIONS="new_delete_type_mismatch=0" $BUILD_DIR/$APP_NAME --gtest_output=xml:$RESULT_UT_REPORT_FILE

if [ ! -f "$RESULT_UT_REPORT_FILE" ]; then
  echo "Error: UT process is broken by: " $RESULT_UT_REPORT_FILE
echo "Error: UT process is broken by: " $RESULT_UT_REPORT_FILE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个为啥改了,还改成三个空格缩进的了?下面也有一个一样的变动

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是它的缩进有问题,感觉是输入法设置导致的,脚本跑到这里不能正确输出,所以重新调整了一下缩进解决这个问题。

exit 1
fi

Expand All @@ -57,7 +57,7 @@ mv $RESULT_COVERAGE_DIR/index-sort-f.html $RESULT_COVERAGE_DIR/index-sort-f_$REP
mv $RESULT_COVERAGE_DIR/index-sort-l.html $RESULT_COVERAGE_DIR/index-sort-l_$REPORT_NAME.html

if [ ! -f "$LOV_REPORT_FILE" ]; then
  echo "Error: UT lcov process is broken by: " $LOV_REPORT_FILE
echo "Error: UT lcov process is broken by: " $LOV_REPORT_FILE
exit 2
fi

Expand Down