Skip to content

Commit

Permalink
[feature](fe) Add coverage tool for FE UT
Browse files Browse the repository at this point in the history
  • Loading branch information
SWJTU-ZhangLei committed Nov 6, 2023
1 parent 99de6c7 commit 6e64ee0
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 12 deletions.
2 changes: 1 addition & 1 deletion fe/fe-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ under the License.
<reuseForks>false</reuseForks>
<useFile>false</useFile>
<argLine>
-Xmx512m -javaagent:${settings.localRepository}/org/jmockit/jmockit/${jmockit.version}/jmockit-${jmockit.version}.jar
-Xmx512m -javaagent:${settings.localRepository}/org/jmockit/jmockit/${jmockit.version}/jmockit-${jmockit.version}.jar @{argLine}
</argLine>
</configuration>
</plugin>
Expand Down
27 changes: 27 additions & 0 deletions fe/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,19 @@ under the License.
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
Expand Down Expand Up @@ -178,6 +191,19 @@ under the License.
<artifactId>sonar-maven-plugin</artifactId>
<version>3.9.1.2184</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
Expand Down Expand Up @@ -324,6 +350,7 @@ under the License.
<!-- arrow flight sql -->
<arrow.vector.classifier>shade-format-flatbuffers</arrow.vector.classifier>
<flatbuffers.version>1.12.0</flatbuffers.version>
<jacoco.version>0.8.10</jacoco.version>
</properties>
<profiles>
<profile>
Expand Down
2 changes: 1 addition & 1 deletion fe/spark-dpp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ under the License.
<!-->not reuse forked jvm, so that each unit test will run in separate jvm. to avoid singleton confict<-->
<reuseForks>false</reuseForks>
<argLine>
-javaagent:${settings.localRepository}/org/jmockit/jmockit/${jmockit.version}/jmockit-${jmockit.version}.jar
-javaagent:${settings.localRepository}/org/jmockit/jmockit/${jmockit.version}/jmockit-${jmockit.version}.jar @{argLine}
</argLine>
</configuration>
</plugin>
Expand Down
24 changes: 14 additions & 10 deletions run-fe-ut.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,22 @@ if [[ -z "${FE_UT_PARALLEL}" ]]; then
fi
echo "Unit test parallel is: ${FE_UT_PARALLEL}"

if [[ "${COVERAGE}" -eq 1 ]]; then
echo "Run coverage statistic"
ant cover-test
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}" test jacoco:report -DfailIfNoTests=false -Dtest="$1"
else
"${MVN_CMD}" test -Dcheckstyle.skip=true -DfailIfNoTests=false -Dtest="$1"
fi
else
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
"${MVN_CMD}" test -Dcheckstyle.skip=true -DfailIfNoTests=false -D test="$1"
echo "Run Frontend UT"
if [[ "${COVERAGE}" -eq 1 ]]; then
"${MVN_CMD}" test jacoco:report -DfailIfNoTests=false
else
echo "Run Frontend UT"
"${MVN_CMD}" test -Dcheckstyle.skip=true -DfailIfNoTests=false
fi
fi

0 comments on commit 6e64ee0

Please sign in to comment.