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-0.1.0.wasmer")
30}
31
32/// A WEBC file containing the coreutils.
33pub fn coreutils() -> PathBuf {
34    Path::new(env!("CARGO_MANIFEST_DIR"))
35        .join("tests")
36        .join("webc")
37        .join("coreutils-1.0.16-e27dbb4f-2ef2-4b44-b46a-ddd86497c6d7.webc")
38}
39
40/// A WEBC file containing bash.
41pub fn bash() -> PathBuf {
42    Path::new(env!("CARGO_MANIFEST_DIR"))
43        .join("tests")
44        .join("webc")
45        .join("bash-1.0.16-f097441a-a80b-4e0d-87d7-684918ef4bb6.webc")
46}
47
48/// A WEBC file containing `wat2wasm`, `wasm-validate`, and other helpful
49/// WebAssembly-related commands.
50pub fn wabt() -> PathBuf {
51    c_asset_path().join("wabt-1.0.37.wasmer")
52}
53
54/// A WEBC file containing the WCGI static server.
55pub fn static_server() -> PathBuf {
56    c_asset_path().join("staticserver.webc")
57}
58
59/// The QuickJS interpreter, compiled to a WASI module.
60pub fn qjs() -> PathBuf {
61    c_asset_path().join("qjs.wasm")
62}
63
64pub fn hello() -> PathBuf {
65    Path::new(env!("CARGO_MANIFEST_DIR"))
66        .join("tests")
67        .join("webc")
68        .join("hello-0.1.0-665d2ddc-80e6-4845-85d3-4587b1693bb7.webc")
69}
70
71/// The `wasmer.toml` file for QuickJS.
72pub fn qjs_wasmer_toml() -> PathBuf {
73    c_asset_path().join("qjs-wasmer.toml")
74}
75
76/// A `*.wat` file which calculates fib(40) and exits with no output.
77pub fn fib() -> PathBuf {
78    asset_path().join("fib.wat")
79}
80
81/// A `*.wat` file with no `_start()` function.
82pub fn wat_no_start() -> PathBuf {
83    asset_path().join("no_start.wat")
84}