Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of 5528 #5785

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ test-internet: all
test-debugger: all
$(PYTHON) tools/test.py debugger

test-known-issues: all
$(PYTHON) tools/test.py known_issues --expect-fail

test-npm: $(NODE_EXE)
NODE=$(NODE) tools/test-npm.sh

Expand Down
11 changes: 11 additions & 0 deletions test/known_issues/test-vm-function-redefinition.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';
// Refs: https://github.com/nodejs/node/issues/548
require('../common');
const assert = require('assert');
const vm = require('vm');
const context = vm.createContext();

vm.runInContext('function test() { return 0; }', context);
vm.runInContext('function test() { return 1; }', context);
const result = vm.runInContext('test()', context);
assert.strictEqual(result, 1);
6 changes: 6 additions & 0 deletions test/known_issues/testcfg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import testpy

def GetConfiguration(context, root):
return testpy.SimpleTestConfiguration(context, root, 'known_issues')
9 changes: 7 additions & 2 deletions tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ def __init__(self, context, path, arch, mode):
self.thread_id = 0

def IsNegative(self):
return False
return self.context.expect_fail

def CompareTime(self, other):
return cmp(other.duration, self.duration)
Expand Down Expand Up @@ -774,11 +774,13 @@ def GetTestStatus(self, context, sections, defs):

class Context(object):

def __init__(self, workspace, buildspace, verbose, vm, timeout, processor, suppress_dialogs, store_unexpected_output):
def __init__(self, workspace, buildspace, verbose, vm, expect_fail,
timeout, processor, suppress_dialogs, store_unexpected_output):
self.workspace = workspace
self.buildspace = buildspace
self.verbose = verbose
self.vm_root = vm
self.expect_fail = expect_fail
self.timeout = timeout
self.processor = processor
self.suppress_dialogs = suppress_dialogs
Expand Down Expand Up @@ -1281,6 +1283,8 @@ def BuildOptions():
result.add_option("--snapshot", help="Run the tests with snapshot turned on",
default=False, action="store_true")
result.add_option("--special-command", default=None)
result.add_option("--expect-fail", dest="expect_fail",
help="Expect test cases to fail", default=False, action="store_true")
result.add_option("--valgrind", help="Run tests through valgrind",
default=False, action="store_true")
result.add_option("--cat", help="Print the source of the tests",
Expand Down Expand Up @@ -1471,6 +1475,7 @@ def Main():
buildspace,
VERBOSE,
shell,
options.expect_fail,
options.timeout,
processor,
options.suppress_dialogs,
Expand Down
1 change: 1 addition & 0 deletions vcbuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ if /i "%1"=="test-gc" set test_args=%test_args% gc&set buildnodeweak=1&got
if /i "%1"=="test-internet" set test_args=%test_args% internet&goto arg-ok
if /i "%1"=="test-pummel" set test_args=%test_args% pummel&goto arg-ok
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
if /i "%1"=="test-known-issues" set test_args=%test_args% known_issues --expect-fail&goto arg-ok
if /i "%1"=="jslint" set jslint=1&goto arg-ok
if /i "%1"=="msi" set msi=1&set licensertf=1&set download_arg="--download=all"&set i18n_arg=small-icu&goto arg-ok
if /i "%1"=="build-release" set build_release=1&goto arg-ok
Expand Down