wasmer_integration_tests_cli/
fixtures.rs

1//! Paths for commonly used test files.
2
3use std::path::{Path, PathBuf};
4
5use crate::{asset_path, c_asset_path};
6
7pub fn resources() -> PathBuf {
8    Path::new(env!("CARGO_MANIFEST_DIR")).join("resources")
9}
10
11pub fn packages() -> PathBuf {
12    Path::new(env!("CARGO_MANIFEST_DIR"))
13        .join("tests")
14        .join("packages")
15}
16
17pub fn php() -> (PathBuf, PathBuf, PathBuf) {
18    let root = Path::new(env!("CARGO_MANIFEST_DIR"));
19    let resources = resources().join("php");
20    (
21        root.join("tests").join("wasm").join("php.wasm"),
22        resources.clone(),
23        resources.join("db"),
24    )
25}
26
27/// A WEBC file containing the Python interpreter, compiled to WASI.
28pub fn python() -> PathBuf {
29    c_asset_path().join("python--python@3.13.5.webc")
30}
31
32/// A WEBC file containing bash.
33pub fn bash() -> PathBuf {
34    Path::new(env!("CARGO_MANIFEST_DIR"))
35        .join("tests")
36        .join("webc")
37        .join("bash-1.0.16-f097441a-a80b-4e0d-87d7-684918ef4bb6.webc")
38}
39
40/// A WEBC file containing `wat2wasm`, `wasm-validate`, and other helpful
41/// WebAssembly-related commands.
42pub fn wabt() -> PathBuf {
43    c_asset_path().join("wabt-1.0.37.wasmer")
44}
45
46/// The QuickJS interpreter, compiled to a WASI module.
47pub fn qjs() -> PathBuf {
48    c_asset_path().join("qjs.wasm")
49}
50
51/// The `wasmer.toml` file for QuickJS.
52pub fn qjs_wasmer_toml() -> PathBuf {
53    c_asset_path().join("qjs-wasmer.toml")
54}
55
56/// A `*.wat` file which calculates fib(40) and exits with no output.
57pub fn fib() -> PathBuf {
58    asset_path().join("fib.wat")
59}
60
61/// A `*.wat` file with no `_start()` function.
62pub fn wat_no_start() -> PathBuf {
63    asset_path().join("no_start.wat")
64}