Skip to content

Restrict validation output to just validation errors in the API#1253

Merged
kripken merged 4 commits intoWebAssembly:masterfrom
dcodeIO:js-less-verbose-validation
Nov 1, 2017
Merged

Restrict validation output to just validation errors in the API#1253
kripken merged 4 commits intoWebAssembly:masterfrom
dcodeIO:js-less-verbose-validation

Conversation

@dcodeIO
Copy link
Copy Markdown
Contributor

@dcodeIO dcodeIO commented Oct 28, 2017

This restricts validation output to validation errors in the API, leaving additional and possibly very longish printing of the entire module up to the respective tool.

@kripken
Copy link
Copy Markdown
Member

kripken commented Oct 30, 2017

Hmm, I find this quite useful myself as a developer :) How else would you print out the erroring module? If you add --print after the pass that breaks it, it won't reach the print?

But if this is annoying it could be optional. Perhaps one of the current debug env vars (BINARYEN_PASS_DEBUG, BINARYEN_PRINT_FULL) could cover it, or we could add another.

@dcodeIO
Copy link
Copy Markdown
Contributor Author

dcodeIO commented Oct 30, 2017

Imho the respective tool (using the API) should provide printing of the entire module as an option, not the API itself where one function should do one thing. For instance, one could simply do

if (!BinaryenModuleValidate(the_module))
  BinaryenModulePrint(the_module);

leading to the exact same output as before, while there is no way to print just the validation messages (which I am interested in) as it is atm. Just removing this line and leaving it up to the user to print the module contents where necessary also avoids adding more options (do env vars even work in JS?).

@kripken
Copy link
Copy Markdown
Member

kripken commented Oct 30, 2017

I see, I was thinking more form the point of view of a commandline tool. Yeah, I agree we should do it the way you propose, by making printing the module optional, and we should make it print the module in the commandline tools like wasm-opt, so the user of those tools doesn't see a change from this PR (while people making their own tools using the C API can choose to print the module or not).

@kripken
Copy link
Copy Markdown
Member

kripken commented Oct 30, 2017

(About env vars and js, emscripten does support getenv, but it isn't hooked up to the actual system env. But in node.js someone could in theory do that.)

@dcodeIO
Copy link
Copy Markdown
Contributor Author

dcodeIO commented Oct 31, 2017

This commit should add explicit printing of the module to all places where it has been printed before but then wasn't due to the change.

Comment thread src/tools/wasm-shell.cpp
assert(WasmValidator().validate(*modules[moduleName]));
bool valid = WasmValidator().validate(*modules[moduleName]);
if (!valid) {
WasmPrinter::printModule(modules[moduleName].get());
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

is this correct?

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.

Hmm, this does change the semantics, before it would not even check if assertions are off. But I see no downside to making this change, probably better actually.

@kripken
Copy link
Copy Markdown
Member

kripken commented Oct 31, 2017

Overall this looks like the right direction, but the CI errors show that we are printing the module when testing spec/func_ptrs.wast, which suggests it doesn't validate? But that can't be since the test passes. I'd run it locally to see more (maybe there is stderr output that travis is hiding).

@dcodeIO
Copy link
Copy Markdown
Contributor Author

dcodeIO commented Oct 31, 2017

I am a bit puzzled what's going on there.

Unfortunately, I cannot run the waterfall tests on Windows because there are no such binaries (downloading waterfall 13645: https://storage.googleapis.com/wasm-llvm/builds/windows/13645/wasm-binaries-13645.tbz2 ... HTTP Error 404: Not Found).

@dcodeIO dcodeIO force-pushed the js-less-verbose-validation branch from d38bab9 to 2e0a58e Compare October 31, 2017 22:09
@dcodeIO
Copy link
Copy Markdown
Contributor Author

dcodeIO commented Nov 1, 2017

Just checked: Local output is the same as shown on Travis.

@dcodeIO
Copy link
Copy Markdown
Contributor Author

dcodeIO commented Nov 1, 2017

Seems to produce the expected output if I do this, but I must admit that I do not understand why validate didn't print the module at this occasion before. Only accountable candidate I observed there is info.quiet being true, but I can't spot any flags being provided.

@dcodeIO dcodeIO changed the title Do not print the entire and possibly very large module when validation fails Restrict validation output to just validation errors in the API Nov 1, 2017
@kripken
Copy link
Copy Markdown
Member

kripken commented Nov 1, 2017

Yeah, that's odd - it seems like it should have been printed before too. Anyhow, your fix is the right one, in wasm-shell we actually don't want to print it, it has tests that are supposed to fail, without printing.

@kripken kripken merged commit d38eead into WebAssembly:master Nov 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants