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

hellostephen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 2d6c1204ce9 [regression-test](improvement) show line number when 
global var defined (#51254)
2d6c1204ce9 is described below

commit 2d6c1204ce96106fd02d93fa72c0818750f3dba0
Author: shuke <[email protected]>
AuthorDate: Tue May 27 14:59:24 2025 +0800

    [regression-test](improvement) show line number when global var defined 
(#51254)
---
 .../org/apache/doris/regression/util/LoggerUtils.groovy   | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git 
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/LoggerUtils.groovy
 
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/LoggerUtils.groovy
index cdb0739d21a..5635ef8b4ff 100644
--- 
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/LoggerUtils.groovy
+++ 
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/LoggerUtils.groovy
@@ -23,7 +23,12 @@ class LoggerUtils {
     static Tuple2<Integer, String> getErrorInfo(Throwable t, File file) {
         try {
             if (file.name.endsWith(".groovy")) {
-                def st = findRootErrorStackTrace(t, Sets.newLinkedHashSet(), 
file)
+                // to disable global variables, we've add some content to the 
bottom of the groovy file
+                // so if st.getLineNumber > fileLineCt, continue to seek the 
original line.
+                def fileLineCt = file.readLines().size()
+
+                def st = findRootErrorStackTrace(t, Sets.newLinkedHashSet(), 
file, fileLineCt)
+
                 int lineNumber = -1
                 if (!st.is(null)) {
                     lineNumber = st.getLineNumber()
@@ -45,12 +50,12 @@ class LoggerUtils {
         }
     }
 
-    static StackTraceElement findRootErrorStackTrace(Throwable t, 
Set<Throwable> throwables, File file) {
+    static StackTraceElement findRootErrorStackTrace(Throwable t, 
Set<Throwable> throwables, File file, int fileLineCt) {
         throwables.add(t)
 
         def cause = t.getCause()
         if (!cause.is(null) && !throwables.contains(cause)) {
-            def foundStackTrace = findRootErrorStackTrace(cause, throwables, 
file)
+            def foundStackTrace = findRootErrorStackTrace(cause, throwables, 
file, fileLineCt)
             if (!foundStackTrace.is(null)) {
                 return foundStackTrace
             }
@@ -58,7 +63,9 @@ class LoggerUtils {
 
         for (def st : t.getStackTrace()) {
             if (Objects.equals(st.fileName, file.name)) {
-                return st
+                if (st.getLineNumber() < fileLineCt) {
+                    return st
+                }
             }
         }
         return null


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

Reply via email to