-
Notifications
You must be signed in to change notification settings - Fork 451
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
Assert everything #14
Conversation
With this, everything is asserted which makes it nice to run all the tests ( |
Hm, this seems to break kg's recent test runner change, which checks the output of tests. We probably need to agree on one mechanism for verifying tests. Should we use internal asserts or should we use external output validation? I'm fine either way, but two competing (and incompatible) approaches are a problem. @kg, WDYT? |
I'm fine with internal assertions for general use but they don't cover all scenarios. I discussed this with luke on IRC. For things like testing trap behavior on failure cases, validation, etc we will need to have an external test harness that checks the result of running the interpreter. We could write all this testing infrastructure in ocaml and wrap it around the prototype, but that introduces some nasty ecosystem issues I think we should avoid. (I'm not particularly attached to python unittest, but we definitely want to use an existing production-quality testing framework.) Luke pointed out that he wanted the python test runner to be quiet, also, which I agree with. I can make some minor changes to do that today. |
On 19 August 2015 at 16:26, Katelyn Gadd notifications@github.com wrote:
Makes sense. The change probably still needs to adjust the output
Yes, I don't think it's necessary to do that in Ocaml. I actually prefer to
Do you think it's also possible to modify the runner such that it doesn't |
Absolutely. If you want I can take that out. I wanted to avoid the scenario where somebody makes a bunch of changes, runs tests, sees them pass (because they forgot to build) and checks in. But we can solve that with CI later if it happens a lot. |
@kg All of those conditions (traps, validation failures, etc) can be tested within .wasm files by adding new testing primitives to the scripting language. The only use case I see for external tool validation is testing the scripting primitives themselves (making sure they fail properly). For reference, this is what we've done in the SM test suite by adding shell-only builtins; the test harness just uses the process result code to determine pass/fail. |
I meant to give motivation for internal assertions:
|
cdd56fe
to
a3bd427
Compare
As mentioned in #17, I'd like to write some negative-validation tests and I think these tests will be more robust and easier to write by adding a new inline assertion rather than matching the error-string output (which will change over time and require a new file for each individual case I want to test). Can we agree to go the inline-test route? |
I'm fine either way. @kg? But can you please adjust the existing test expectations to this change? |
I'm OK with basic assertions in the wasm but I stand firmly by my opinion that we should not put complex test logic in the wasm interpreter, at least not yet. Tests inevitably need to do things like substring matches on error messages, handle traps, handle out-of-memory conditions, etc. Once wasm itself is expressive and robust enough to implement all these tests correctly (in a way that doesn't produce silent failure, undebuggable hangs or undebuggable crashes) it will make sense to move everything out of |
I think declarative inputs to tests are best. E.g. main(0, 1) = 3, One example: And also negative validation tests and trapping tests can easily be On Fri, Aug 21, 2015 at 8:11 PM, Katelyn Gadd notifications@github.com
|
@kg I don't see what "complex test logic" you're referring to; what I'm talking about is just more basic @titzer I don't think anyone is suggesting a DSL here. The current tiny set Script.commands extended with commands to assert non-validation and faulting should be basically equivalent to the virgil tests you linked to (just different syntax and you can have a sequence of them). Or maybe you're already agreeing? |
On Sat, Aug 22, 2015 at 2:08 AM, Luke Wagner notifications@github.com
|
@titzer, I'm not sure I get it. AFAIAC, the assert "command" here is declarative. And you seem to have a similar mini-assert-DSL in your Virgil tests, it is just hiding in comments. That looks pretty equivalent to me. |
In the grammar it allows an "expr_list" as an argument to the assert eq. I am advocating that only inputs and outputs can be specified--i.e. no On Sat, Aug 22, 2015 at 10:40 AM, rossberg-chromium <
|
@titzer I expect exprs were just done for expedience. All the current uses just pass literals and it'd be just as easy to restrict it to a literal_list. |
a3bd427
to
2cd545a
Compare
2cd545a
to
7027991
Compare
Anyhow, this PR doesn't take away any testing functionality, it just makes all the invokes assert their results; that shouldn't be too controversial. I'll make separate PRs to add faulting and negative validation commands. |
LGTM. Btw, was there a specific reason you left the "cast" invocation alone? |
@rossberg-chromium Yes, because if I make it asserteq (and fix the definition of |
I see, makes sense. Yeah, you'd probably need to string-convert with higher
precision (e.g. using Printf.sprintf) to see the exact value to check
against. But tbh, I'm not sure it's worth it. Maybe it's better to modify
the test such that it produces a more well-defined result (e.g., only using
integers, not floats).
|
* WIP on writing up alternate encoding * A little more work on the alternate proposal * Add encoding proposal that uses sign-extension operator * Update Overview.md * Fix table
Using `memory.init` or `memory.drop` on an active segment is a validation error, not a trap.
Fix spec link
Fix sentence structure.
Add explainer document for Typed Continuations proposal. Co-authored-by: Sam Lindley <Sam.Lindley@ed.ac.uk> Co-authored-by: Andreas Rossberg <rossberg@chromium.org>
It seems like a wrong copy-and-paste from Firefox.
Create Explainer.md
Add template for suggesting new instructions.
* Support for the Memory64 proposal in the spec interpreter * Apply suggestions from code review Co-authored-by: Andreas Rossberg <rossberg@mpi-sws.org> * Memory64 code review fixes * Update interpreter/syntax/types.ml Co-authored-by: Andreas Rossberg <rossberg@mpi-sws.org> Co-authored-by: Andreas Rossberg <rossberg@mpi-sws.org>
This patch switches all the .wasm tests to asserteq instead of simply invoking.