Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add print statements to lit for tracing purposes #92694

Closed
wants to merge 51 commits into from

Conversation

Endilll
Copy link
Contributor

@Endilll Endilll commented May 19, 2024

No description provided.

Copy link

github-actions bot commented May 19, 2024

⚠️ Python code formatter, darker found issues in your code. ⚠️

You can test this locally with the following command:
darker --check --diff -r 9940620f6eab50deeaed0d976b2ea0afd007ba24...cf7cb36fef7911295c791aa3f5acfc358b44f7e8 flang/test/SemanticsChecked/common.py flang/test/SemanticsChecked/test_errors.py flang/test/SemanticsChecked/test_modfile.py flang/test/SemanticsChecked/test_symbols.py flang/test/lit.cfg.py llvm/utils/lit/lit/TestRunner.py llvm/utils/lit/lit/formats/googletest.py llvm/utils/lit/lit/formats/shtest.py llvm/utils/lit/lit/main.py llvm/utils/lit/lit/run.py llvm/utils/lit/lit/worker.py
View the diff from darker here.
--- llvm/utils/lit/lit/TestRunner.py	2024-05-20 00:20:46.000000 +0000
+++ llvm/utils/lit/lit/TestRunner.py	2024-05-20 05:47:02.614118 +0000
@@ -2299,6 +2299,6 @@
     )
     print("Endill executeShTest 9 {}".format(test.path_in_suite))
     r = _runShTest(test, litConfig, useExternalSh, script, tmpBase)
     print("Endill executeShTest 10 {}".format(test.path_in_suite))
 
-    return r 
+    return r
--- llvm/utils/lit/lit/formats/googletest.py	2024-05-19 17:27:31.000000 +0000
+++ llvm/utils/lit/lit/formats/googletest.py	2024-05-20 05:47:02.806566 +0000
@@ -144,10 +144,11 @@
         if test.gtest_json_file is None:
             return lit.Test.FAIL, ""
 
         testPath = test.getSourcePath()
         from lit.cl_arguments import TestOrder
+
         print("Endill gt-1")
         use_shuffle = TestOrder(litConfig.order) == TestOrder.RANDOM
         shard_env = {
             "GTEST_OUTPUT": "json:" + test.gtest_json_file,
             "GTEST_SHUFFLE": "1" if use_shuffle else "0",
--- llvm/utils/lit/lit/main.py	2024-05-19 20:32:26.000000 +0000
+++ llvm/utils/lit/lit/main.py	2024-05-20 05:47:02.956469 +0000
@@ -158,11 +158,11 @@
     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)
 
@@ -308,10 +308,11 @@
     # their own temp directory to monitor temporary file leaks or handle them at
     # the buildbot level.
     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"]}
@@ -328,15 +329,16 @@
         print("Endill 3670")
         if tmp_dir:
             try:
                 print("Endill 3680")
                 import shutil
-                print("Endill 3690") 
+
+                print("Endill 3690")
                 shutil.rmtree(tmp_dir)
-                print("Endill 36100") 
+                print("Endill 36100")
             except Exception as e:
-                print("Endill 36110") 
+                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")
--- llvm/utils/lit/lit/run.py	2024-05-19 20:58:30.000000 +0000
+++ llvm/utils/lit/lit/run.py	2024-05-20 05:47:03.039147 +0000
@@ -65,11 +65,10 @@
             print("Endill 36540")
             for test in self.tests:
                 if test.result is None:
                     test.setResult(skipped)
             print("Endill 36560")
-            
 
     def _execute(self, deadline):
         print("Endill 365100")
         self._increase_process_limit()
         print("Endill 365110")
@@ -86,17 +85,19 @@
         )
         print("Endill 365130")
 
         def debug_callback(arg):
             print("Endill: debug_callback test.file_path: {}".format(arg.file_path))
-            print("Endill: debug_callback test.path_in_suite: {}".format(arg.path_in_suite))
+            print(
+                "Endill: debug_callback test.path_in_suite: {}".format(
+                    arg.path_in_suite
+                )
+            )
             self.progress_callback(arg)
 
         async_results = [
-            pool.apply_async(
-                lit.worker.execute, args=[test], callback=debug_callback
-            )
+            pool.apply_async(lit.worker.execute, args=[test], callback=debug_callback)
             for test in self.tests
         ]
         print("Endill 365140")
         pool.close()
         print("Endill 365150")
@@ -121,12 +122,18 @@
         for idx, ar in enumerate(async_results):
             print("Endill 3651610")
             try:
                 print("Endill 3651620")
                 print("Endill: idx: {}".format(idx))
-                print("Endill: tests[idx].file_path: {}".format(self.tests[idx].file_path))
-                print("Endill: tests[idx].path_in_suite: {}".format(self.tests[idx].path_in_suite))
+                print(
+                    "Endill: tests[idx].file_path: {}".format(self.tests[idx].file_path)
+                )
+                print(
+                    "Endill: tests[idx].path_in_suite: {}".format(
+                        self.tests[idx].path_in_suite
+                    )
+                )
                 test = ar.get(timeout)
                 print("Endill 3651630")
                 print("Endill: test.file_path: {}".format(test.file_path))
                 print("Endill: test.path_in_suite: {}".format(test.path_in_suite))
                 print("Endill 3651635")
@@ -139,11 +146,11 @@
                 print("Endill 3651660")
                 if test.isFailure():
                     self.failures += 1
                     if self.failures == self.max_failures:
                         raise MaxFailuresError()
-        print("Endill 3651670") 
+        print("Endill 3651670")
 
     # Update local test object "in place" from remote test object.  This
     # ensures that the original test object which is used for printing test
     # results reflects the changes.
     def _update_test(self, local_test, remote_test):
--- llvm/utils/lit/lit/worker.py	2024-05-20 00:20:46.000000 +0000
+++ llvm/utils/lit/lit/worker.py	2024-05-20 05:47:03.085853 +0000
@@ -63,11 +63,15 @@
     pg = test.config.parallelism_group
     if callable(pg):
         print("Endill: worker 1-2 {}".format(test.path_in_suite))
         pg = pg(test)
         print("Endill: worker 1-3 {}".format(test.path_in_suite))
-    print("Endill: pg in _parallelism_semaphores: {}".format(pg in _parallelism_semaphores))
+    print(
+        "Endill: pg in _parallelism_semaphores: {}".format(
+            pg in _parallelism_semaphores
+        )
+    )
     return _parallelism_semaphores.get(pg, NopSemaphore())
 
 
 # Do not inline! Directly used by LitTestCase.py
 def _execute(test, lit_config):
@@ -100,11 +104,10 @@
         output = "Exception during script execution:\n"
         output += traceback.format_exc()
         output += "\n"
         print("Endill: worker 2-2-5 {}".format(test.path_in_suite))
         return lit.Test.Result(lit.Test.UNRESOLVED, output)
-    
 
 
 # Support deprecated result from execute() which returned the result
 # code and additional output as a tuple.
 def _adapt_result(result):

Copy link

github-actions bot commented May 19, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@@ -147,6 +147,11 @@ function exclude-windows() {
libc) ;; # no Windows support
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Re: line 126]

Test comment from graphite.dev

See this comment inline on Graphite.

@@ -147,6 +147,11 @@ function exclude-windows() {
libc) ;; # no Windows support
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Re: line 108]

Test review comment from graphite.dev

See this comment inline on Graphite.

@Endilll
Copy link
Contributor Author

Endilll commented May 29, 2024

The underlying issue was fixed in #93295

@Endilll Endilll closed this May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant