Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/crates/c-api/tests/wasi.cc
1692 views
1
#include <wasmtime/wasi.hh>
2
3
#include <gtest/gtest.h>
4
#include <wasmtime.hh>
5
6
using namespace wasmtime;
7
8
TEST(WasiConfig, Smoke) {
9
WasiConfig config;
10
config.argv({"x"});
11
config.inherit_argv();
12
config.env({{"x", "y"}});
13
config.inherit_env();
14
EXPECT_FALSE(config.stdin_file("nonexistent"));
15
config.inherit_stdin();
16
EXPECT_FALSE(config.stdout_file("path/to/nonexistent"));
17
config.inherit_stdout();
18
EXPECT_FALSE(config.stderr_file("path/to/nonexistent"));
19
config.inherit_stderr();
20
21
WasiConfig config2;
22
if (config2.preopen_dir("nonexistent", "nonexistent", 0, 0)) {
23
Engine engine;
24
Store store(engine);
25
EXPECT_FALSE(store.context().set_wasi(std::move(config2)));
26
}
27
}
28
29