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

test: fix test-esm-addons #16174

Closed
wants to merge 1 commit into from
Closed

Conversation

Trott
Copy link
Member

@Trott Trott commented Oct 13, 2017

Move test-esm-addons to test/addons/hello-world-esm.

Test should now work properly on CI machines where addons are not
always built at the expected relative path from the es-modules tests.

Test should now work in Debug builds.

Fixes: #16155

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test

@Trott Trott added the esm Issues and PRs related to the ECMAScript Modules implementation. label Oct 13, 2017
@nodejs-github-bot nodejs-github-bot added addons Issues and PRs related to native addons. test Issues and PRs related to the tests. labels Oct 13, 2017
@Trott
Copy link
Member Author

Trott commented Oct 13, 2017

@Trott
Copy link
Member Author

Trott commented Oct 13, 2017

Assuming no CI surprises, would love to see this fast-tracked to get CI back to yellow/green.

@guybedford @refack @bmeck @danbev @nodejs/testing

Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

LGTM anyway

/* eslint-disable required-modules */

import assert from 'assert';
import binding from '../addons/hello-world/build/Release/binding.node';
import binding from './build/Release/binding.node';
Copy link
Member

Choose a reason for hiding this comment

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

This still uses build/Release… did you verify that this fixes #16155?

Copy link
Member Author

Choose a reason for hiding this comment

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

Whoops, I'll fix that. (No, I didn't verify. In my defense, I said "should now work in Debug builds" rather than "definitely does now work in Debug builds". :-D )

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed! Should now work in Debug builds for really realz, although I haven't verified.

Move test-esm-addons to test/addons/hello-world-esm.

Test should now work properly on CI machines where `addons` are not
always built at the expected relative path from the es-modules tests.

Test should now work in Debug builds.

Fixes: nodejs#16155
@Trott
Copy link
Member Author

Trott commented Oct 13, 2017

@Trott
Copy link
Member Author

Trott commented Oct 13, 2017

I haven't verified that this fix makes the test pass on Debug builds, so if anyone verifies that, it would be awesome if you could leave a note here.

Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

Yup, LGTM & I’ll try this out in a debug build later

const buildDir = join(__dirname, 'build');

copyFileSync(join(buildDir, common.buildType, 'binding.node'),
join(buildDir, 'binding.node'));
Copy link
Member

Choose a reason for hiding this comment

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

We should maybe just do this (or, on POSIX, do symlinks) for all addons.

@Trott
Copy link
Member Author

Trott commented Oct 13, 2017

CI is showing green, but no tests were actually run. Something is not working on CI. Will have to run again after it's fixed.

@danbev
Copy link
Contributor

danbev commented Oct 13, 2017

I haven't verified that this fix makes the test pass on Debug builds, so if anyone verifies that, it would be awesome if you could leave a note here.

Debug build worked for me 👍

@Trott
Copy link
Member Author

Trott commented Oct 13, 2017

CI seems to be working now.

CI: https://ci.nodejs.org/job/node-test-pull-request/10669/

@Trott
Copy link
Member Author

Trott commented Oct 13, 2017

Linux had an unrelated failure so I re-ran and its green: https://ci.nodejs.org/job/node-test-commit-linux/13135/

Everything else is green the first time including those Raspberry Pi devices that were failing on this test before. I'm going to sleep, but if someone feels that this is worth fast-tracking, you certainly have my endorsement to land it. :-D

@Trott Trott added the flaky-test Issues and PRs related to the tests with unstable failures on the CI. label Oct 13, 2017
@guybedford
Copy link
Contributor

Thanks so much for this fix, and apologies - it completely slipped my mind to find a more portable approach here. Just caught this now due to time zones, but looks great to me!

@refack
Copy link
Contributor

refack commented Oct 13, 2017

K.I.S.S. FTW. I got stuck in my own head trying to find an elegant solution for

def Ls(self, path):
def SelectTest(name):
return name.endswith('.js')
result = []
for subpath in os.listdir(path):
if os.path.isdir(join(path, subpath)):
for f in os.listdir(join(path, subpath)):
if SelectTest(f):
result.append([subpath, f[:-3]])
return result
def ListTests(self, current_path, path, arch, mode):
all_tests = [current_path + t for t in self.Ls(join(self.root))]
result = []
for test in all_tests:
if self.Contains(path, test):
file_path = join(self.root, reduce(join, test[1:], "") + ".js")

@refack
Copy link
Contributor

refack commented Oct 13, 2017

@Trott I'm thinking maybe duplicating a whole addon just for this test is too expensive... Any thoughts?

@Trott
Copy link
Member Author

Trott commented Oct 13, 2017

@Trott I'm thinking maybe duplicating a whole addon just for this test is too expensive... Any thoughts?

I prefer it as a separate unit with no dependencies on other tests, but I wouldn't oppose a subsequent refactoring that reduced that duplication if that's bothering you or anyone else. I'm thinking this should land as-is to get the CI to not-red as soon as possible.

Trott added a commit to Trott/io.js that referenced this pull request Oct 13, 2017
Move test-esm-addons to test/addons/hello-world-esm.

Test should now work properly on CI machines where `addons` are not
always built at the expected relative path from the es-modules tests.

Test should now work in Debug builds.

PR-URL: nodejs#16174
Fixes: nodejs#16155
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
@Trott
Copy link
Member Author

Trott commented Oct 13, 2017

Landed in 981595c. I thought I saw someone else give a thumbs-up to fast-tracking, but now I don't see it. Apologies if this went too fast...

@Trott Trott closed this Oct 13, 2017
addaleax pushed a commit to ayojs/ayo that referenced this pull request Oct 15, 2017
Move test-esm-addons to test/addons/hello-world-esm.

Test should now work properly on CI machines where `addons` are not
always built at the expected relative path from the es-modules tests.

Test should now work in Debug builds.

PR-URL: nodejs/node#16174
Fixes: nodejs/node#16155
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
targos pushed a commit that referenced this pull request Oct 18, 2017
Move test-esm-addons to test/addons/hello-world-esm.

Test should now work properly on CI machines where `addons` are not
always built at the expected relative path from the es-modules tests.

Test should now work in Debug builds.

PR-URL: #16174
Fixes: #16155
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
@Trott Trott deleted the fix-the-ding-dang-ci branch January 13, 2022 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addons Issues and PRs related to native addons. esm Issues and PRs related to the ECMAScript Modules implementation. flaky-test Issues and PRs related to the tests with unstable failures on the CI. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test-esm-addon.mjs fails when building in debug mode
7 participants