deepin-ocr/tests/test-prj-running.sh
ut000593 86750f0d58 chore(CI): CI 流程优化
Description: 远程执行初始化显示相关环境

Log: no
Change-Id: I35a0aa9e3cfbf0b059d2ec95496734bec58d99b9
2021-12-01 20:01:35 +08:00

66 lines
2.1 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
#export QT_QPA_PLATFORM='offscreen'
export QTEST_FUNCTION_TIMEOUT='800000'
export DISPLAY=":0"
export QT_QPA_PLATFORM=
export QT_LOGGING_RULES="qt.qpa.xcb.xcberror=false"
export QT_LOGGING_RULES="qt.qpa.xcb.*=false"
export QT_LOGGING_RULES="qt.qpa.*=false"
export QT_LOGGING_RULES="*=false"
cd ..
rm -rf ./build-ut
rm -rf ./build
mkdir build-ut
cmake . -B build -D DOTEST=ON
cd build
#自动读取当前处理器核心数但考虑到服务器上会同时存在多个构建完全占用服务器CPU会导致构建变慢所以限制使用的核心不超过8个
JOBS=`cat /proc/cpuinfo| grep "processor"| wc -l`
if [ $JOBS -gt 8 ]
then JOBS=8
elif [ $JOBS -eq 0 ]
then JOBS=1
fi
echo use processor count: $JOBS
make -j$JOBS
lcov --directory ./CMakeFiles/deepin-ocr_test.dir --zerocounters
./deepin-ocr_test
lcov --directory . --capture --output-file ./coverageResult/deepin-ocr_Coverage.info
echo \ ===================\ do\ filter\ begin\ ====================\
lcov --remove ./coverageResult/deepin-ocr_Coverage.info '*/deepin-ocr_test_autogen/*' '*/deepin-ocr_autogen/*' '*/usr/include/*' '*/usr/local/*' '*/tests/*' '*/googletest/*' -o ./coverageResult/deepin-ocr_Coverage.info
echo \ ===================\ do\ filter\ end\ ====================\
genhtml -o ./coverageResult/report ./coverageResult/deepin-ocr_Coverage.info
sleep 2
lcov --directory . --capture --output-file ./coverageResult/deepin-ocr_Coverage.info
echo \ ===================\ do\ filter\ begin\ ====================\
lcov --remove ./coverageResult/deepin-ocr_Coverage.info '*/deepin-ocr_test_autogen/*' '*/deepin-ocr_autogen/*' '*/usr/include/*' '*/usr/local/*' '*/tests/*' '*/googletest/*' -o ./coverageResult/deepin-ocr_Coverage.info
echo \ ===================\ do\ filter\ end\ ====================\
genhtml -o ./coverageResult/report ./coverageResult/deepin-ocr_Coverage.info
cd ./../build-ut
cp -r ./../build/coverageResult/report/ ./
mv report html
cd html
mv index.html cov_deepin-ocr.html
cd ..
mkdir report
cd report
cp ./../../build/report/report_deepin-ocr.xml ./
cd ..
cp ./../build/asan_deepin-ocr.log* ./asan_deepin-ocr.log
exit 0