-
Notifications
You must be signed in to change notification settings - Fork 479
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
Hook up js-interpreter-tyrant test runner for our patched interpreter #13974
Conversation
…cardune-interpreter-tests
…cardune-interpreter-tests
…cardune-interpreter-tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've got a couple of questions but this is all looking really good.
@@ -14,6 +14,7 @@ | |||
"test:unit": "grunt unitTest", | |||
"test:integration": "grunt integrationTest", | |||
"test:entry": "grunt karma:entry", | |||
"test:interpreter": "./node_modules/@code-dot-org/js-interpreter-tyrant/bin/run.js --run --diff --root ./test/interpreter --interpreter ./test/interpreter/patched-interpreter.js --progress", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because you list "bin": "bin/run.js"
in js-interpreter-tyrant's package.json, it will be symlinked into node_modules/.bin
, which is already in the path when running an npm script. That means (I think) you can write this line as:
"test:interpreter": "run.js --run --diff --root ./test/interpreter --interpreter ./test/interpreter/patched-interpreter.js --progress",
...and probably should, as it's a little less configuration-dependent (it's possible customize the node_modules
and .bin
locations, though I'm not sure why you would).
This would be even nicer if you had js-interpreter-tyrant export a js-interpreter-tyrant
executable instead, so it could be
"test:interpreter": "js-interpreter-tyrant --run --diff --root ./test/interpreter --interpreter ./test/interpreter/patched-interpreter.js --progress",
...as you describe in the README for that tool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue here is yarn 0.16.1. It doesn't actually put the js-interpreter-tyrant
script in node_modules/.bin
because js-interpreter-tyrant
is under the @code-dot-org
scope :(. So it ends up in node_modules/@code-dot-org/.bin
which doesn't make any sense and isn't in the path. This has been fixed in newer versions of yarn. So we really need to upgrade.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, what a headache. Leave it for now. Hopefully we'll remember to clean it up after we upgrade.
@@ -34,10 +35,15 @@ | |||
"browser": { | |||
"blockly": "./build/package/js/blockly.js" | |||
}, | |||
"resolutions": { | |||
"eshost": "github:pcardune/eshost#f3fa7fa", | |||
"test262-compiler": "github:pcardune/test262-compiler#ffa0dff" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two questions:
-
It looks like the resolutions field is a yarn-specific extension of package.json. Are we no longer backwards-compatible with npm?
-
What is customized about these repos, and do we expect to switch back to an upstream at some point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
I think I might be able to get rid of this resolutions thing actually. It should get taken care of by what is in the yarn.lock file.
-
eshost
includes a new agent definition for js-interpreter. I have an issue out asking for a better way to add new agents without having them live in theeshost
repo. Haven't heard back yet :(.test262-compiler
just has a small (but important) bug fix which I likewise have a pull request out for but haven't heard back yet either.
pull requests in question:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome 👍
scope = scope.parentScope; | ||
} | ||
this.throwException('Unknown identifier: ' + nameStr); | ||
return this.UNDEFINED; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious coverage report here. Does this.throwException
throw a native exception? If so, should the return
line be removed as unreachable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It throws an exception sometimes. The case where it doesn't is definitely not covered here!
Though frankly, this code is only really covered by integration tests, so I really need to go back and add unit tests.
@@ -0,0 +1,6 @@ | |||
#!/bin/bash | |||
set -x | |||
./node_modules/@code-dot-org/js-interpreter-tyrant/bin/run.js --threads 1 --run --diff --verbose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar note here, but since node_modules/.bin
isn't in scope you'd use
`npm bin`/run.js --threads 1 --run --diff --verbose
If we're dropping npm support, I suppose `yarn bin`
is preferable - it works the same way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same issue with yarn 0.16.1 as stated above.
task :interpreter do | ||
run_tests_if_changed('interpreter', ['apps/src/lib/tools/jsinterpreter/patchInterpreter.js']) do | ||
TestRunUtils.run_interpreter_tests | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So... how long does this take, on one container on Circle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a couple hours I think? Haven't gotten it to run yet so will find out soon!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I guess it takes more than 2 hours because circle is timing out. I don't think there is a particularly quick fix for that.
@@ -0,0 +1,99 @@ | |||
const Interpreter = require('@code-dot-org/js-interpreter'); | |||
|
|||
module.exports = function patchInterpreter() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is all just extracted from JSInterpreter.js
. We have to use node.js style exports because this needs to run inside node and the browser.
tools/hooks/lint.rb
Outdated
@@ -19,7 +19,7 @@ def filter_rubocop(modified_files) | |||
RUBY_EXTENSIONS.any? {|ext| f.end_with? ext } | |||
end | |||
modified_ruby_scripts = modified_files.select do |f| | |||
first_line = File.exist?(f) ? File.open(f).first : nil | |||
first_line = File.file?(f) ? File.open(f).first : nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needed to change this so it wouldn't get screwed up with git submodules which show up in git's list of "modified files" but is actually a directory.
@@ -14,6 +14,7 @@ | |||
"test:unit": "grunt unitTest", | |||
"test:integration": "grunt integrationTest", | |||
"test:entry": "grunt karma:entry", | |||
"test:interpreter": "./node_modules/@code-dot-org/js-interpreter-tyrant/bin/run.js --run --diff --root ./test/interpreter --interpreter ./test/interpreter/patched-interpreter.js --progress", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue here is yarn 0.16.1. It doesn't actually put the js-interpreter-tyrant
script in node_modules/.bin
because js-interpreter-tyrant
is under the @code-dot-org
scope :(. So it ends up in node_modules/@code-dot-org/.bin
which doesn't make any sense and isn't in the path. This has been fixed in newer versions of yarn. So we really need to upgrade.
@@ -34,10 +35,15 @@ | |||
"browser": { | |||
"blockly": "./build/package/js/blockly.js" | |||
}, | |||
"resolutions": { | |||
"eshost": "github:pcardune/eshost#f3fa7fa", | |||
"test262-compiler": "github:pcardune/test262-compiler#ffa0dff" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
I think I might be able to get rid of this resolutions thing actually. It should get taken care of by what is in the yarn.lock file.
-
eshost
includes a new agent definition for js-interpreter. I have an issue out asking for a better way to add new agents without having them live in theeshost
repo. Haven't heard back yet :(.test262-compiler
just has a small (but important) bug fix which I likewise have a pull request out for but haven't heard back yet either.
pull requests in question:
scope = scope.parentScope; | ||
} | ||
this.throwException('Unknown identifier: ' + nameStr); | ||
return this.UNDEFINED; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It throws an exception sometimes. The case where it doesn't is definitely not covered here!
Though frankly, this code is only really covered by integration tests, so I really need to go back and add unit tests.
@@ -0,0 +1,6 @@ | |||
#!/bin/bash | |||
set -x | |||
./node_modules/@code-dot-org/js-interpreter-tyrant/bin/run.js --threads 1 --run --diff --verbose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same issue with yarn 0.16.1 as stated above.
task :interpreter do | ||
run_tests_if_changed('interpreter', ['apps/src/lib/tools/jsinterpreter/patchInterpreter.js']) do | ||
TestRunUtils.run_interpreter_tests | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a couple hours I think? Haven't gotten it to run yet so will find out soon!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM (and I'm very excited about having this fantastic coverage integrated). Looks like some pretty gnarly failures in the Circle build though. Any idea what's going on there?
Broken tests here are due to a bug I introduced in the most recent release of @code-dot-org/js-interpreter. Fixing that here first: code-dot-org/JS-Interpreter#5 |
…o fix test failures
…cardune-interpreter-tests
Now we can patch it like crazy and have an idea of what we broke and/or fixed!