This is an automated email from the ASF dual-hosted git repository.

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 87862f97153 [feature](fe) Add coverage tool for FE UT (#26203) (#26857)
87862f97153 is described below

commit 87862f971539105755b378d84aa6a216626f6b8c
Author: Lei Zhang <[email protected]>
AuthorDate: Mon Nov 13 17:14:10 2023 +0800

    [feature](fe) Add coverage tool for FE UT (#26203) (#26857)
---
 fe/fe-core/pom.xml   |  2 +-
 fe/pom.xml           | 27 +++++++++++++++++++++++++++
 fe/spark-dpp/pom.xml |  2 +-
 run-fe-ut.sh         | 24 ++++++++++++++----------
 4 files changed, 43 insertions(+), 12 deletions(-)

diff --git a/fe/fe-core/pom.xml b/fe/fe-core/pom.xml
index e4a3e89fa56..c425ea5394f 100644
--- a/fe/fe-core/pom.xml
+++ b/fe/fe-core/pom.xml
@@ -824,7 +824,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>
diff --git a/fe/pom.xml b/fe/pom.xml
index 5f1d8547972..4f4de40a670 100644
--- a/fe/pom.xml
+++ b/fe/pom.xml
@@ -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>
@@ -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>
@@ -322,6 +348,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>
diff --git a/fe/spark-dpp/pom.xml b/fe/spark-dpp/pom.xml
index b2f6eb3c540..6e3ce454fd0 100644
--- a/fe/spark-dpp/pom.xml
+++ b/fe/spark-dpp/pom.xml
@@ -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>
diff --git a/run-fe-ut.sh b/run-fe-ut.sh
index 8d71d9c6ca9..e3017ac4ea7 100755
--- a/run-fe-ut.sh
+++ b/run-fe-ut.sh
@@ -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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to