Skip to content

Commit

Permalink
⬆️ deps: bump up dependencies (#63)
Browse files Browse the repository at this point in the history
* deps: bump up wazero version to v1.7.0-w

wazero v1.7.0 enabled optimized compiler by default on amd64/arm64, which might be helpful in terms of performance.

Signed-off-by: Gaukas Wang <i@gaukas.wang>

* fix: bad error message supplied to panic

SIgned-off-by: Gaukas Wang <i@gaukas.wang>

* build: update bundled watm artifacts

Signed-off-by: Gaukas Wang <i@gaukas.wang>

* update: disable stdout/stderr passing in tests

Signed-off-by: Gaukas Wang <i@gaukas.wang>

---------

Signed-off-by: Gaukas Wang <i@gaukas.wang>
  • Loading branch information
gaukas committed Mar 18, 2024
1 parent ec93ace commit c2975bb
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 28 deletions.
4 changes: 2 additions & 2 deletions dialer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func ExampleDialer() {
panic(err)
}
if n != len(msg) {
panic(err)
panic("short write")
}

buf := make([]byte, 1024)
Expand All @@ -63,7 +63,7 @@ func ExampleDialer() {
panic(err)
}
if n != len(msg) {
panic(err)
panic("short read")
}

fmt.Println(string(buf[:n]))
Expand Down
Binary file modified examples/v0/watm/plain.go.wasm
Binary file not shown.
Binary file modified examples/v0/watm/reverse.go.wasm
Binary file not shown.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ retract (
v0.6.0 // bad LICENSE naming
)

replace github.com/tetratelabs/wazero v1.6.0 => github.com/refraction-networking/wazero v1.6.6-w
replace github.com/tetratelabs/wazero v1.7.0 => github.com/refraction-networking/wazero v1.7.0-w

require (
github.com/tetratelabs/wazero v1.6.0
github.com/tetratelabs/wazero v1.7.0
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a
google.golang.org/protobuf v1.33.0
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/refraction-networking/wazero v1.6.6-w h1:GopGAQ5/Rah0vzGImewwOrOaXFR+FmgWlgGKs1JpVlw=
github.com/refraction-networking/wazero v1.6.6-w/go.mod h1:ytl6Zuh20R/eROuyDaGPkp82O9C/DJfXAwJfQ3X6/7Y=
github.com/refraction-networking/wazero v1.7.0-w h1:fFQO1VL+fhpFWIgfZN9FPnWYhf5DTyzwzJijqg/LUm4=
github.com/refraction-networking/wazero v1.7.0-w/go.mod h1:ytl6Zuh20R/eROuyDaGPkp82O9C/DJfXAwJfQ3X6/7Y=
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a h1:Q8/wZp0KX97QFTc2ywcOE0YRjZPVIx+MXInMzdvQqcA=
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
Expand Down
4 changes: 2 additions & 2 deletions listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func ExampleListener() {
panic(err)
}
if n != len(msg) {
panic(err)
panic("short write")
}

buf := make([]byte, 1024)
Expand All @@ -57,7 +57,7 @@ func ExampleListener() {
panic(err)
}
if n != len(msg) {
panic(err)
panic("short read")
}

fmt.Println(string(buf[:n]))
Expand Down
4 changes: 2 additions & 2 deletions relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func ExampleRelay() {
panic(err)
}
if n != len(msg) {
panic(err)
panic("short write")
}

buf := make([]byte, 1024)
Expand All @@ -75,7 +75,7 @@ func ExampleRelay() {
panic(err)
}
if n != len(msg) {
panic(err)
panic("short read")
}

fmt.Println(string(buf[:n]))
Expand Down
19 changes: 12 additions & 7 deletions transport/v0/dialer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func ExampleDialer() {
panic(err)
}
if n != len(msg) {
panic(err)
panic("short write")
}

buf := make([]byte, 1024)
Expand All @@ -59,7 +59,7 @@ func ExampleDialer() {
panic(err)
}
if n != len(msg) {
panic(err)
panic("short read")
}

fmt.Println(string(buf[:n]))
Expand All @@ -84,7 +84,8 @@ func TestDialer(t *testing.T) {
func testDialerBadAddr(t *testing.T) {
// Dial
config := &water.Config{
TransportModuleBin: wasmPlain,
TransportModuleBin: wasmPlain,
ModuleConfigFactory: water.NewWazeroModuleConfigFactory(),
}

dialer, err := v0.NewDialerWithContext(context.Background(), config)
Expand All @@ -107,7 +108,8 @@ func testDialerPlain(t *testing.T) { // skipcq: GO-R1005

// Dial using water
config := &water.Config{
TransportModuleBin: wasmPlain,
TransportModuleBin: wasmPlain,
ModuleConfigFactory: water.NewWazeroModuleConfigFactory(),
}
dialer, err := v0.NewDialerWithContext(context.Background(), config)
if err != nil {
Expand Down Expand Up @@ -232,7 +234,8 @@ func testDialerReverse(t *testing.T) { // skipcq: GO-R1005

// Dial using water
config := &water.Config{
TransportModuleBin: wasmReverse,
TransportModuleBin: wasmReverse,
ModuleConfigFactory: water.NewWazeroModuleConfigFactory(),
}
dialer, err := v0.NewDialerWithContext(context.Background(), config)
if err != nil {
Expand Down Expand Up @@ -376,7 +379,8 @@ func BenchmarkDialerOutbound(b *testing.B) {

// Dial
config := &water.Config{
TransportModuleBin: wasmPlain,
TransportModuleBin: wasmPlain,
ModuleConfigFactory: water.NewWazeroModuleConfigFactory(),
}
dialer, err := v0.NewDialerWithContext(context.Background(), config)
if err != nil {
Expand Down Expand Up @@ -432,7 +436,8 @@ func BenchmarkDialerOutboundReverse(b *testing.B) {

// Dial
config := &water.Config{
TransportModuleBin: wasmReverse,
TransportModuleBin: wasmReverse,
ModuleConfigFactory: water.NewWazeroModuleConfigFactory(),
}
dialer, err := v0.NewDialerWithContext(context.Background(), config)
if err != nil {
Expand Down
19 changes: 12 additions & 7 deletions transport/v0/listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func ExampleListener() {
panic(err)
}
if n != len(msg) {
panic(err)
panic("short write")
}

buf := make([]byte, 1024)
Expand All @@ -60,7 +60,7 @@ func ExampleListener() {
panic(err)
}
if n != len(msg) {
panic(err)
panic("short read")
}

fmt.Println(string(buf[:n]))
Expand All @@ -85,7 +85,8 @@ func TestListener(t *testing.T) {
func testListenerBadAddr(t *testing.T) {
// prepare
config := &water.Config{
TransportModuleBin: wasmPlain,
TransportModuleBin: wasmPlain,
ModuleConfigFactory: water.NewWazeroModuleConfigFactory(),
}

_, err := config.ListenContext(context.Background(), "tcp", "256.267.278.289:2023")
Expand All @@ -97,7 +98,8 @@ func testListenerBadAddr(t *testing.T) {
func testListenerPlain(t *testing.T) { // skipcq: GO-R1005
// prepare
config := &water.Config{
TransportModuleBin: wasmPlain,
TransportModuleBin: wasmPlain,
ModuleConfigFactory: water.NewWazeroModuleConfigFactory(),
}

testLis, err := config.ListenContext(context.Background(), "tcp", "localhost:0")
Expand Down Expand Up @@ -219,7 +221,8 @@ func testListenerPlain(t *testing.T) { // skipcq: GO-R1005
func testListenerReverse(t *testing.T) { // skipcq: GO-R1005
// prepare
config := &water.Config{
TransportModuleBin: wasmReverse,
TransportModuleBin: wasmReverse,
ModuleConfigFactory: water.NewWazeroModuleConfigFactory(),
}

testLis, err := config.ListenContext(context.Background(), "tcp", "localhost:0")
Expand Down Expand Up @@ -359,7 +362,8 @@ func testListenerPartialWATM(t *testing.T) {
func BenchmarkInboundListener(b *testing.B) {
// prepare
config := &water.Config{
TransportModuleBin: wasmPlain,
TransportModuleBin: wasmPlain,
ModuleConfigFactory: water.NewWazeroModuleConfigFactory(),
}

testLis, err := config.ListenContext(context.Background(), "tcp", "localhost:0")
Expand Down Expand Up @@ -407,7 +411,8 @@ func BenchmarkInboundListener(b *testing.B) {
func BenchmarkInboundListenerReverse(b *testing.B) {
// prepare
config := &water.Config{
TransportModuleBin: wasmReverse,
TransportModuleBin: wasmReverse,
ModuleConfigFactory: water.NewWazeroModuleConfigFactory(),
}

testLis, err := config.ListenContext(context.Background(), "tcp", "localhost:0")
Expand Down
9 changes: 9 additions & 0 deletions transport/v0/not_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ var (
wasmReverse []byte
)

//// Gaukas: uncomment the following code once we decide to require
//// go1.21 as minimum version
// func init() {
// var programLevel = new(slog.LevelVar) // Info by default
// h := slog.NewJSONHandler(os.Stderr, &slog.HandlerOptions{Level: programLevel})
// slog.SetDefault(slog.New(h))
// programLevel.Set(slog.LevelError)
// }

func benchmarkUnidirectionalStream(b *testing.B, wrConn, rdConn net.Conn) {
var sendMsg []byte = make([]byte, 1024)
_, err := rand.Read(sendMsg)
Expand Down
10 changes: 6 additions & 4 deletions transport/v0/relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func ExampleRelay() {
panic(err)
}
if n != len(msg) {
panic(err)
panic("short write")
}

buf := make([]byte, 1024)
Expand All @@ -71,7 +71,7 @@ func ExampleRelay() {
panic(err)
}
if n != len(msg) {
panic(err)
panic("short read")
}

fmt.Println(string(buf[:n]))
Expand Down Expand Up @@ -107,7 +107,8 @@ func testRelayPlain(t *testing.T) { // skipcq: GO-R1005

// setup relay
config := &water.Config{
TransportModuleBin: wasmPlain,
TransportModuleBin: wasmPlain,
ModuleConfigFactory: water.NewWazeroModuleConfigFactory(),
}
relay, err := v0.NewRelayWithContext(context.Background(), config)
if err != nil {
Expand Down Expand Up @@ -235,7 +236,8 @@ func testRelayReverse(t *testing.T) { // skipcq: GO-R1005

// setup relay
config := &water.Config{
TransportModuleBin: wasmReverse,
TransportModuleBin: wasmReverse,
ModuleConfigFactory: water.NewWazeroModuleConfigFactory(),
}
relay, err := water.NewRelayWithContext(context.Background(), config)
if err != nil {
Expand Down
Binary file modified transport/v0/testdata/plain.wasm
Binary file not shown.
Binary file modified transport/v0/testdata/reverse.wasm
Binary file not shown.

0 comments on commit c2975bb

Please sign in to comment.