@@ -492,6 +492,7 @@ def __init__(self, context, path, arch, mode):
492492 self .arch = arch
493493 self .mode = mode
494494 self .parallel = False
495+ self .disable_core_files = False
495496 self .thread_id = 0
496497
497498 def IsNegative (self ):
@@ -516,7 +517,8 @@ def RunCommand(self, command, env):
516517 output = Execute (full_command ,
517518 self .context ,
518519 self .context .GetTimeout (self .mode ),
519- env )
520+ env ,
521+ disable_core_files = self .disable_core_files )
520522 self .Cleanup ()
521523 return TestOutput (self ,
522524 full_command ,
@@ -718,7 +720,7 @@ def CheckedUnlink(name):
718720 PrintError ("os.unlink() " + str (e ))
719721 break
720722
721- def Execute (args , context , timeout = None , env = {}, faketty = False ):
723+ def Execute (args , context , timeout = None , env = {}, faketty = False , disable_core_files = False ):
722724 if faketty :
723725 import pty
724726 (out_master , fd_out ) = pty .openpty ()
@@ -740,6 +742,14 @@ def Execute(args, context, timeout=None, env={}, faketty=False):
740742 for key , value in env .iteritems ():
741743 env_copy [key ] = value
742744
745+ preexec_fn = None
746+
747+ if disable_core_files and not utils .IsWindows ():
748+ def disableCoreFiles ():
749+ import resource
750+ resource .setrlimit (resource .RLIMIT_CORE , (0 ,0 ))
751+ preexec_fn = disableCoreFiles
752+
743753 (process , exit_code , timed_out , output ) = RunProcess (
744754 context ,
745755 timeout ,
@@ -749,7 +759,8 @@ def Execute(args, context, timeout=None, env={}, faketty=False):
749759 stderr = fd_err ,
750760 env = env_copy ,
751761 faketty = faketty ,
752- pty_out = pty_out
762+ pty_out = pty_out ,
763+ preexec_fn = preexec_fn
753764 )
754765 if faketty :
755766 os .close (out_master )
@@ -1237,6 +1248,7 @@ def __init__(self, case, outcomes):
12371248 self .case = case
12381249 self .outcomes = outcomes
12391250 self .parallel = self .case .parallel
1251+ self .disable_core_files = self .case .disable_core_files
12401252
12411253
12421254class Configuration (object ):
0 commit comments