docs: Document how to create and build ABC-only tests

This commit is contained in:
David Wendt 2021-09-18 20:48:39 +00:00 committed by kmeisthax
parent f298a23ec8
commit 841337e7e4
1 changed files with 5 additions and 2 deletions

View File

@ -145,13 +145,16 @@ To add a test here, create a .swf file that runs `trace()` statements. You can d
* [`mxmlc`](https://helpx.adobe.com/air/kb/archived-air-sdk-version.html) (ActionScript 3 only)
* if you create a file `test.as` with a `class Test`, you can compile it using `mxmlc Test.as`. `mxmlc` is located in the `bin` folder of the downloadable AIR SDK.
* you may want to use docker instead -- something like `docker run -it --rm -v ${PWD}:/src jeko/airbuild mxmlc ./Test.as` works well
* [`rabcasm`](https://github.com/CyberShadow/RABCDAsm) (ActionScript 3 only)
* This test allows writing AVM2 bytecode sequences directly, without intermediate AS3 code. This is primarily useful for testing opcodes that aren't generated by the above-mentioned AS3 compilers.
* `rabcasm` cannot generate SWF files from scratch. Instead, you must first generate a SWF from the above mentioned methods, then extract and disassemble its ABC with `abcexport` and `rabcdasm`.
* Once you have modified your bytecode, you must reassemble and inject it into the movie with `rabcasm` and `abcreplace`.
* If you are adding a new test, commit both your SWF source (.fla and/or .as files) as well as the modified bytecode (.abc files and test-0 folder).
Run the .swf in Flash Player and create a file `output.txt` with the contents of the trace statements. Add the `output.txt`, `test.swf` and either the `test.as` or `test.fla` file to a directory under `core/tests/swfs/avm1` (or `avm2`) named after what your test tests, and add a line in `regression_tests.rs` to have Ruffle run it.
Running `cargo test [your test]` will run the .swf in Ruffle and check the `trace()` output against `output.txt`.
For opcode tests involving running particular opcodes, you can use [`RABCDAsm`](https://github.com/CyberShadow/RABCDAsm) to deassemble an existing SWF, change the generated asasm, then reassemble.
## Commit Message Guidelines
Here is a sample commit message: