Skip to content
This repository has been archived by the owner on Aug 31, 2018. It is now read-only.

Commit

Permalink
test: run abort tests
Browse files Browse the repository at this point in the history
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: nodejs/node#14013
Fixes: nodejs/node#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]>
  • Loading branch information
Trott authored and Olivia Hugger committed Aug 30, 2017
1 parent 7c46145 commit c4ac579
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ test-all-valgrind: test-build
$(PYTHON) tools/test.py --mode=debug,release --valgrind

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

# Build and test addons without building anything else
test-ci-native: LOGLEVEL := info
Expand Down
2 changes: 1 addition & 1 deletion test/abort/testcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
import testpy

def GetConfiguration(context, root):
return testpy.SimpleTestConfiguration(context, root, 'abort')
return testpy.AbortTestConfiguration(context, root, 'abort')
12 changes: 12 additions & 0 deletions test/testpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,15 @@ def ListTests(self, current_path, path, arch, mode):
for test in result:
test.parallel = True
return result

class AbortTestConfiguration(SimpleTestConfiguration):
def __init__(self, context, root, section, additional=None):
super(AbortTestConfiguration, self).__init__(context, root, section,
additional)

def ListTests(self, current_path, path, arch, mode):
result = super(AbortTestConfiguration, self).ListTests(
current_path, path, arch, mode)
for test in result:
test.disable_core_files = True
return result
18 changes: 15 additions & 3 deletions tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ def __init__(self, context, path, arch, mode):
self.arch = arch
self.mode = mode
self.parallel = False
self.disable_core_files = False
self.thread_id = 0

def IsNegative(self):
Expand All @@ -516,7 +517,8 @@ def RunCommand(self, command, env):
output = Execute(full_command,
self.context,
self.context.GetTimeout(self.mode),
env)
env,
disable_core_files = self.disable_core_files)
self.Cleanup()
return TestOutput(self,
full_command,
Expand Down Expand Up @@ -718,7 +720,7 @@ def CheckedUnlink(name):
PrintError("os.unlink() " + str(e))
break

def Execute(args, context, timeout=None, env={}, faketty=False):
def Execute(args, context, timeout=None, env={}, faketty=False, disable_core_files=False):
if faketty:
import pty
(out_master, fd_out) = pty.openpty()
Expand All @@ -740,6 +742,14 @@ def Execute(args, context, timeout=None, env={}, faketty=False):
for key, value in env.iteritems():
env_copy[key] = value

preexec_fn = None

if disable_core_files and not utils.IsWindows():
def disableCoreFiles():
import resource
resource.setrlimit(resource.RLIMIT_CORE, (0,0))
preexec_fn = disableCoreFiles

(process, exit_code, timed_out, output) = RunProcess(
context,
timeout,
Expand All @@ -749,7 +759,8 @@ def Execute(args, context, timeout=None, env={}, faketty=False):
stderr = fd_err,
env = env_copy,
faketty = faketty,
pty_out = pty_out
pty_out = pty_out,
preexec_fn = preexec_fn
)
if faketty:
os.close(out_master)
Expand Down Expand Up @@ -1237,6 +1248,7 @@ def __init__(self, case, outcomes):
self.case = case
self.outcomes = outcomes
self.parallel = self.case.parallel
self.disable_core_files = self.case.disable_core_files


class Configuration(object):
Expand Down

0 comments on commit c4ac579

Please sign in to comment.