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 7, 2023
1 parent 8da1a9a commit b5cf056
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 @@ -172,6 +172,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>
<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -1483,6 +1484,19 @@ under the License.
</pom>
</configuration>
</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 @@ -1537,6 +1551,19 @@ under the License.
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
</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>
</build>
<reporting>
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 b5cf056

Please sign in to comment.