Skip to content
Open
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
34 changes: 22 additions & 12 deletions run-fe-ut.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,14 @@ Usage: $0 <options>
Optional options:
--coverage build and run coverage statistic
--run build and run ut
-j <num> build parallel, num is the number of threads, default 1
-p <num> unit test parallel, num is the number of forked JVMs, default 1

Eg.
$0 build and run ut
$0 -j 4 build with 4 threads and run ut
$0 -p 3 run unit tests with 3 forked JVMs
$0 -j 4 -p 3 build with 4 threads and run unit tests with 3 forked JVMs
$0 --coverage build and run coverage statistic
$0 --run org.apache.doris.utframe.Demo build and run the test named Demo
$0 --run org.apache.doris.utframe.Demo#testCreateDbAndTable+test2 build and run testCreateDbAndTable in Demo test
Expand All @@ -44,7 +49,7 @@ Usage: $0 <options>

if ! OPTS="$(getopt \
-n "$0" \
-o '' \
-o 'j:p:' \
-l 'coverage' \
-l 'run' \
-- "$@")"; then
Expand All @@ -55,8 +60,9 @@ eval set -- "${OPTS}"

RUN=0
COVERAGE=0
BUILD_PARALLEL=1
UT_PARALLEL=1
if [[ "$#" == 1 ]]; then
#default
RUN=0
COVERAGE=0
else
Expand All @@ -72,6 +78,14 @@ else
RUN=1
shift
;;
-j)
BUILD_PARALLEL="$2"
shift 2
;;
-p)
UT_PARALLEL="$2"
shift 2
;;
--)
shift
break
Expand Down Expand Up @@ -102,27 +116,23 @@ cd "${DORIS_HOME}/fe"
mkdir -p build/compile

if [[ -z "${FE_UT_PARALLEL}" ]]; then
# the default fe unit test parallel is 1
export FE_UT_PARALLEL=1
export FE_UT_PARALLEL="${UT_PARALLEL}"
fi
echo "Build parallel is: ${BUILD_PARALLEL}"
echo "Unit test parallel is: ${FE_UT_PARALLEL}"

if [[ "${RUN}" -eq 1 ]]; then
echo "Run the specified class: $1"
# eg:
# sh run-fe-ut.sh --run org.apache.doris.utframe.DemoTest
# sh run-fe-ut.sh --run org.apache.doris.utframe.DemoTest#testCreateDbAndTable+test2

if [[ "${COVERAGE}" -eq 1 ]]; then
"${MVN_CMD}" -Pcoverage test jacoco:report -DfailIfNoTests=false -Dtest="$1"
"${MVN_CMD}" -T "${BUILD_PARALLEL}" -Pcoverage test jacoco:report -DfailIfNoTests=false -Dtest="$1"
else
"${MVN_CMD}" test -Dcheckstyle.skip=true -DfailIfNoTests=false -Dmaven.build.cache.enabled=false -Dtest="$1"
"${MVN_CMD}" -T "${BUILD_PARALLEL}" test -Dcheckstyle.skip=true -DfailIfNoTests=false -Dmaven.build.cache.enabled=false -Dtest="$1"
fi
else
echo "Run Frontend UT"
if [[ "${COVERAGE}" -eq 1 ]]; then
"${MVN_CMD}" -Pcoverage test jacoco:report -DfailIfNoTests=false -Dmaven.test.failure.ignore=true
"${MVN_CMD}" -T "${BUILD_PARALLEL}" -Pcoverage test jacoco:report -DfailIfNoTests=false -Dmaven.test.failure.ignore=true
else
"${MVN_CMD}" test -Dcheckstyle.skip=true -DfailIfNoTests=false -Dmaven.build.cache.enabled=false
"${MVN_CMD}" -T "${BUILD_PARALLEL}" test -Dcheckstyle.skip=true -DfailIfNoTests=false -Dmaven.build.cache.enabled=false
fi
fi
Loading