[llvm] Add print statements to lit for tracing purposes (PR #92694)

Vlad Serebrennikov via llvm-commits llvm-commits at lists.llvm.org
Sun May 19 07:12:29 PDT 2024


https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/92694

>From 2d419dd0910260272fea457beb59414798ee2594 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Sun, 19 May 2024 15:54:44 +0300
Subject: [PATCH 1/2] Add print statements to lit for tracing purposes

---
 llvm/utils/lit/lit/main.py | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py
index db9f24f748d9e..288558b90b77a 100755
--- a/llvm/utils/lit/lit/main.py
+++ b/llvm/utils/lit/lit/main.py
@@ -118,34 +118,56 @@ def main(builtin_params={}):
 
     mark_xfail(discovered_tests, opts)
 
+    print("Endill 10")
+
     mark_excluded(discovered_tests, selected_tests)
 
+    print("Endill 20")
+
     start = time.time()
+    print("Endill 30")
     run_tests(selected_tests, lit_config, opts, len(discovered_tests))
+    print("Endill 40")
     elapsed = time.time() - start
 
+    print("Endill 50")
+
     record_test_times(selected_tests, lit_config)
 
+    print("Endill 60")
+
     selected_tests, discovered_tests = GoogleTest.post_process_shard_results(
         selected_tests, discovered_tests
     )
 
+    print("Endill 70")
+
     if opts.time_tests:
         print_histogram(discovered_tests)
 
+    print("Endill 80")
+
     print_results(discovered_tests, elapsed, opts)
 
+    print("Endill 90")
+
     tests_for_report = selected_tests if opts.shard else discovered_tests
     for report in opts.reports:
         report.write_results(tests_for_report, elapsed)
 
+    print("Endill 100")
+
     if lit_config.numErrors:
         sys.stderr.write("\n%d error(s) in tests\n" % lit_config.numErrors)
         sys.exit(2)
+    
+    print("Endill 110")
 
     if lit_config.numWarnings:
         sys.stderr.write("\n%d warning(s) in tests\n" % lit_config.numWarnings)
 
+    print("Endill 120")
+
     has_failure = any(t.isFailure() for t in discovered_tests)
     if has_failure:
         if opts.ignoreFail:

>From 7edeaee2dfa50586406f27609bbd55d75e590aef Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Sun, 19 May 2024 17:12:16 +0300
Subject: [PATCH 2/2] Add more tracing

---
 llvm/utils/lit/lit/main.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py
index 288558b90b77a..91e9d2310e52f 100755
--- a/llvm/utils/lit/lit/main.py
+++ b/llvm/utils/lit/lit/main.py
@@ -266,19 +266,23 @@ def mark_excluded(discovered_tests, selected_tests):
 
 
 def run_tests(tests, lit_config, opts, discovered_tests):
+    print("Endill 310")
     workers = min(len(tests), opts.workers)
+    print("Endill 320")
     display = lit.display.create_display(opts, tests, discovered_tests, workers)
-
+    print("Endill 330")
     run = lit.run.Run(
         tests, lit_config, workers, display.update, opts.max_failures, opts.timeout
     )
-
+    print("Endill 340")
     display.print_header()
-
+    print("Endill 350")
     interrupted = False
     error = None
     try:
+        print("Endill 360")
         execute_in_tmp_dir(run, lit_config)
+        print("Endill 370")
     except KeyboardInterrupt:
         interrupted = True
         error = "  interrupted by user"
@@ -286,10 +290,13 @@ def run_tests(tests, lit_config, opts, discovered_tests):
         error = "warning: reached maximum number of test failures"
     except lit.run.TimeoutError:
         error = "warning: reached timeout"
+    print("Endill 380")
 
     display.clear(interrupted)
+        print("Endill 390")
     if error:
         sys.stderr.write("%s, skipping remaining tests\n" % error)
+    print("Endill 3100")
 
 
 def execute_in_tmp_dir(run, lit_config):



More information about the llvm-commits mailing list