Bug 1072024 - Disable sandbox during gtests on linux - r=ted

This commit is contained in:
Edwin Flores 2014-10-14 11:04:59 +13:00
parent a5e4958fd0
commit 6ac0bb3765
2 changed files with 20 additions and 1 deletions

View File

@ -74,6 +74,14 @@ class GTests(object):
env["MOZ_RUN_GTEST"] = "1"
# Normally we run with GTest default output, override this to use the TBPL test format.
env["MOZ_TBPL_PARSER"] = "1"
if not mozinfo.has_sandbox:
# Bug 1082193 - This is horrible. Our linux build boxes run CentOS 6,
# which is too old to support sandboxing. Disable sandbox for gtests
# on machines which don't support sandboxing until they can be
# upgraded, or gtests are run on test machines instead.
env["MOZ_DISABLE_GMP_SANDBOX"] = "1"
return env
def build_environment(self):

View File

@ -8,6 +8,8 @@
# linux) to the information; I certainly wouldn't want anyone parsing this
# information and having behaviour depend on it
import ctypes
import errno
import json
import os
import platform
@ -32,7 +34,8 @@ info = {'os': unknown,
'processor': unknown,
'version': unknown,
'os_version': unknown,
'bits': unknown }
'bits': unknown,
'has_sandbox': unknown }
(system, node, release, version, machine, processor) = platform.uname()
(bits, linkage) = platform.architecture()
@ -93,6 +96,14 @@ info.update({'processor': processor,
'bits': int(bits),
})
if info['os'] == 'linux':
PR_SET_SECCOMP = 22
SECCOMP_MODE_FILTER = 2
ctypes.CDLL("libc.so.6", use_errno=True).prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, 0)
info['has_sandbox'] = ctypes.get_errno() == errno.EFAULT
else:
info['has_sandbox'] = True
# standard value of choices, for easy inspection
choices = {'os': ['linux', 'bsd', 'win', 'mac', 'unix'],
'bits': [32, 64],