Skip to content
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

test: make tests work on more targets #11

Merged
merged 12 commits into from
Mar 12, 2024
Merged

test: make tests work on more targets #11

merged 12 commits into from
Mar 12, 2024

Conversation

explodingcamera
Copy link
Owner

@explodingcamera explodingcamera commented Mar 12, 2024

Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
@explodingcamera explodingcamera marked this pull request as ready for review March 12, 2024 16:12
@explodingcamera explodingcamera marked this pull request as draft March 12, 2024 16:13
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
@explodingcamera explodingcamera marked this pull request as ready for review March 12, 2024 17:48
@explodingcamera explodingcamera merged commit 398b2af into main Mar 12, 2024
5 checks passed
@drauschenbach
Copy link
Contributor

FYI, still having trouble invoking tests on Rpi4 armv7.

$ cargo test
...
   Compiling wat v1.0.71
   Compiling tinywasm-root v0.0.0 (/home/davidr/workspace/tinywasm)
error: couldn't read examples/./rust/out/tinywasm.wasm: No such file or directory (os error 2)
  --> examples/wasm-rust.rs:57:29
   |
57 |     const TINYWASM: &[u8] = include_bytes!("./rust/out/tinywasm.wasm");
   |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read examples/./rust/out/hello.wasm: No such file or directory (os error 2)
  --> examples/wasm-rust.rs:79:31
   |
79 |     const HELLO_WASM: &[u8] = include_bytes!("./rust/out/hello.wasm");
   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read examples/./rust/out/print.wasm: No such file or directory (os error 2)
   --> examples/wasm-rust.rs:109:31
    |
109 |     const HELLO_WASM: &[u8] = include_bytes!("./rust/out/print.wasm");
    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read examples/./rust/out/fibonacci.wasm: No such file or directory (os error 2)
   --> examples/wasm-rust.rs:131:35
    |
131 |     const FIBONACCI_WASM: &[u8] = include_bytes!("./rust/out/fibonacci.wasm");
    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `tinywasm-root` (example "wasm-rust") due to 4 previous errors
warning: build failed, waiting for other jobs to finish...

@explodingcamera
Copy link
Owner Author

@drauschenbach
It's a bit unfortunate that cargo still compiles these even though that example is marked as test=false, so I've now just changed it to read the Wasm dynamically, so tests still pass without those files (8477bff).

There's an explanation on what's required for these examples to run at the top of the file:

/// Examples of using WebAssembly compiled from Rust with tinywasm.
///
/// These examples are meant to be run with `cargo run --example wasm-rust <example>`.
/// For example, `cargo run --example wasm-rust hello`.
///
/// To run these, you first need to compile the Rust examples to WebAssembly:
///
/// ```sh
/// ./examples/rust/build.sh
/// ```
///
/// This requires the `wasm32-unknown-unknown` target, `binaryen` and `wabt` to be installed.
/// `rustup target add wasm32-unknown-unknown`.
/// https://github.com/WebAssembly/wabt
/// https://github.com/WebAssembly/binaryen
///

@drauschenbach
Copy link
Contributor

It's fixed now.

@explodingcamera explodingcamera deleted the platform-tests branch May 25, 2024 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tests fail to compile on aarch64 (Apple M1 Max) Tests fail to compile on armv7 (Raspberry Pi 4)
2 participants