github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/syz-verifier/rpcserver_test.go (about)

     1  // Copyright 2021 syzkaller project authors. All rights reserved.
     2  // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  package main
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/google/go-cmp/cmp"
    10  	"github.com/google/syzkaller/pkg/rpctype"
    11  )
    12  
    13  func TestConnect(t *testing.T) {
    14  	vrf := createTestVerifier(t)
    15  	vrf.pools = make(map[int]*poolInfo)
    16  	vrf.pools[1] = &poolInfo{}
    17  
    18  	a := &rpctype.RunnerConnectArgs{
    19  		Pool: 1,
    20  		VM:   1,
    21  	}
    22  
    23  	r := &rpctype.RunnerConnectRes{}
    24  
    25  	if err := vrf.srv.Connect(a, r); err != nil {
    26  		t.Fatalf("srv.Connect failed: %v", err)
    27  	}
    28  
    29  	if diff := cmp.Diff(&rpctype.RunnerConnectRes{CheckUnsupportedCalls: true}, r); diff != "" {
    30  		t.Errorf("connect result mismatch (-want +got):\n%s", diff)
    31  	}
    32  }