@@ -492,6 +492,7 @@ def __init__(self, context, path, arch, mode):
492
492
self .arch = arch
493
493
self .mode = mode
494
494
self .parallel = False
495
+ self .disable_core_files = False
495
496
self .thread_id = 0
496
497
497
498
def IsNegative (self ):
@@ -516,7 +517,8 @@ def RunCommand(self, command, env):
516
517
output = Execute (full_command ,
517
518
self .context ,
518
519
self .context .GetTimeout (self .mode ),
519
- env )
520
+ env ,
521
+ disable_core_files = self .disable_core_files )
520
522
self .Cleanup ()
521
523
return TestOutput (self ,
522
524
full_command ,
@@ -718,7 +720,7 @@ def CheckedUnlink(name):
718
720
PrintError ("os.unlink() " + str (e ))
719
721
break
720
722
721
- def Execute (args , context , timeout = None , env = {}, faketty = False ):
723
+ def Execute (args , context , timeout = None , env = {}, faketty = False , disable_core_files = False ):
722
724
if faketty :
723
725
import pty
724
726
(out_master , fd_out ) = pty .openpty ()
@@ -740,6 +742,14 @@ def Execute(args, context, timeout=None, env={}, faketty=False):
740
742
for key , value in env .iteritems ():
741
743
env_copy [key ] = value
742
744
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
+
743
753
(process , exit_code , timed_out , output ) = RunProcess (
744
754
context ,
745
755
timeout ,
@@ -749,7 +759,8 @@ def Execute(args, context, timeout=None, env={}, faketty=False):
749
759
stderr = fd_err ,
750
760
env = env_copy ,
751
761
faketty = faketty ,
752
- pty_out = pty_out
762
+ pty_out = pty_out ,
763
+ preexec_fn = preexec_fn
753
764
)
754
765
if faketty :
755
766
os .close (out_master )
@@ -1237,6 +1248,7 @@ def __init__(self, case, outcomes):
1237
1248
self .case = case
1238
1249
self .outcomes = outcomes
1239
1250
self .parallel = self .case .parallel
1251
+ self .disable_core_files = self .case .disable_core_files
1240
1252
1241
1253
1242
1254
class Configuration (object ):
0 commit comments