From 6cfc687dac706473a543fb241300c08dcae26d90 Mon Sep 17 00:00:00 2001 From: j30049513 Date: Tue, 26 Sep 2023 11:10:01 +0800 Subject: [PATCH] =?UTF-8?q?fastcheck=E5=A2=9E=E5=8A=A0=E8=BF=9B=E5=BA=A6?= =?UTF-8?q?=E6=9D=A1=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/regress/pg_regress.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/test/regress/pg_regress.cpp b/src/test/regress/pg_regress.cpp index 34b0c7e26..7ede9947b 100644 --- a/src/test/regress/pg_regress.cpp +++ b/src/test/regress/pg_regress.cpp @@ -4712,6 +4712,24 @@ static int regrReloadAndParseLineBuffer(bool* pbBuffReloadReq, bool* pbHalfReadT return iRet; } +static int countTestLines(const char* filename){ + char command[1024]; + snprintf(command, sizeof(command), "grep -c '^test:' %s", filename); + + FILE *f = popen(command, "r"); + if(f == NULL){ + fprintf(stderr, "Failed to execute command.\n"); + return -1; + } + + char result[10]; + fgets(result, sizeof(result), f); + pclose(f); + + int count = atoi((result)); + return count; +} + /* * Run all the tests specified in one schedule file */ @@ -4734,6 +4752,8 @@ static void run_schedule(const char* schedule, test_function tfunc, diag_functio bool bIgnoreLineOnReload = false; bool isSystemTableDDL = false; bool isPlanAndProto = false; + int all_test_lines = 0; + int done_test_lines = 0; if (grayscale_upgrade != -1) { g_uiTotalBuf = 0; } @@ -4776,6 +4796,7 @@ static void run_schedule(const char* schedule, test_function tfunc, diag_functio /* Initializing the "total time taken by the test suite execution" */ g_dGroupTotalTime = 0; + all_test_lines = countTestLines(schedule); scf = fopen(schedule, "r"); if (!scf) { fprintf(stderr, _("%s: could not open file \"%s\" for reading: %s\n"), progname, schedule, gs_strerror(errno)); @@ -4950,7 +4971,7 @@ static void run_schedule(const char* schedule, test_function tfunc, diag_functio } else if (use_jdbc_client) { status(_("jdbc test %-24s .... "), tests[0]); } else { - status(_("test %-24s .... "), tests[0]); + status(_("test(%d/%d) %-24s .... "), ++done_test_lines, all_test_lines, tests[0]); } makeNestedDirectory(tests[0]); @@ -5079,7 +5100,7 @@ static void run_schedule(const char* schedule, test_function tfunc, diag_functio } else if (isPlanAndProto) { status(_("parallel group (%d plan_proto_tests): "), num_tests); } else { - status(_("parallel group (%d tests): "), num_tests); + status(_("parallel group (%d tests)(%d/%d): "), num_tests, ++done_test_lines, all_test_lines); } wait_for_tests(pids, statuses, tests, num_tests);