[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:16:32 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/4] 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/4] 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):
>From 13a86f1060c84e82bfbb925e16f5985907b29dd0 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Sun, 19 May 2024 17:12:45 +0300
Subject: [PATCH 3/4] Fix indentation
---
llvm/utils/lit/lit/main.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py
index 91e9d2310e52f..ee991f5360a4d 100755
--- a/llvm/utils/lit/lit/main.py
+++ b/llvm/utils/lit/lit/main.py
@@ -293,7 +293,7 @@ def run_tests(tests, lit_config, opts, discovered_tests):
print("Endill 380")
display.clear(interrupted)
- print("Endill 390")
+ print("Endill 390")
if error:
sys.stderr.write("%s, skipping remaining tests\n" % error)
print("Endill 3100")
>From 34619d6b865645e30af729aed03ff2d35a974062 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Sun, 19 May 2024 17:16:15 +0300
Subject: [PATCH 4/4] Add even more tracing
---
llvm/utils/lit/lit/main.py | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py
index ee991f5360a4d..09354b3092d8a 100755
--- a/llvm/utils/lit/lit/main.py
+++ b/llvm/utils/lit/lit/main.py
@@ -300,6 +300,7 @@ def run_tests(tests, lit_config, opts, discovered_tests):
def execute_in_tmp_dir(run, lit_config):
+ print("Endill 3600")
# Create a temp directory inside the normal temp directory so that we can
# try to avoid temporary test file leaks. The user can avoid this behavior
# by setting LIT_PRESERVES_TMP in the environment, so they can easily use
@@ -308,26 +309,36 @@ def execute_in_tmp_dir(run, lit_config):
tmp_dir = None
if "LIT_PRESERVES_TMP" not in os.environ:
import tempfile
-
+ print("Endill 3610")
# z/OS linker does not support '_' in paths, so use '-'.
tmp_dir = tempfile.mkdtemp(prefix="lit-tmp-")
+ print("Endill 3620")
tmp_dir_envs = {k: tmp_dir for k in ["TMP", "TMPDIR", "TEMP", "TEMPDIR"]}
os.environ.update(tmp_dir_envs)
+ print("Endill 3630")
for cfg in {t.config for t in run.tests}:
cfg.environment.update(tmp_dir_envs)
+ print("Endill 3640")
try:
+ print("Endill 3650")
run.execute()
+ print("Endill 3660")
finally:
+ print("Endill 3670")
if tmp_dir:
try:
+ print("Endill 3680")
import shutil
-
+ print("Endill 3690")
shutil.rmtree(tmp_dir)
+ print("Endill 36100")
except Exception as e:
+ print("Endill 36110")
lit_config.warning(
"Failed to delete temp directory '%s', try upgrading your version of Python to fix this"
% tmp_dir
)
+ print("Endill 36120")
def print_histogram(tests):
More information about the llvm-commits
mailing list