Эх сурвалжийг харах

android: Allow anonymous pipes for benchmarking

In a typical scenario we would not want to run the build server if
autoninja is run as part of a script (see https://crrev.com/c/6278629),
but specifically for benchmarking, we want to allow callers who
explicitly set AUTONINJA_STDOUT_NAME to still run the build server, as
these callers need the build server to run to properly time and
benchmark, even if all the output is discarded.

R=agrieve@chromium.org

Bug: 393136861
Change-Id: I97f556c2238eacc5cc8240287f4c6da0160efb71
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6499328
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Peter Wen <wnwen@chromium.org>
Auto-Submit: Peter Wen <wnwen@chromium.org>
wnwen@chromium.org 3 сар өмнө
parent
commit
d6a7a6bd9c

+ 4 - 0
android_build_server_helper.py

@@ -51,6 +51,10 @@ def _start_server(local_dev_server_path):
 
 
 def _set_tty_env():
+    # If the caller explicitly set this environment variable, just use it
+    # instead of failing.
+    if "AUTONINJA_STDOUT_NAME" in os.environ:
+        return True
     stdout_name = os.readlink('/proc/self/fd/1')
     # Anonymous pipes can't be opened. These look like "pipe:[394765110]".
     ret = os.path.exists(stdout_name)