Fuzzer: Log exported globals#8466
Conversation
|
Looks like this messes with the auto-update script for the lit test... hmm. Otherwise though this should be ready. |
| try { | ||
| actualValue = global.value; | ||
| } catch (e) { | ||
| if (e.message.startsWith('get WebAssembly.Global.value')) { |
There was a problem hiding this comment.
-
Can we check the type of the error rather than the message? Error messages are not standardized and may differ between implementations.
-
Maybe we should print something else to distinguish this case from an exported global actually containing null.
There was a problem hiding this comment.
- I think it's just a generic RuntimeError, so the text is really all we have to go on...
- Hmm, but we'd need to print some value in other fuzzer places too. I don't think this is ambiguous - this happens only for the illegal types. So if the type is v128, we know 'null' means "i can't print this" etc.
There was a problem hiding this comment.
-
There aren't any other errors that could happen here, right? Maybe we can just detect the presence of any error at all.
-
What if the exported global holds a null anyref? Wouldn't that print
nullas well?
There was a problem hiding this comment.
- At minimum there could be a VM bug that causes some other kind of error, and we would want to differentiate that. But also maybe the spec has more..? It just seems better to be precise.
- Yes, a null anyref will print null, but the type + the value is unambiguous. If the type is illegal, it will print null. We could also put a string here "illegal value" or such?
There was a problem hiding this comment.
Yes, "illegal value" or "failed conversion" or something like that sgtm.
| // Log the global's value. (We use "calling" here to match the output | ||
| // for calls, which simplifies the fuzzer.) | ||
| std::cout << "[fuzz-exec] calling " << exp->name << "\n"; |
There was a problem hiding this comment.
Can we remove "calling" everywhere as a follow-up?
There was a problem hiding this comment.
Any idea for what to replace it with? We need something to differentiate it from other things. I don't have a good idea myself...
There was a problem hiding this comment.
Hmm, yeah, maybe just "export" is good. My brain was stuck looking for a verb 😄 Will do in a followup.
|
I worked around the auto-updater test issue with a tiny manual test. We really don't need any more here. |
We already exported globals in the fuzzer, but did not do anything with
them. This logs out their values, at the same time that we log out the
values returned from calling exported functions (and using the same
reordering etc.).