Skip to content

test: introduce SetUpTestCase/TearDownTestCase - #18558

Closed
danbev wants to merge 4 commits into
nodejs:masterfrom
danbev:test_fixture_refectoring
Closed

test: introduce SetUpTestCase/TearDownTestCase#18558
danbev wants to merge 4 commits into
nodejs:masterfrom
danbev:test_fixture_refectoring

Conversation

@danbev

Copy link
Copy Markdown
Contributor

This commit add SetUpTestCase and TearDownTestCase functions that will
be called once per test case. Currently we only have SetUp/TearDown
which are called for each test.

This commit moves the initialization and configuration of Node and V8 to
be done on a per test case basis, but gives each test a new Isolate.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

test

@nodejs-github-botnodejs-github-bot added the test Issues and PRs related to the tests. label Feb 4, 2018
@danbev

Copy link
Copy Markdown
ContributorAuthor

@danbev

Copy link
Copy Markdown
ContributorAuthor
test/node-test-commit-freebsd failure looks unrelated

console output:

Building addon /usr/home/iojs/build/workspace/node-test-commit-freebsd/nodes/freebsd10-64/test/addons/load-long-path/gyp info it worked if it ends with okgyp info using node-gyp@3.6.2gyp info using node@10.0.0-pre | freebsd | x64gyp info chdir /usr/home/iojs/build/workspace/node-test-commit-freebsd/nodes/freebsd10-64/test/addons/load-long-path/gyp info spawn /usr/local/bin/pythongyp info spawn args [ '/usr/home/iojs/build/workspace/node-test-commit-freebsd/nodes/freebsd10-64/deps/npm/node_modules/node-gyp/gyp/gyp_main.py',gyp info spawn args 'binding.gyp',gyp info spawn args '-f',gyp info spawn args 'make',gyp info spawn args '-I',gyp info spawn args '/usr/home/iojs/build/workspace/node-test-commit-freebsd/nodes/freebsd10-64/test/addons/load-long-path/build/config.gypi',gyp info spawn args '-I',gyp info spawn args '/usr/home/iojs/build/workspace/node-test-commit-freebsd/nodes/freebsd10-64/deps/npm/node_modules/node-gyp/addon.gypi',gyp info spawn args '-I',gyp info spawn args '/usr/home/iojs/build/workspace/node-test-commit-freebsd/nodes/freebsd10-64/common.gypi',gyp info spawn args '-Dlibrary=shared_library',gyp info spawn args '-Dvisibility=default',gyp info spawn args '-Dnode_root_dir=/usr/home/iojs/build/workspace/node-test-commit-freebsd/nodes/freebsd10-64',gyp info spawn args '-Dnode_gyp_dir=/usr/home/iojs/build/workspace/node-test-commit-freebsd/nodes/freebsd10-64/deps/npm/node_modules/node-gyp',gyp info spawn args '-Dnode_lib_file=/usr/home/iojs/build/workspace/node-test-commit-freebsd/nodes/freebsd10-64/$(Configuration)/node.lib',gyp info spawn args '-Dmodule_root_dir=/usr/home/iojs/build/workspace/node-test-commit-freebsd/nodes/freebsd10-64/test/addons/load-long-path',gyp info spawn args '-Dnode_engine=v8',gyp info spawn args '--depth=.',gyp info spawn args '--no-parallel',gyp info spawn args '--generator-output',gyp info spawn args 'build',gyp info spawn args '-Goutput_dir=.' ]gyp: /usr/home/iojs/build/workspace/node-test-commit-freebsd/nodes/freebsd10-64/common.gypi not found (cwd: /usr/home/iojs/build/workspace/node-test-commit-freebsd/nodes/freebsd10-64/test/addons/load-long-path) while reading includes of binding.gyp while trying to load binding.gypgyp ERR! configure error gyp ERR! stack Error: `gyp` failed with exit code: 1gyp ERR! stack at ChildProcess.onCpExit (/usr/home/iojs/build/workspace/node-test-commit-freebsd/nodes/freebsd10-64/deps/npm/node_modules/node-gyp/lib/configure.js:336:16)gyp ERR! stack at ChildProcess.emit (events.js:131:13)gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)gyp ERR! System FreeBSD 10.3-RELEASE-p7gyp ERR! command "/usr/home/iojs/build/workspace/node-test-commit-freebsd/nodes/freebsd10-64/out/Release/node" "/usr/home/iojs/build/workspace/node-test-commit-freebsd/nodes/freebsd10-64/deps/npm/node_modules/node-gyp/bin/node-gyp" "--loglevel=info" "rebuild" "--python=/usr/local/bin/python" "--directory=/usr/home/iojs/build/workspace/node-test-commit-freebsd/nodes/freebsd10-64/test/addons/load-long-path/" "--nodedir=/usr/home/iojs/build/workspace/node-test-commit-freebsd/nodes/freebsd10-64"gyp ERR! cwd /usr/home/iojs/build/workspace/node-test-commit-freebsd/nodes/freebsd10-64/test/addons/load-long-pathgyp ERR! node -v v10.0.0-pregyp ERR! node-gyp -v v3.6.2gyp ERR! not ok Makefile:329: recipe for target 'test/addons/.buildstamp' failedgmake[1]: *** [test/addons/.buildstamp] Error 1Makefile:475: recipe for target 'run-ci' failedgmake: *** [run-ci] Error 2Build step 'Execute shell' marked build as failure

Comment threadtest/cctest/node_test_fixture.h Outdated

