From 595eb19165b3f027eb4056e991c93ebccb3cf807 Mon Sep 17 00:00:00 2001 From: Edward Lemur Date: Thu, 12 Mar 2020 21:53:52 +0000 Subject: [PATCH] PRESUBMIT.py: Add timeout to tests. Interrupt tests after 3 min, so that failures can be surfaced before the presubmit step gets interrupted on the bot. Change-Id: Ia0efebaac5a0c5072b974a4fbbcb14fe672017ca Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2098942 Reviewed-by: Anthony Polito Commit-Queue: Edward Lesmes --- PRESUBMIT.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 0c9b71edab..7d0e795035 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -10,6 +10,7 @@ details on the presubmit API built into depot_tools. import fnmatch import os +import sys # CIPD ensure manifest for checking CIPD client itself. @@ -24,6 +25,13 @@ $VerifiedPlatform linux-mips64 linux-mips64le linux-mipsle %s %s ''' +# Timeout for a test to be executed. +TEST_TIMEOUT_S = 180 # 3m +# Tests take longer on Windows. +if sys.platform.startswith('win'): + TEST_TIMEOUT_S = 330 # 5m 30s + + def DepotToolsPylint(input_api, output_api): """Gather all the pylint logic into one place to make it self-contained.""" @@ -57,6 +65,8 @@ def DepotToolsPylint(input_api, output_api): def CommonChecks(input_api, output_api, tests_to_black_list, run_on_python3): + input_api.SetTimeout(TEST_TIMEOUT_S) + results = [] results.extend(input_api.canned_checks.CheckOwners(input_api, output_api)) results.extend(input_api.canned_checks.CheckOwnersFormat(