[IMP] runbot: increase cpu_limit

When the Odoo instances are spawned for tests, they have a time limit
set on their CPU usage. This limit is hard-coded in the _spawn method
calls.

As the number of tests are increasing, their duration increases too.
As this limit is inherited by subprocesses, if a phantomjs test
last too long, the test is killed alone.

Finally, when the coverage is enabled, the tests duration is
approximately increased of 1.5 times.

With this commit, the cpu_limit of the two main tests jobs are
increased. When the coverage is used, the cpu_limit is increased.

Closes: #23
This commit is contained in:
Christophe Monniez 2018-06-11 17:58:29 +02:00 committed by GitHub
parent 806ae08460
commit a3da5cad04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -756,10 +756,11 @@ class runbot_build(models.Model):
cmd += ['-d', '%s-base' % build.dest, '-i', 'base', '--stop-after-init', '--log-level=test', '--max-cron-threads=0']
if build.extra_params:
cmd.extend(shlex.split(build.extra_params))
return self._spawn(cmd, lock_path, log_path, cpu_limit=300)
return self._spawn(cmd, lock_path, log_path, cpu_limit=600)
def _job_20_test_all(self, build, lock_path, log_path):
build._log('test_all', 'Start test all modules')
cpu_limit = 2400
self._local_pg_createdb("%s-all" % build.dest)
cmd, mods = build._cmd()
if grep(build._server("tools/config.py"), "test-enable"):
@ -769,6 +770,7 @@ class runbot_build(models.Model):
cmd.extend(build.extra_params.split(' '))
env = None
if build.coverage:
cpu_limit *= 1.5
pyversion = get_py_version(build)
env = self._coverage_env(build)
available_modules = [
@ -781,7 +783,7 @@ class runbot_build(models.Model):
cmd = [pyversion, '-m', 'coverage', 'run', '--branch', '--source', build._server()] + omit + cmd[:]
# reset job_start to an accurate job_20 job_time
build.write({'job_start': now()})
return self._spawn(cmd, lock_path, log_path, cpu_limit=2100, env=env)
return self._spawn(cmd, lock_path, log_path, cpu_limit=cpu_limit, env=env)
def _coverage_env(self, build):
return dict(os.environ, COVERAGE_FILE=build._path('.coverage'))