virtual void SetUp() {
static void SetUpTestCase() {
platform.reset(new node::NodePlatform(8, nullptr));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe lower this to one to make the tests more deterministic.

As well, different cctests can (at least in theory) run concurrently; you don't want to have an explosion of threads.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, I'll change it to 4.

std::unique_ptr<v8::ArrayBuffer::Allocator> allocator_{
v8::ArrayBuffer::Allocator::NewDefaultAllocator()};
virtual void SetUp() {
isolate_ = v8::Isolate::New(params);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a CHECK_NE(isolate_, nullptr)?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing, I'll add the check. Thanks

This commit add SetUpTestCase and TearDownTestCase functions that will
be called once per test case. Currently we only have SetUp/TearDown
which are called for each test.
This commit moves the initialization and configuration of Node and V8 to
be done on a per test case basis, but gives each test a new Isolate.
@danbev
danbevforce-pushed the test_fixture_refectoring branch from dc699ee to ad04fb9CompareFebruary 5, 2018 06:06
@danbev

Copy link
Copy Markdown
ContributorAuthor

Landed in c64e130 and ca473be.

@danbevdanbev closed this Feb 6, 2018
danbev added a commit that referenced this pull request Feb 6, 2018
This commit add SetUpTestCase and TearDownTestCase functions that will
be called once per test case. Currently we only have SetUp/TearDown
which are called for each test.
This commit moves the initialization and configuration of Node and V8 to
be done on a per test case basis, but gives each test a new Isolate.
PR-URL: #18558
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
danbev added a commit that referenced this pull request Feb 6, 2018
PR-URL: #18558
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@danbev
danbev deleted the test_fixture_refectoring branch February 6, 2018 05:59
@MylesBorins

Copy link
Copy Markdown
Contributor

Should this be backported to v9.x-staging? If yes please follow the guide and raise a backport PR, if not let me know or add the dont-land-on label.

danbev added a commit to danbev/node that referenced this pull request Feb 23, 2018
This commit add SetUpTestCase and TearDownTestCase functions that will
be called once per test case. Currently we only have SetUp/TearDown
which are called for each test.
This commit moves the initialization and configuration of Node and V8 to
be done on a per test case basis, but gives each test a new Isolate.
PR-URL: nodejs#18558
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
addaleax pushed a commit that referenced this pull request Feb 26, 2018
This commit add SetUpTestCase and TearDownTestCase functions that will
be called once per test case. Currently we only have SetUp/TearDown
which are called for each test.
This commit moves the initialization and configuration of Node and V8 to
be done on a per test case basis, but gives each test a new Isolate.
Backport-PR-URL: #18957
PR-URL: #18558
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
addaleax pushed a commit that referenced this pull request Feb 26, 2018
This commit add SetUpTestCase and TearDownTestCase functions that will
be called once per test case. Currently we only have SetUp/TearDown
which are called for each test.
This commit moves the initialization and configuration of Node and V8 to
be done on a per test case basis, but gives each test a new Isolate.
Backport-PR-URL: #18957
PR-URL: #18558
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this pull request Feb 26, 2018
This commit add SetUpTestCase and TearDownTestCase functions that will
be called once per test case. Currently we only have SetUp/TearDown
which are called for each test.
This commit moves the initialization and configuration of Node and V8 to
be done on a per test case basis, but gives each test a new Isolate.
Backport-PR-URL: #18957
PR-URL: #18558
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@addaleaxaddaleax mentioned this pull request Feb 27, 2018
danbev added a commit to danbev/node that referenced this pull request Mar 21, 2018
This commit add SetUpTestCase and TearDownTestCase functions that will
be called once per test case. Currently we only have SetUp/TearDown
which are called for each test.
This commit moves the initialization and configuration of Node and V8 to
be done on a per test case basis, but gives each test a new Isolate.
PR-URL: nodejs#18558
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
danbev added a commit to danbev/node that referenced this pull request Mar 21, 2018
PR-URL: nodejs#18558
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this pull request Mar 21, 2018
This commit add SetUpTestCase and TearDownTestCase functions that will
be called once per test case. Currently we only have SetUp/TearDown
which are called for each test.
This commit moves the initialization and configuration of Node and V8 to
be done on a per test case basis, but gives each test a new Isolate.
Backport-PR-URL: #19504
PR-URL: #18558
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this pull request Mar 21, 2018
Backport-PR-URL: #19504
PR-URL: #18558
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@targostargos mentioned this pull request Mar 21, 2018
MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
This commit add SetUpTestCase and TearDownTestCase functions that will
be called once per test case. Currently we only have SetUp/TearDown
which are called for each test.
This commit moves the initialization and configuration of Node and V8 to
be done on a per test case basis, but gives each test a new Isolate.
PR-URL: nodejs#18558
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
PR-URL: nodejs#18558
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this pull request Aug 7, 2018
This commit add SetUpTestCase and TearDownTestCase functions that will
be called once per test case. Currently we only have SetUp/TearDown
which are called for each test.
This commit moves the initialization and configuration of Node and V8 to
be done on a per test case basis, but gives each test a new Isolate.
PR-URL: #18558
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this pull request Aug 7, 2018
PR-URL: #18558
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
rvagg pushed a commit that referenced this pull request Aug 16, 2018
This commit add SetUpTestCase and TearDownTestCase functions that will
be called once per test case. Currently we only have SetUp/TearDown
which are called for each test.
This commit moves the initialization and configuration of Node and V8 to
be done on a per test case basis, but gives each test a new Isolate.
PR-URL: #18558
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
rvagg pushed a commit that referenced this pull request Aug 16, 2018
PR-URL: #18558
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@MylesBorinsMylesBorins mentioned this pull request Aug 16, 2018
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@danbev@MylesBorins@bnoordhuis@addaleax@nodejs-github-bot