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

build: improve make test-npm #1576

Closed
wants to merge 1 commit into from

Conversation

Fishrock123
Copy link
Contributor

replaces #1567

I think I'm doing this correctly, is there any reason it was separated into two commands? Did that make it parallel? It didn't seem to change per noticeably for me.

Also, now removes deps/npm/node_modules/.bin, which is generated by make test-npm.

R=@othiym23

@Fishrock123 Fishrock123 added the build Issues and PRs related to build files or the CI. label May 1, 2015
@Fishrock123 Fishrock123 added the test Issues and PRs related to the tests. label May 1, 2015
../../$(NODE_EXE) cli.js run-script test-all && \
../../$(NODE_EXE) cli.js prune --prod && \
rm -rf node_modules/.bin && \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

holy indentation, let me fix that.

@Fishrock123
Copy link
Contributor Author

@rvagg maybe you could give this a quick review?

@rvagg
Copy link
Member

rvagg commented May 7, 2015

/cc @jbergstroem

@rvagg
Copy link
Member

rvagg commented May 7, 2015

/cc @iojs/build actually - anything that involves Makefile, vcbuild.bat, gyp or other buildy things should get the attention of the build crew

@rvagg
Copy link
Member

rvagg commented May 7, 2015

ftr I've tried this out and had problems doing it on this in-flight wifi so while I can't give a proper +1 it at least looks like it's probably good, will try and get around to testing later but would be happy to have someone else review if they can

cd deps/npm ; npm_config_cache="$(shell pwd)/npm-cache" \
npm_config_prefix="$(shell pwd)/npm-prefix" \
npm_config_tmp="$(shell pwd)/npm-tmp" \
../../$(NODE_EXE) cli.js install --ignore-scripts && \
Copy link
Member

Choose a reason for hiding this comment

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

@othiym23 I have a problem with the logic here -- we're testing the bundled npm works as it should with io.js but we should also be testing that it's bundled properly and ready to release yet we have an npm install inside the bundled directory which could potentially be fixing any bundled dependency problems that may exist. Is there a better way to approach this that would leave the deps/npm directory untouched?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

afaik npm install is required for it to do some linking properly.

Copy link
Contributor

Choose a reason for hiding this comment

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

The bundled npm doesn't include the devDependencies (and npm doesn't bundle the devDependencies in the version on the registry, either). They need to be installed before the tests can be run (obvs), but another way to do it would be to copy deps/npm elsewhere and then do the npm install on that, nuking it after the tests have run. I'm increasingly of the opinion that the best way to do this is with a shell script called from the Makefile, as this is getting pretty complicated (and hard to follow) for a Makefile stanza.

Copy link
Contributor

Choose a reason for hiding this comment

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

This could probably be simplified by removing the cleanup steps.. if something does go wrong, you don't want them cleaned up anyway, and if it doesn't go wrong, it gets cleaned up on the next run. Anything on CI should be using a fresh checkout, and anything release should only be running release related scripts and not these tests.

That might clear enough of the complexity budget to allow for the extra steps of copying to a separate location if there's some advantage to doing so, but it seems like validating the in-place correctness of the bundled files is a problem for another set of tests anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not cleaning up after running the tests will leave a lot of stuff that isn't gitignored, which is why I added the new cleanup to begin with.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds more like a broken .gitignore file than a broken Makefile to me ;-)

But I see your point. Tests that frustrate the people who are encouraged to run them are self defeating.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See #1567 (comment) - @othiym23 advised that this may be better handled by cleanup than gitignore.

@jbergstroem
Copy link
Member

This test actually fails for me (with no global node/io.js installed):

/Volumes/sink/io.js/deps/npm ±remotes/iojs/pr/1576 $ ../../iojs cli.js run-script test-all

> npm@2.8.3 test-all /Volumes/sink/io.js/deps/npm
> npm run test-legacy && npm test

env: node: No such file or directory

npm ERR! Darwin 14.3.0
npm ERR! argv "/Volumes/sink/io.js/out/Release/iojs" "/Volumes/sink/io.js/deps/npm/cli.js" "run-script" "test-all"
npm ERR! node v2.0.0
npm ERR! npm  v2.8.3
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! npm@2.8.3 test-all: `npm run test-legacy && npm test`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the npm@2.8.3 test-all script 'npm run test-legacy && npm test'.
npm ERR! This is most likely a problem with the npm package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run test-legacy && npm test
npm ERR! You can get their info via:
npm ERR!     npm owner ls npm
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Volumes/sink/io.js/deps/npm/npm-debug.log
zsh: exit 1     ../../iojs cli.js run-script test-all

..problem being bin/npm calling node directly.

@@ -143,12 +143,10 @@ test-npm: $(NODE_EXE)
cd deps/npm ; npm_config_cache="$(shell pwd)/npm-cache" \
Copy link
Member

Choose a reason for hiding this comment

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

I'd cache output of pwd and reuse instead of calling it three times.

Edit: Since we generally don;'t support building out other folders than source dir, you could probably even use $(CURDIR)

@Fishrock123
Copy link
Contributor Author

..problem being bin/npm calling node directly.

Right, but that's a little out of the cope of this I think.

@jbergstroem
Copy link
Member

@Fishrock123 yeah perhaps - I just brought it up since I couldn't complete the test successfully.

@Fishrock123
Copy link
Contributor Author

@jbergstroem updated, ptal. :)

@Fishrock123
Copy link
Contributor Author

but another way to do it would be to copy deps/npm elsewhere and then do the npm install on that, nuking it after the tests have run. I'm increasingly of the opinion that the best way to do this is with a shell script called from the Makefile, as this is getting pretty complicated (and hard to follow) for a Makefile stanza.

I agree that would probably be better, will start on that next.

@Fishrock123
Copy link
Contributor Author

replaced by #1662

@Fishrock123 Fishrock123 closed this May 8, 2015
@Fishrock123
Copy link
Contributor Author

(I guess maybe I didn't need to make a new PR, but oh well)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants