From 6df1aef2781fcc8baed9ad3820e64bd2f0c51e85 Mon Sep 17 00:00:00 2001 From: Al Muthanna Athamina Date: Wed, 27 Apr 2022 10:38:35 +0200 Subject: [PATCH] Add prefix to cctests when listed to make retrieving them more robust Bug: v8:12802 Change-Id: I4e12edc71ce110f603026f2b9a446af8965f9510 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3598887 Reviewed-by: Michael Achenbach Commit-Queue: Almothana Athamneh Cr-Commit-Position: refs/heads/main@{#80208} --- test/cctest/cctest.cc | 5 ++++- test/cctest/testcfg.py | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/test/cctest/cctest.cc b/test/cctest/cctest.cc index 5a0895b457..a037162b94 100644 --- a/test/cctest/cctest.cc +++ b/test/cctest/cctest.cc @@ -336,9 +336,12 @@ i::Handle Optimize( } static void PrintTestList() { + int test_num = 0; for (const auto& entry : g_cctests.Get()) { - printf("%s\n", entry.first.c_str()); + printf("**>Test: %s\n", entry.first.c_str()); + test_num++; } + printf("\nTotal number of tests: %d\n", test_num); } int main(int argc, char* argv[]) { diff --git a/test/cctest/testcfg.py b/test/cctest/testcfg.py index 90cfd2eb3a..e173c9496f 100644 --- a/test/cctest/testcfg.py +++ b/test/cctest/testcfg.py @@ -56,10 +56,20 @@ class TestLoader(testsuite.TestLoader): print(output.stderr) return [] - filtered_output = [ - test for test in output.stdout.strip().split() - if test.startswith('test-') - ] + filtered_output = [] + test_prefix = '**>Test: ' + test_total_prefix = 'Total number of tests: ' + tests_total = 0 + + for line in output.stdout.strip().splitlines(): + if line.startswith(test_prefix): + filtered_output.append(line[len(test_prefix):]) + if line.startswith(test_total_prefix): + tests_total = int(line[len(test_total_prefix):]) + + assert (len(filtered_output) > 0) + assert (len(filtered_output) == tests_total) + return sorted(filtered_output)