[Tool] filter cases in fe ut script (#31327)

This commit is contained in:
andyziye 2023-09-19 10:43:13 +08:00 committed by GitHub
parent c4a426e05b
commit 6f88763e76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 22 deletions

View File

@ -4,7 +4,7 @@ on:
schedule:
- cron: "0 1 * * 1-5"
- cron: "0 6 * * 1-5"
- cron: "0 11 * * 1-5"
- cron: "0 10 * * 1-5"
workflow_dispatch:
concurrency:
@ -122,8 +122,8 @@ jobs:
- name: Publish UT Report
uses: mikepenz/action-junit-report@v4
if: always()
id: publish_report
if: steps.download-ut-xml.outputs.size != '0'
env:
github_token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -31,16 +31,19 @@ usage() {
Usage: $0 <options>
Optional options:
--test [TEST_NAME] run specific test
--filter [TEST_NAME] skip run specific test,
multiple tests separated by commas and enclosed in quotation marks
--dry-run dry-run unit tests
--coverage run coverage statistic tasks
--dumpcase [PATH] run dump case and save to path
Eg.
$0 run all unit tests
$0 --test com.starrocks.utframe.Demo run demo test
$0 --dry-run dry-run unit tests
$0 --coverage run coverage statistic tasks
$0 --dumpcase /home/disk1/ run dump case and save to path
$0 run all unit tests
$0 --test com.starrocks.utframe.Demo run demo test
$0 --filter com.starrocks.utframe.Demo#Test0 skip run demo test0
$0 --dry-run dry-run unit tests
$0 --coverage run coverage statistic tasks
$0 --dumpcase /home/disk1/ run dump case and save to path
"
exit 1
}
@ -50,6 +53,7 @@ OPTS=$(getopt \
-n $0 \
-o '' \
-l 'test:' \
-l 'filter:' \
-l 'dry-run' \
-l 'coverage' \
-l 'dumpcase' \
@ -67,16 +71,18 @@ HELP=0
DRY_RUN=0
RUN_SPECIFIED_TEST=0
TEST_NAME=*
FILTER_TEST=""
COVERAGE=0
DUMPCASE=0
while true; do
while true; do
case "$1" in
--coverage) COVERAGE=1 ; shift ;;
--test) RUN_SPECIFIED_TEST=1; TEST_NAME=$2; shift 2;;
--filter) FILTER_TEST=$2; shift 2;;
--run) shift ;; # only used for compatibility
--dumpcase) DUMPCASE=1; shift ;;
--dry-run) DRY_RUN=1 ; shift ;;
--help) HELP=1 ; shift ;;
--help) HELP=1 ; shift ;;
--) shift ; break ;;
*) echo "Internal error" ; exit 1 ;;
esac
@ -110,24 +116,25 @@ fi
mkdir ut_ports
if [[ $FILTER_TEST != "" ]];then
FILTER_TEST=`echo $FILTER_TEST | sed -E 's/([^,]+)/!\1/g'`
TEST_NAME="$TEST_NAME, $FILTER_TEST"
fi
if [ ${COVERAGE} -eq 1 ]; then
echo "Run coverage statistic tasks"
ant cover-test
elif [ ${DUMPCASE} -eq 1 ]; then
${MVN_CMD} test -DfailIfNoTests=false -DtrimStackTrace=false -D test=com.starrocks.sql.dump.QueryDumpRegressionTest -D dumpJsonConfig=$1
else
if [ ${RUN_SPECIFIED_TEST} -eq 1 ]; then
echo "Run test: $TEST_NAME"
if [ $DRY_RUN -eq 0 ]; then
# ./run-fe-ut.sh --test com.starrocks.utframe.Demo
# ./run-fe-ut.sh --test com.starrocks.utframe.Demo#testCreateDbAndTable+test2
# set trimStackTrace to false to show full stack when debugging specified class or case
${MVN_CMD} test -DfailIfNoTests=false -DtrimStackTrace=false -D test=$TEST_NAME
if [ $DRY_RUN -eq 0 ]; then
if [ ${RUN_SPECIFIED_TEST} -eq 1 ]; then
echo "Run test: $TEST_NAME"
else
echo "Run All Frontend Unittests"
fi
else
echo "Run All Frontend Unittests"
if [ $DRY_RUN -eq 0 ]; then
${MVN_CMD} test -DfailIfNoTests=false -DtrimStackTrace=false
fi
fi
# set trimStackTrace to false to show full stack when debugging specified class or case
${MVN_CMD} test -DfailIfNoTests=false -DtrimStackTrace=false -D test="$TEST_NAME"
fi
fi