summaryrefslogtreecommitdiff
path: root/test/utils.py
Commit message (Collapse)AuthorAgeFilesLines
* Make run-spec-wasm2c platform-consistent (#2335)Soni L2023-11-281-6/+0
|
* wasm2c: Fix test harness UB with SIMD (#2327)Soni L2023-11-121-0/+6
|
* Rename before_args to after_argsKeith Winstein2023-01-251-4/+3
|
* wasm2c: move WASM2C_CFLAGS to end of compiler command lineKeith Winstein2023-01-251-1/+1
| | | | This allows overriding flags like -O2 by appending -O0 from the env var.
* Add windows implementation of wasm2c runtime (#1843)Sam Clegg2022-03-091-3/+4
| | | | | | | All tests are now passing with cl.exe under x64. With x86 there are some test failure that I believe relate the use of the x87 registers to pass floating point numbers. I suggest we look into fixing those as a followup. Split out from #1833
* Simplification followup from #1735. NFC (#1745)Sam Clegg2021-10-191-5/+4
|
* Use subprocess.run in test/utils.py. NFC (#1735)Sam Clegg2021-10-191-14/+7
| | | Also remove unused clean_stdout/clean_stderr.
* Remove some python3-ism left over in the test suite (#1326)Sam Clegg2020-02-041-5/+2
|
* Remove support for python2 (#1321)Sam Clegg2020-01-311-2/+1
|
* Switch python indentation from 2-space to 4-space (#1145)Sam Clegg2019-08-151-129/+129
| | | | | | | | pep8 specifies 4 space indentation. The use of 2 spaces is, I believe, a historical anomaly where certain large organizations such as google chose 2 over 4 and have yet to make the switch. For a project like wabt with little python code I think the cost of switching is small enough to justify the churn.
* Add wasm2c tool (#710)Ben Smith2018-01-081-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add `wasm2c`, a new tool that reads a `.wasm` file and generates a C source file and its accompanying header file. The C output currently only supports gcc/clang compilers, since it uses builtins for some functionality. The resulting C code is not standalone; there are runtime functions that must be provided, as well as pointers to all imports. The C runtime symbols that must be provided are as follows: * `void wasm_rt_trap(wasm_rt_trap_t code)`: Called when the WebAssembly code traps. This function must not return. * `u32 wasm_rt_register_func_type(u32 param_count, u32 result_count, ...)`: Register a function type with the given signature. This function must check whether this signature has already been registered and return the original index. * `void wasm_rt_allocate_memory(wasm_rt_memory_t*, u32 initial, u32 max)`: Allocate the memory buffer for the given memory object, given the number of pages. The memory must be zeroed before returning. * `u32 wasm_rt_grow_memory(wasm_rt_memory_t*, u32 delta)`: Grow memory by the given number of pages. If allocation fails, or the new pages size is larger than the maximum, return -1. Otherwise return the previous number of pages. The newly allocated memory must be zeroed. * `void wasm_rt_allocate_table(wasm_rt_table_t*, u32 initial, u32 max)`: Allocate the buffer for the given table object. The buffer must be zeroed before returning. * `u32 wasm_rt_call_stack_depth`: A symbol that tracks the current call stack depth. If this value exceeds `WASM_RT_MAX_CALL_STACK_DEPTH` then a trap occurs. This value defaults to 500, but can redefined. An example implementation can be found in `spec-wasm2c-prefix.c`. All functionality from the WebAssembly MVP is supported, and the generated code passes all of the core spec tests. There is a new test tool called `run-spec-wasm2c.py` which runs the following: * `wast2json` to convert the spec test to json and wasm files * `wasm2c` to convert the wasm to C source and headers * a C compiler (default `cc`) to compile and link all C source files, including a C test runner (`spec-wasm2c-prefix.c`) * Finally, the resulting executable to produce output
* Error out of parse errors in gen-wasm.py (#505)Sam Clegg2017-06-181-2/+3
| | | | Previously gen-wasm.py would return 0 on parse errors rather than bailing out and causing tests to fail.
* Implement UTF-8 validation, update testsuite (#429)Ben Smith2017-05-191-2/+2
| | | | This is enough to pass the testuite, but doesn't yet validate utf8 strings in the text format.
* Add support for yapf python formatting tool (#276)Sam Clegg2017-01-181-6/+7
| | | | | | | | | | | | | | * Add support for yapf python formatting tool This changs adds .style.yapf to define the python style we are using. I also ran yapf over all the python files: $ yapf -i `git ls-files *.py` Going forward, we should probably add a travis test to prevent regressions. We should probably also switch to more conventional 4-space indentation, which is used by almost everybody outside of Google.
* Fix gen-spec-js.pyBen Smith2016-12-051-1/+4
| | | | This now (mostly) matches the output from the spec interpreter.
* Use a new format for the spec JSON writer/parserBen Smith2016-11-031-0/+7
| | | | | | | | | | | | | | | | | | The previous spec JSON format was defined around modules. This is because the previous spec tests would only run assertions on the most recently read module. In addition, the previous spec writer would write the assertions as new exported functions in the module, and run those. The primary reason for doing this was to allow for passing/returning i64 values, which was necessary to test in a JavaScript host. Now that the primary host for running the spec tests is wasm-interp, we no longer need do bundle assertions into the module. Also, some of the new spec tests allow running exported functions on a module that is not the most-recently-read module. The new spec test format is now defined around commands. The commands map directly to the spec format commands, e.g. `module`, `assert_invalid`, `assert_trap`, etc.
* fix the test/parse/* tests for binary_0xc (#105)Ben Smith2016-09-291-0/+3
|
* passes all testsBen Smith2016-09-291-3/+2
|
* cleanup python scripts a bitBen Smith2016-09-011-1/+2
|
* python3 supportBen Smith2016-09-011-2/+5
|
* Tests verbosity (#88)Michael Ferris2016-06-171-0/+3
| | | | | | | | | | | | | * Added option --stop to prompt after every error if we should continue execution. Added option --no-multithreaded to execute tests in series. * Added a prompt to rerun a failing test with verbose to have more info as to what happened. Added option --print-cmd in run script to see what the commands run are in console. This is useful to repro errors on local machine. Make sub script of run-tests.py to use the same output directory. * Created functions RunMultiProcess & RunSingleProcess Removed option --no-multithreaded in favor of --job 1 Code review nit fixes
* Teach test scripts about ch.exe (#87)Michael Ferris2016-06-081-2/+3
|
* always display stdout in test runnerBen Smith2016-05-161-6/+18
| | | | | We throw an exception if the executable fails, but even if that happens we still want to display stdout.
* add script to generate emscripten-exported.jsonBen Smith2016-05-131-3/+7
| | | | | It would be nicer to have this automatically integrated with the build, but this is OK for now.
* add {run-,}gen-wasm.py; used to generate .wasmBen Smith2016-04-271-8/+8
| | | | These will be useful for testing the binary reader.
* cleanup the run-*.py scriptsBen Smith2016-04-271-0/+120
|
* nicer overriding of various executables w/ testingBen Smith2016-03-211-0/+19
* run-tests.py now takes a `--d8-executable` flag * Added a `TOOL` directive to tests to reduce boilerplate * Change all tests to use the new `TOOL` directive * Factor out executable searching with fallback to find_exe.py This fixes issue #43.