mutate.py: cores from OMAPHOTO_CPUS, 32 by default
This commit is contained in:
1 parent
9ed7c20681
commit
765e071c0c
1 file changed
+4
-2
+4
-2
@@ -23,13 +23,15 @@ if not os.path.isfile(os.path.join(repo, 'CMakeLists.txt')):
|
||||
sys.exit('run mutate.py from the repository root')
|
||||
original = open(args.path).read()
|
||||
targets = [t for t in args.targets.split(',') if t]
|
||||
# Cores for docker and the build, shared by parallel workers.
|
||||
cpus = os.environ.get('OMAPHOTO_CPUS', '32')
|
||||
|
||||
|
||||
def docker(command):
|
||||
uid, gid = os.getuid(), os.getgid()
|
||||
runtime = '/run/user/%d' % uid
|
||||
done = subprocess.run(
|
||||
['docker', 'run', '--rm', '--init', '--cpus=32', '-u', '%d:%d' % (uid, gid), '-e', 'HOME=/tmp', '-e', 'QT_QPA_PLATFORM=offscreen',
|
||||
['docker', 'run', '--rm', '--init', '--cpus=' + cpus, '-u', '%d:%d' % (uid, gid), '-e', 'HOME=/tmp', '-e', 'QT_QPA_PLATFORM=offscreen',
|
||||
'--tmpfs', '%s:uid=%d,gid=%d,mode=0700' % (runtime, uid, gid), '-e', 'XDG_RUNTIME_DIR=' + runtime,
|
||||
'-v', '%s:%s' % (repo, repo), '-w', repo, 'omaphoto-dev', 'timeout', '600', 'sh', '-c', command],
|
||||
capture_output=True, text=True)
|
||||
@@ -38,7 +40,7 @@ def docker(command):
|
||||
|
||||
def build():
|
||||
wanted = ' --target ' + ' '.join(targets) if targets else ''
|
||||
return docker('cmake -S . -B build -G Ninja -DOMAPHOTO_WERROR=ON >/dev/null && cmake --build build -j32' + wanted)
|
||||
return docker('cmake -S . -B build -G Ninja -DOMAPHOTO_WERROR=ON >/dev/null && cmake --build build -j' + cpus + wanted)
|
||||
|
||||
|
||||
def test():
|
||||
|
||||
Reference in new issue
Block a user