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

englefly 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 06bb48f90d7 [opt](regression) ./run-regression-test.sh support -f 
parameter to run case in specified file (#56799)
06bb48f90d7 is described below

commit 06bb48f90d7313db4da91a96efd61282cf2e5173
Author: minghong <[email protected]>
AuthorDate: Mon Oct 13 14:55:07 2025 +0800

    [opt](regression) ./run-regression-test.sh support -f parameter to run case 
in specified file (#56799)
    
    ### What problem does this PR solve?
    1. support -f parameter to run specified case file
    ./run-regression-test.sh --run -f
    regression-test/suites/tpch_sf0.1_p1/sql/q01.sql
    is equivalent to
    ./run-regression-test.sh --run -f
    regression-test/suites/tpch_sf0.1_p1/sql -s q01
    
    2. print regression log in log file
    the end of log file looks like this:
    2025-10-10 18:10:26.819 INFO [main] (RegressionTest.groovy:478) - Test 1
    suites, failed 1 suites, fatal 0 scripts, skipped 0 scripts
    2025-10-10 18:10:26.820 INFO [main] (RegressionTest.groovy:130) - Test
    finished
    2025-10-10 18:10:26.820 INFO [main] (RegressionTest.groovy:153) -
    
================================================================================
    2025-10-10 18:10:26.821 INFO [main] (RegressionTest.groovy:154) - Log
    file:
    
/xxx/doris/output/regression-test/log/doris-regression-test.20251010.180949.log
    2025-10-10 18:10:26.821 INFO [main] (RegressionTest.groovy:155) -
    
================================================================================
    2025-10-10 18:10:26.969 INFO [Thread-0]
    (plugin_query_timeout_debugger.groovy:93) - stop worker
---
 .../apache/doris/regression/RegressionTest.groovy  | 31 ++++++++++
 run-regression-test.sh                             | 70 ++++++++++++++++++----
 2 files changed, 89 insertions(+), 12 deletions(-)

diff --git 
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/RegressionTest.groovy
 
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/RegressionTest.groovy
index 700ff4add8b..64f8d8fa2b5 100644
--- 
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/RegressionTest.groovy
+++ 
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/RegressionTest.groovy
@@ -89,6 +89,10 @@ class RegressionTest {
         }
 
         Config config = Config.fromCommandLine(cmd)
+        
+        // Print log file path
+        printLogFilePath()
+        
         initGroovyEnv(config)
         boolean success = true
         Integer totalFailure = 0
@@ -124,10 +128,37 @@ class RegressionTest {
         }
         scriptExecutors.shutdown()
         log.info("Test finished")
+        
+        // Print log file path again at the end
+        printLogFilePath()
+        
         if (!success) {
             System.exit(1)
         }
     }
+    
+    static void printLogFilePath() {
+        try {
+            ch.qos.logback.classic.Logger rootLogger = 
+                    LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME) 
as ch.qos.logback.classic.Logger
+            def context = rootLogger.getLoggerContext()
+            
+            // Find the RollingFileAppender
+            def appender = rootLogger.getAppender("rollingFileAppender")
+            if (appender instanceof 
ch.qos.logback.core.rolling.RollingFileAppender) {
+                String logFile = appender.getFile()
+                if (logFile != null) {
+                    File file = new File(logFile)
+                    String absolutePath = file.getAbsolutePath()
+                    log.info("=" * 80)
+                    log.info("Log file: ${absolutePath}")
+                    log.info("=" * 80)
+                }
+            }
+        } catch (Exception e) {
+            log.warn("Failed to get log file path: ${e.getMessage()}")
+        }
+    }
 
     static void initGroovyEnv(Config config) {
         log.info("parallel = ${config.parallel}, suiteParallel = 
${config.suiteParallel}, actionParallel = ${config.actionParallel}")
diff --git a/run-regression-test.sh b/run-regression-test.sh
index 16256152887..ee460ba3725 100755
--- a/run-regression-test.sh
+++ b/run-regression-test.sh
@@ -36,6 +36,7 @@ Usage: $0 <shell_options> <framework_options>
      -s                                run a specified suite
      -g                                run a specified group
      -d                                run a specified directory
+     -f                                run a specified file (only when the 
file name equals the suite name; will be converted to -d and -s automatically)
      -h                                **print all framework options usage**
      -xs                               exclude the specified suite
      -xg                               exclude the specified group
@@ -51,18 +52,20 @@ Usage: $0 <shell_options> <framework_options>
      -times                            rum tests {times} times
 
   Eg.
-    $0                                        build regression test framework 
and run all suite which in default group
-    $0 --run test_select                      run a suite which named as 
test_select
-    $0 --compile                              only compile regression framework
-    $0 --run -s test_select                   run a suite which named as 
test_select
-    $0 --run test_select -genOut              generate output file for 
test_select if not exist
-    $0 --run -g default                       run all suite in the group which 
named as default
-    $0 --run -d demo,correctness/tmp          run all suite in the directories 
which named as demo and correctness/tmp
-    $0 --run -d regression-test/suites/demo   specify the suite directories 
path from repo root
-    $0 --clean                                clean output of regression test 
framework
-    $0 --clean --run test_select              clean output and build 
regression test framework and run a suite which named as test_select
-    $0 --run -h                               print framework options
-    $0 --teamcity --run test_select           print teamcity service messages 
and build regression test framework and run test_select
+    $0                                                                       
build regression test framework and run all suite which in default group
+    $0 --run test_select                                                     
run a suite which named as test_select
+    $0 --compile                                                             
only compile regression framework
+    $0 --run -s test_select                                                  
run a suite which named as test_select
+    $0 --run test_select -genOut                                             
generate output file for test_select if not exist
+    $0 --run -g default                                                      
run all suite in the group which named as default
+    $0 --run -d demo,correctness/tmp                                         
run all suite in the directories which named as demo and correctness/tmp
+    $0 --run -d regression-test/suites/demo                                  
specify the suite directories path from repo root
+    $0 --run -f regression-test/suites/demo/case.groovy                      
run a specific .groovy test file (converted to -d and -s automatically)
+    $0 --run -f regression-test/suites/demo/case.sql                         
run a specific .sql test file (converted to -d and -s automatically)
+    $0 --clean                                                               
clean output of regression test framework
+    $0 --clean --run test_select                                             
clean output and build regression test framework and run a suite which named as 
test_select
+    $0 --run -h                                                              
print framework options
+    $0 --teamcity --run test_select                                          
print teamcity service messages and build regression test framework and run 
test_select
 
 Log path: \${DORIS_HOME}/output/regression-test/log
 Default config file: \${DORIS_HOME}/regression-test/conf/regression-conf.groovy
@@ -206,6 +209,49 @@ export JAVA="${JAVA_HOME}/bin/java"
 
 REGRESSION_OPTIONS_PREFIX=''
 
+# Parse -f/--file option and convert to -d and -s
+FILE_PATH=""
+NEW_ARGS=()
+SKIP_NEXT=0
+
+for arg in "$@"; do
+    if [[ ${SKIP_NEXT} -eq 1 ]]; then
+        FILE_PATH="${arg}"
+        SKIP_NEXT=0
+        continue
+    fi
+    
+    if [[ "${arg}" == "-f" ]] || [[ "${arg}" == "--file" ]]; then
+        SKIP_NEXT=1
+        continue
+    fi
+    
+    NEW_ARGS+=("${arg}")
+done
+
+# If -f option is provided, extract directory and suite name
+if [[ -n "${FILE_PATH}" ]]; then
+    # Extract directory (parent path)
+    # e.g., "regression-test/suites/shape_check/tpch_sf1000/shape/q1.groovy" 
-> "regression-test/suites/shape_check/tpch_sf1000/shape"
+    FILE_DIR=$(dirname "${FILE_PATH}")
+    
+    # Extract suite name (filename without .groovy or .sql extension)
+    # e.g., "q1.groovy" -> "q1" or "q01.sql" -> "q01"
+    FILE_NAME=$(basename "${FILE_PATH}")
+    # Remove .groovy extension if exists
+    SUITE_NAME="${FILE_NAME%.groovy}"
+    # Remove .sql extension if exists
+    SUITE_NAME="${SUITE_NAME%.sql}"
+    
+    echo "Converted -f ${FILE_PATH} to -d ${FILE_DIR} -s ${SUITE_NAME}"
+    
+    # Add -d and -s to arguments
+    NEW_ARGS+=("-d" "${FILE_DIR}" "-s" "${SUITE_NAME}")
+fi
+
+# Reset positional parameters
+set -- "${NEW_ARGS[@]}"
+
 # contains framework options and not start with -
 # it should be suite name
 if [[ "$#" -ne 0 ]] && [[ "$1" =~ ^[^-].* ]]; then


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

Reply via email to