Skip to content

Commit 3776a48

Browse files
committed
document testing
Additionally, remove unnecessary "--invoke _start" from the CI
1 parent 4bea1d0 commit 3776a48

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

.github/workflows/rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
set -o pipefail
3737
curl https://wasmtime.dev/install.sh -sSf | bash
3838
- name: Test
39-
run: CARGO_TARGET_WASM32_WASI_RUNNER="/home/runner/.wasmtime/bin/wasmtime --invoke _start --allow-unknown-exports" cargo test --target=wasm32-wasi --all-targets
39+
run: CARGO_TARGET_WASM32_WASI_RUNNER="/home/runner/.wasmtime/bin/wasmtime --allow-unknown-exports" cargo test --target=wasm32-wasi --all-targets
4040

4141
# Tests that our current minimum supported rust version compiles everything sucessfully
4242
min_rust:

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,16 @@ If CQL types `T1`, `T2`, ... map to Rust types `RustT1`, `RustT2`, ..., you can
103103

104104
If a CQL Value of type T, that's mapped to type RustT, may be a null (possible in non-`RETURNS NULL ON NULL INPUT` UDFs),
105105
the type used in the Rust function should be Option\<RustT\>.
106+
107+
## Contributing
108+
109+
In general, try to follow the same rules as in https://github.com/scylladb/scylla-rust-driver/blob/main/CONTRIBUTING.md
110+
111+
### Testing
112+
113+
This crate is meant to be compiled to a `wasm32-wasi` target and ran in a WASM runtime. The tests that use WASM-specific code will most likely not succeed when executed in a different way (in particular, with a simple `cargo test` command).
114+
115+
For example, if you have the [wasmtime](https://docs.wasmtime.dev/cli-install.html) runtime installed and in `PATH`, you can use the following command to run tests:
116+
```text
117+
CARGO_TARGET_WASM32_WASI_RUNNER="wasmtime --allow-unknown-exports" cargo test --target=wasm32-wasi
118+
```

scylla-udf-macros/src/export_udf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ fn get_exported_fun(
7474
}
7575

7676
/// The macro transforms a function:
77-
/// ```
77+
/// ```compile_fail
7878
/// #[scylla_udf::export_udf]
7979
/// fn foo(arg1: u32, arg2: String) -> u32 {
8080
/// arg1 + arg2.len() as u32
8181
/// }
8282
/// ```
8383
/// into something like:
84-
/// ```
84+
/// ```compile_fail
8585
/// fn foo(arg1: u32, arg2: String) -> u32 {
8686
/// arg1 + arg2.len() as u32
8787
/// }

0 commit comments

Comments
 (0)