Patchwork D8316: testlib: adjust wait-on-file timeout according to the global test timeout

login
register
mail settings
Submitter phabricator
Date April 1, 2020, 3:22 p.m.
Message ID <051e9645cc7a20a7c84c531556f91e1f@localhost.localdomain>
Download mbox | patch
Permalink /patch/45963/
State Not Applicable
Headers show

Comments

phabricator - April 1, 2020, 3:22 p.m.
Closed by commit rHG82543879b48e: testlib: adjust wait-on-file timeout according to the global test timeout (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8316?vs=20896&id=20931

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8316/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8316

AFFECTED FILES
  tests/run-tests.py
  tests/testlib/wait-on-file

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/testlib/wait-on-file b/tests/testlib/wait-on-file
--- a/tests/testlib/wait-on-file
+++ b/tests/testlib/wait-on-file
@@ -10,6 +10,12 @@ 
 fi
 
 timer="$1"
+
+# if the test timeout have been extended, explicitly extend the provided timer
+if [ "$HGTEST_TIMEOUT_DEFAULT" -lt "$HGTEST_TIMEOUT" ]; then
+    timer=$(( ("$timer" * "$HGTEST_TIMEOUT") / $HGTEST_TIMEOUT_DEFAULT ))
+fi
+
 wait_on="$2"
 create=""
 if [ $# -eq 3 ]; then
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -321,7 +321,7 @@ 
 if 'java' in sys.platform:
     IMPL_PATH = b'JYTHONPATH'
 
-defaults = {
+default_defaults = {
     'jobs': ('HGTEST_JOBS', multiprocessing.cpu_count()),
     'timeout': ('HGTEST_TIMEOUT', 180),
     'slowtimeout': ('HGTEST_SLOWTIMEOUT', 1500),
@@ -329,6 +329,8 @@ 
     'shell': ('HGTEST_SHELL', 'sh'),
 }
 
+defaults = default_defaults.copy()
+
 
 def canonpath(path):
     return os.path.realpath(os.path.expanduser(path))
@@ -1327,6 +1329,9 @@ 
         env['TESTTMP'] = _bytes2sys(self._testtmp)
         env['TESTNAME'] = self.name
         env['HOME'] = _bytes2sys(self._testtmp)
+        formated_timeout = _bytes2sys(b"%d" % default_defaults['timeout'][1])
+        env['HGTEST_TIMEOUT_DEFAULT'] = formated_timeout
+        env['HGTEST_TIMEOUT'] = _bytes2sys(b"%d" % self._timeout)
         # This number should match portneeded in _getport
         for port in xrange(3):
             # This list should be parallel to _portmap in _getreplacements