summaryrefslogtreecommitdiff
path: root/test/spec/loop.txt
Commit message (Collapse)AuthorAgeFilesLines
* update br_table validation rule + enforce module validity in spectest-interp ↵Keith Winstein2022-04-131-1/+1
| | | | (#1895)
* Fix function body start/end locations in wasm-validate (#1842)Sam Clegg2022-03-021-5/+5
| | | | | | | | | | For text validation, this means the error is always correctly reported on the final expression in the function. For binary validation, this means that we report the byte after the last instruction in the function as the failure location. This is in line with other binary validation reports. For example, for `type mismatch in i32.add` we report the validation error at the byte *after* the add instruction.
* Remove check from binary-reader-interp.cc that the validator already ↵Sam Clegg2021-12-131-4/+4
| | | | | | | | | | catches. NFC (#1784) If you leave stuff on the stack at the end of an initializer expression use the same mechanims to report the error as we do for functions etc. In addition, improve such errors so its more obvious what is going on.
* Add error locations to BinaryReaderInterp (#1780)Sam Clegg2021-12-091-27/+27
| | | | I think it was always intended to work this way but was left as a TODO.
* Update testsuite (#1424)Ben Smith2020-05-131-17/+117
| | | | | | | Includes the three merged proposals (nontrapping-float-to-int, sign-extension, multi-value). It also has one bug fix when parsing table limits (when the min or max size does not fit in a 32-bit int).
* Update testsuite (#1047)Ben Smith2019-03-251-5/+14
|
* Update testsuite (#942)Ben Smith2018-11-051-12/+12
| | | | Also fix bug when parsing elem/data segment; the table/memory index is stored as an LEB128, not a U8.
* Update testsuite (#901)Ben Smith2018-08-241-12/+12
|
* Fix run-tests.py when STDIN_FILE is used > 1 times (#711)Ben Smith2018-01-091-13/+13
| | | | | | | | | | Each test should be run with its own directory of outputs, so the tests can be run in parallel without clobbering results. Since I added wasm2c, the spec `.wast` files were being used twice, but using the same output directory. This would often work properly in a full run, but was flaky, since they both write `.json` and `.wasm` files with the same names. This fix gives them their own directories by always using the directory name of the test.
* Use `.wat` extension for wast2json-generated files (#669)Ben Smith2017-11-131-2/+2
| | | Fixes #668.
* Better type-checking errors (#662)Ben Smith2017-10-301-9/+9
| | | | | | | | | | | | | | | | Instead of printing errors on every failure, accumulate errors for each operation. If any fails, then print a message. It changes errors such as: ``` error: type mismatch in i64.store, expected i32 but got f32. error: type mismatch in i64.store, expected i64 but got i32. ``` to: ``` error: type mismatch in i64.store, expected [i32, i64] but got [f32, i32] ```
* Remove BinaryErrorHandler, rename SourceErrorHandler (#553)Ben Smith2017-07-061-11/+11
| | | | | | | Since SourceErrorHandler can support binary locations, it doesn't make much sense to have two different error handlers. There is now only an ErrorHandler base class, and the first argument specifies whether the error handler is expecting text or binary locations.
* Update testsuite; more lexer/parser changes (#484)Ben Smith2017-06-111-1/+9
| | | | | | | | | | | | | | | | | | | | * Add support for quoted modules: `(module quote "...")` * Binary modules must be annotated: `(module binary "...")` * Multiple result blocks are no longer a parser error: `(func (result i32) (result i32) ...)` * Function types can specify unused bind variables: `(type (func (param $foo)))` * Rename `RawModule` -> `ScriptModule`. This encapsulates a module that may not be parsed yet, whether binary or "quoted". * Validate load/store offsets and alignment in the parser, not in the validator. The spec tests assume that you can catch these errors with `assert_malformed`. * Parse wast files in `wasm-interp` when checking malformed/invalid/etc. modules. This allows us to run all assertions at the same time, which is nice. `wasm-interp` should probably be renamed, though. * Two tests in `type.wast` fail because they use: `(assert_invalid (module quote "..."))`. I'd prefer that we don't support this, since it's unnecessary, and additional work. I'll fix in a follow-up CL if we decide this is worth keeping.
* Update testsuite; various lexing/parsing fixes (#482)Ben Smith2017-06-071-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Update testsuite; various lexing/parsing fixes Lexer changes: * Switch re2c parser to UTF-8 parser. This can almost be done "for free" with a flag, but required a bit of work to allow us to catch malformed UTF-8 as well. * Change the re2c fill value to 0xff, since it's never a valid UTF-8 byte. * Allow for more reserved tokens (basically any ascii aside from parentheses, double-quote, and semi-colon) * Remove "infinity" from lexer, only "inf" is allowed now. * Change definition of EOF token, it was implemented incorrectly. The correct way to handle it is to only return it from FILL when there is no more data to fill. * \r is a valid escape. Parser changes: * Changes to match the spec parser: - block signatures use (result <type>) syntax - func/global/table/memory can have multiple inline exports - inline imports are handled in func definition instead of import definition - allow for inline modules (i.e. no "(module ...)" s-expr required) * Remove FuncField. This was previously used for parsing params/results/locals, but it's less code to just parse right-recursive (i.e. backward) and insert everything at the front. This requires reversing the indexes in the BindingHash too. * Remove the nasty macros `APPEND_FIELD_TO_LIST`, `APPEND_ITEM_TO_VECTOR`, `APPEND_INLINE_EXPORT`, and `CHECK_IMPORT_ORDERING`. This behavior is all handled by `append_module_fields` now. * All inline imports/exports are handled by returning additional ModuleFields in a list. This removes the need for `OptionalExport`, `ExportedFunc`, `ExportedGlobal`, `ExportedTable`, and `ExportedMemory`. * Use "_opt" suffix instead of "non_empty_" prefix, e.g.: - text_list => text_list_opt, non_empty_text_list => text_list * The locations changed for some symbols, typically the use the name following the LPAR now, e.g. (import ^^^^^^ * Add PPA for re2c 0.16 * add -y to skip confirmation on travis
* Use classes + virtual functions for BinaryReader (#376)Ben Smith2017-03-301-9/+9
| | | | | | | | | | | | | | | This adds a few new classes: * BinaryReader: the abstract base class * BinaryReaderNop: implements all of BinaryReader, but does nothing * BinaryReaderLogging: logs calls through BinaryReader, and forwards to another BinaryReader Typically this means we can remove the Context structs from these implementations, since that data can just move into the BinaryReader subclasses. I also took the opportunity to rename the new member functions to MixedCase instead of snake_case, since that's more common in C++.
* Update testsuite (#311)Ben Smith2017-02-231-4/+13
| | | | | | Fixed a few typechecker errors: * br_table must have consistent type signature for all branch targets * if without else cannot have a signature
* Full typechecking for unreachable code (#302)Ben Smith2017-02-141-1/+1
| | | | | | | | | | | | | | | The typechecking is now shared between the validator and binary-reader-interpreter as well. * Shared the various LabelType enumerations -> WabtLabelType. * Fixed the "invalid depth" errors, the max value was incorrect. * Removed some tests that aren't useful anymore: - interp/if-then-br hasn't been useful for a while, but now is even less so because it doesn't validate without dropping the i32.const from the true branch - typecheck/bad-br-multi-type isn't possible because the block must specify the signature for the br. - typecheck/bad-label-multi-type used to test matching signature for fallthrough and br, but isn't possible because of block signatures.
* Remove assert_{invalid,malformed} checks from wast2wast (#296)Ben Smith2017-01-301-52/+0
| | | | | | | | Now that assert_invalid is checked by wasm-interp, all spec assertions can be handled by the interpreter. Having a subset that are also handled by wast2wasm is not useful. Also, there was a bug in the option parser where passing an option that didn't match could still work if a prefix was valid.
* Implement assert_invalid for wasm-interp (#294)Ben Smith2017-01-271-1/+19
|
* Update test/run-tests.py (#255)Ben Smith2017-01-051-13/+13
| | | | | * Write all intermediate output to out/ * Use real paths for all test names (i.e. include "test/") * A few Python3 fixes
* Update spec testsBen Smith2016-11-071-16/+0
|
* Fix most of the spec testsBen Smith2016-10-051-51/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | The only ones that are failing are imports, exports, linking and start. Fixes: * Make sure to assign loc_ for WasmVar * Imports must occur before any definition, not just a definition of the same kind * Check that load/store alignment is not larger than natural alignment * Always check type stack at the end of the check_block; that way an empty block is still validated * Only allow one memory or table, including imports * Don't allow importing or exporting mutable globals * Loop label signature is for the fallthrough at the bottom, not the branch target. This was implemented properly in the AST checker, but not in binary-reader-interpreter * `top_type_is_any` will check if there is ANY anywhere on the type stack; previously this check did not look past the top label's type stack limit * `drop_types_for_return` may be called without having enough values on the type stack; for example, at the end of a function the ends with return * properly handle cleaning up the type stack for the interpreter when branching to the implicit function label * rename invoke -> action a few places
* passes all the spec testsBen Smith2016-09-291-48/+56
|
* fix the interp/ tests, move the spec tests outBen Smith2016-09-291-0/+73
Mostly just requires proper implementation of drop/tee_local in wasm-binary-reader-interpreter.c and wasm-interpreter.c.