Skip to content

Commit 32e1f9d

Browse files
committed
tools: support testing known issues
This commit adds a known_issues directory to the test directory for scripts that reproduce known bugs. Since these scripts are expected to fail, it also adds a --expect-fail flag to test.py which reports tests as successful when they fail. Refs: nodejs/testing#18 PR-URL: #5528 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Wyatt Preul <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent ad0ce57 commit 32e1f9d

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ test-internet: all
192192
test-debugger: all
193193
$(PYTHON) tools/test.py debugger
194194

195+
test-known-issues: all
196+
$(PYTHON) tools/test.py known_issues --expect-fail
197+
195198
test-npm: $(NODE_EXE)
196199
NODE=$(NODE) tools/test-npm.sh
197200

test/known_issues/testcfg.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import sys, os
2+
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
3+
import testpy
4+
5+
def GetConfiguration(context, root):
6+
return testpy.SimpleTestConfiguration(context, root, 'known_issues')

tools/test.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ def __init__(self, context, path, arch, mode):
430430
self.thread_id = 0
431431

432432
def IsNegative(self):
433-
return False
433+
return self.context.expect_fail
434434

435435
def CompareTime(self, other):
436436
return cmp(other.duration, self.duration)
@@ -778,13 +778,14 @@ def GetTestStatus(self, context, sections, defs):
778778

779779
class Context(object):
780780

781-
def __init__(self, workspace, buildspace, verbose, vm, args, timeout,
782-
processor, suppress_dialogs, store_unexpected_output):
781+
def __init__(self, workspace, buildspace, verbose, vm, args, expect_fail,
782+
timeout, processor, suppress_dialogs, store_unexpected_output):
783783
self.workspace = workspace
784784
self.buildspace = buildspace
785785
self.verbose = verbose
786786
self.vm_root = vm
787787
self.node_args = args
788+
self.expect_fail = expect_fail
788789
self.timeout = timeout
789790
self.processor = processor
790791
self.suppress_dialogs = suppress_dialogs
@@ -1289,6 +1290,8 @@ def BuildOptions():
12891290
result.add_option("--special-command", default=None)
12901291
result.add_option("--node-args", dest="node_args", help="Args to pass through to Node",
12911292
default=[], action="append")
1293+
result.add_option("--expect-fail", dest="expect_fail",
1294+
help="Expect test cases to fail", default=False, action="store_true")
12921295
result.add_option("--valgrind", help="Run tests through valgrind",
12931296
default=False, action="store_true")
12941297
result.add_option("--cat", help="Print the source of the tests",
@@ -1480,6 +1483,7 @@ def Main():
14801483
VERBOSE,
14811484
shell,
14821485
options.node_args,
1486+
options.expect_fail,
14831487
options.timeout,
14841488
processor,
14851489
options.suppress_dialogs,

vcbuild.bat

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ if /i "%1"=="test-gc" set test_args=%test_args% gc&set buildnodeweak=1&got
6262
if /i "%1"=="test-internet" set test_args=%test_args% internet&goto arg-ok
6363
if /i "%1"=="test-pummel" set test_args=%test_args% pummel&goto arg-ok
6464
if /i "%1"=="test-all" set test_args=%test_args% sequential parallel message gc internet pummel&set buildnodeweak=1&set jslint=1&goto arg-ok
65+
if /i "%1"=="test-known-issues" set test_args=%test_args% known_issues --expect-fail&goto arg-ok
6566
if /i "%1"=="jslint" set jslint=1&goto arg-ok
6667
if /i "%1"=="msi" set msi=1&set licensertf=1&set download_arg="--download=all"&set i18n_arg=small-icu&goto arg-ok
6768
if /i "%1"=="build-release" set build_release=1&goto arg-ok

0 commit comments

Comments
 (0)