Stream: git-wasmtime

Topic: wasmtime / issue #6794 cli: unable to `--invoke` a functi...


view this post on Zulip Wasmtime GitHub notifications bot (Aug 02 2023 at 23:11):

abrown opened issue #6794:

Test Case

(module
  (func (export "foo") (param $a i32) (result i32)
    (local.get $a)))

Steps to Reproduce

$ target/debug/wasmtime run --disable-cache --invoke foo 42 test.wat

Expected Results

Print 42.

Actual Results

Error: if you're trying to run a precompiled module, pass --allow-precompiled

Caused by:
    0: failed to read input file: 42
    1: No such file or directory (os error 2)

Versions and Environment

Wasmtime version or commit: latest main (5200159)

Operating system: Linux

Architecture: x86

Extra Info

This is probably some weirdness related to clap and how it parses the CLI arguments. For another data point, when I run target/debug/wasmtime run --disable-cache test.wat --invoke foo 42 then nothing happens at all (the module is JIT-compiled but the Wasmtime CLI does not know understand that it should invoke foo). I figured it would be good to raise this as an issue in case this has already been resolved by work on #6741 (cc: @alexcrichton?).

view this post on Zulip Wasmtime GitHub notifications bot (Aug 02 2023 at 23:11):

abrown added the bug label to Issue #6794.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 02 2023 at 23:16):

jameysharp commented on issue #6794:

Have you tried wasmtime run --invoke foo test.wat 42?

Based on the output of wasmtime help run I'd expect --invoke to eat one following argument, giving the name of the function to invoke; then, the non-option arguments need to have the input file first, optionally followed by any arguments to pass along.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 03 2023 at 15:50):

abrown commented on issue #6794:

Yeah, that works. I guess what is confusing is that I would expect target/debug/wasmtime run --disable-cache test.wat --invoke foo 42 to work but it does not.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 03 2023 at 15:50):

abrown edited a comment on issue #6794:

Yeah, that works. I guess what is confusing is that I would expect target/debug/wasmtime run --disable-cache test.wat --invoke foo 42 to work then but it does not.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 03 2023 at 16:22):

jameysharp commented on issue #6794:

I totally understand expecting that to work. I think what's happening there is that --invoke is being interpreted as an argument to test.wat instead of a Wasmtime option, since it comes after a non-option argument.

This is clearly a bug in the sense that the interpretation of this option is confusing and it'd be great to do better, but let's consider that to be a part of #6741 and close this as a duplicate. I'm glad we've confirmed that it is at least possible to --invoke a function with arguments.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 03 2023 at 16:22):

jameysharp closed issue #6794:

Test Case

(module
  (func (export "foo") (param $a i32) (result i32)
    (local.get $a)))

Steps to Reproduce

$ target/debug/wasmtime run --disable-cache --invoke foo 42 test.wat

Expected Results

Print 42.

Actual Results

Error: if you're trying to run a precompiled module, pass --allow-precompiled

Caused by:
    0: failed to read input file: 42
    1: No such file or directory (os error 2)

Versions and Environment

Wasmtime version or commit: latest main (5200159)

Operating system: Linux

Architecture: x86

Extra Info

This is probably some weirdness related to clap and how it parses the CLI arguments. For another data point, when I run target/debug/wasmtime run --disable-cache test.wat --invoke foo 42 then nothing happens at all (the module is JIT-compiled but the Wasmtime CLI does not know understand that it should invoke foo). I figured it would be good to raise this as an issue in case this has already been resolved by work on #6741 (cc: @alexcrichton?).


Last updated: Oct 23 2024 at 20:03 UTC