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

Enable the component model by default #7821

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/wasmtime/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ impl Config {
ret.wasm_multi_value(true);
ret.wasm_bulk_memory(true);
ret.wasm_simd(true);
#[cfg(feature = "component-model")]
ret.wasm_component_model(true);
ret.wasm_backtrace_details(WasmBacktraceDetails::Environment);

// This is on-by-default in `wasmparser` since it's a stage 4+ proposal
Expand Down
2 changes: 1 addition & 1 deletion src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl RunCommon {

#[cfg(feature = "component-model")]
fn ensure_allow_components(&self) -> Result<()> {
if self.common.wasm.component_model != Some(true) {
if self.common.wasm.component_model == Some(false) {
bail!("cannot execute a component without `--wasm component-model`");
}

Expand Down
23 changes: 23 additions & 0 deletions tests/all/cli_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,7 @@ fn component_missing_feature() -> Result<()> {
let wasm = build_wasm(path)?;
let output = get_wasmtime_command()?
.arg("-Ccache=n")
.arg("-Wcomponent-model=n")
.arg(wasm.path())
.output()?;
assert!(!output.status.success());
Expand All @@ -772,6 +773,7 @@ fn component_missing_feature() -> Result<()> {
// also tests with raw *.wat input
let output = get_wasmtime_command()?
.arg("-Ccache=n")
.arg("-Wcomponent-model=n")
.arg(path)
.output()?;
assert!(!output.status.success());
Expand All @@ -784,6 +786,27 @@ fn component_missing_feature() -> Result<()> {
Ok(())
}

#[test]
#[cfg_attr(not(feature = "component-model"), ignore)]
fn component_enabled_by_default() -> Result<()> {
let path = "tests/all/cli_tests/component-basic.wat";
let wasm = build_wasm(path)?;
let output = get_wasmtime_command()?
.arg("-Ccache=n")
.arg(wasm.path())
.output()?;
assert!(output.status.success());

// also tests with raw *.wat input
let output = get_wasmtime_command()?
.arg("-Ccache=n")
.arg(path)
.output()?;
assert!(output.status.success());

Ok(())
}

// If the text format is invalid then the filename should be mentioned in the
// error message.
#[test]
Expand Down
Loading