Skip to content

Conversation

@yoshuawuyts
Copy link
Member

Hi! This is a port of Wasmtime's async-closed-stream.rs test to WAST. The core of this test include bindings to the following WIT:

interface closed-stream {
  get: func() -> stream<u8>;
}

With the core of the test being the following (note that it's never actually invoked):

impl Guest for Component {
    fn get() -> StreamReader<u8> {
        bindings::wit_stream::new().1
    }
}
fn main() {}

This is the first time I'm writing WAST, Wasm Bytecode, and Lisp. The test locally seems to pass, but since it doesn't actually invoke anything all I can tell is that it's syntactically well-formed. I'd like to port more of the Wastime async tests to WAST in the future, so I figured I'd start with the simplest one. That said though: I would really appreciate a review on this, as I'm at best 60% confident this does what it's supposed to. Thanks!

@yoshuawuyts yoshuawuyts changed the title Test closed streams. Port Wasmtime's async-closed-stream test Oct 20, 2025
@yoshuawuyts yoshuawuyts marked this pull request as draft October 20, 2025 15:32
@yoshuawuyts
Copy link
Member Author

@yoshuawuyts yoshuawuyts marked this pull request as ready for review October 21, 2025 11:48
@yoshuawuyts
Copy link
Member Author

Okay, test should be all update now. What the code actually did was test that if we attempt to read from a stream whose writer side has been dropped, the reader should return the Dropped status when we try to read from it.

The opposite side of this test should probably be written at some point too, but for now I'm going to settle on just porting the existing tests as-is. Thanks!

@lukewagner
Copy link
Member

Thanks!

@lukewagner lukewagner merged commit da19bf5 into WebAssembly:main Oct 23, 2025
1 check passed
@yoshuawuyts yoshuawuyts deleted the closed-stream branch October 23, 2025 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants