Skip to content

Commit

Permalink
fix: [UT] ut shell error
Browse files Browse the repository at this point in the history
fix incorrect tab character and add xvfb test support

Also added a test environment preparation operation

Log:
  • Loading branch information
hudeng-go committed Apr 17, 2023
1 parent 1dcf1b0 commit 68d848c
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 12 deletions.
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
4 changes: 4 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,9 @@ override_dh_auto_configure:
override_dh_auto_build:
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
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

0 comments on commit 68d848c

Please sign in to comment.