Skip to content

Commit f89ef77

Browse files
TrottMylesBorins
authored andcommitted
test: run abort tests
Currently, tests in test/abort do not run in CI. This change configures the test runner to not write core files for abort tests and to run them. PR-URL: #14013 Fixes: #14012 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
1 parent a91a3fe commit f89ef77

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ test-all-valgrind: test-build
333333
$(PYTHON) tools/test.py --mode=debug,release --valgrind
334334

335335
CI_NATIVE_SUITES := addons addons-napi
336-
CI_JS_SUITES := async-hooks doctool inspector known_issues message parallel pseudo-tty sequential
336+
CI_JS_SUITES := abort async-hooks doctool inspector known_issues message parallel pseudo-tty sequential
337337

338338
# Build and test addons without building anything else
339339
test-ci-native: LOGLEVEL := info

test/abort/testcfg.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
import testpy
44

55
def GetConfiguration(context, root):
6-
return testpy.SimpleTestConfiguration(context, root, 'abort')
6+
return testpy.AbortTestConfiguration(context, root, 'abort')

test/testpy/__init__.py

+12
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,15 @@ def ListTests(self, current_path, path, arch, mode):
180180
for test in result:
181181
test.parallel = True
182182
return result
183+
184+
class AbortTestConfiguration(SimpleTestConfiguration):
185+
def __init__(self, context, root, section, additional=None):
186+
super(AbortTestConfiguration, self).__init__(context, root, section,
187+
additional)
188+
189+
def ListTests(self, current_path, path, arch, mode):
190+
result = super(AbortTestConfiguration, self).ListTests(
191+
current_path, path, arch, mode)
192+
for test in result:
193+
test.disable_core_files = True
194+
return result

tools/test.py

+15-3
Original file line numberDiff line numberDiff line change
@@ -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

12421254
class Configuration(object):

0 commit comments

Comments
 (0)