-
Notifications
You must be signed in to change notification settings - Fork 4
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
implement plymorphic property testing with an existing interpreter #9
Comments
Thoughts on polymorphic testingI've been thinking more about this issue, especially after our discussions on Wednesday. I keep coming back to the question "When will we need to test our implementation against another engine?". To answer this question, I think it's relevant to see what types of tests we might need:
There is something to be said about using other engines to CREATE our tests. However, if we use a macro to instantiate & run all engines for a test, should that prototyping code exist in the final code - does it bother us? How should we proceed with this?
In all of these cases, I don't see much more of a need then to instantiate all of the engines and put to extract results out of them, and assert that they are all equal (as per the final comments in PR #16 ). However, if we concentrate our efforts to what we will need on the short-term for an MVP, then I would consider Fuzzy Testing to not be relevant to us right now. BoilerplateAs for the boilerplate in creating our own interpreter, I think I can quickly create a small macro that would look something like this: let wat = r#" ... "#;
init!(wat, instance);
assert_eq!(10, instance::invoke_func::<i32,i32>("add_one", 9);
... That would just rewrite it as let wat = r#" ... "#;
let wasm_bytes = wat::parse_str(wat).unwrap();
let validation_info = validate(&wasm_bytes).expect("validation failed");
let mut instance = RuntimeInstance::new(&validation_info).expect("instantiation failed");
assert_eq!(10, instance::invoke_func::<i32,i32>("add_one", 9);
... Is there something else we would need if we focus just on our intepreter? For multiple interpreter I've made some macros in this commit. I didn't open a PR for it since I want to first discuss if we need it. WAST/Specification test parsingOn the topic of using the wasm spec testsuite, the After some digging, the I was thinking we could use it ourselves, but the downside is that we have to create a pre-verification step that interprets these new directives. The AST described for these secripts seems quite complicated, but from taking a quick glance at the What do you think? Should we move forward with |
That is a quite sensible assessment IMHO.
Not in the MVP, AFAICT. Of course on can always grow the scope. Just the macro as presented in you example only tests one interpreter; so it is a test creation convenience, but polymorphic. It becomes polymorphic from the moment where do two different things that should behave equivalent, i.e. call the same wasm code in two interpreters.
I think, WAST is the gold standard. If we pass 100% of the WAST tests, then we are quite sure that we do good. I'm a little afraid if I read about scripts and custom AST. That sounds like a lot of work. And it sounds like a lot of potential to invest time into on elaborate approach, only later to find a major roadblock with that approach. So, we should do it, but we should be very careful and thoughtful on how to do it. |
Successful completion of #43 will help with this issues. |
The text was updated successfully, but these errors were encountered: