summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Luca Farsi <lucafarsi@google.com> 2024-07-23 16:34:27 -0700
committer Luca Farsi <lucafarsi@google.com> 2024-07-24 15:12:55 -0700
commit2eaa5d0bb0dd9fee928dc3750f5ac5cc86445f24 (patch)
tree42ea2ecc65902cc5be3c94b8c5c4f172b3efc75f
parent8afaf50fafbd2fa2ca79f5b58c75fedc038e61d1 (diff)
Properly log in build_test_suites.py
Set up logging properly in build_test_suites.py so that the log file is directed to the dist dir (and /tmp if it is not defined) Test: atest build_test_suites_test Bug: 355074139 Change-Id: I16ce644f1c717179377c8ca68c74d9af5f2e61df
-rw-r--r--ci/build_test_suites.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/ci/build_test_suites.py b/ci/build_test_suites.py
index 6e1f88c36c..ac5023f316 100644
--- a/ci/build_test_suites.py
+++ b/ci/build_test_suites.py
@@ -28,6 +28,7 @@ import optimized_targets
REQUIRED_ENV_VARS = frozenset(['TARGET_PRODUCT', 'TARGET_RELEASE', 'TOP'])
SOONG_UI_EXE_REL_PATH = 'build/soong/soong_ui.bash'
+LOG_PATH = 'logs/build_test_suites.log'
class Error(Exception):
@@ -181,4 +182,12 @@ def run_command(args: list[str], stdout=None):
def main(argv):
+ dist_dir = os.environ.get('DIST_DIR')
+ if dist_dir:
+ log_file = pathlib.Path(dist_dir) / LOG_PATH
+ logging.basicConfig(
+ level=logging.DEBUG,
+ format='%(asctime)s %(levelname)s %(message)s',
+ filename=log_file,
+ )
sys.exit(build_test_suites(argv))