Documentation ¶
Overview ¶
Package dutfs provides remote file system operations on DUT.
Remote tests usually define their own gRPC services for respective testing scenarios, but if tests want to do only a few basic file operations on DUT, they can choose to use this package to avoid defining gRPC services.
Index ¶
- Constants
- type Client
- func (c *Client) Exists(ctx context.Context, name string) (bool, error)
- func (c *Client) ReadDir(ctx context.Context, dirname string) ([]os.FileInfo, error)
- func (c *Client) ReadFile(ctx context.Context, name string) ([]byte, error)
- func (c *Client) Remove(ctx context.Context, name string) error
- func (c *Client) RemoveAll(ctx context.Context, name string) error
- func (c *Client) Stat(ctx context.Context, name string) (os.FileInfo, error)
- func (c *Client) TempDir(ctx context.Context, dir, pattern string) (string, error)
- func (c *Client) WriteFile(ctx context.Context, name string, content []byte, mode os.FileMode) error
Constants ¶
const ServiceName = "tast.cros.baserpc.FileSystem"
ServiceName is the name of the gRPC service this package uses to access remote file system on DUT.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides remote file system operations on DUT.
func NewClient ¶
func NewClient(conn *grpc.ClientConn) *Client
NewClient creates Client from an existing gRPC connection. conn must be connected to the cros bundle.
func (*Client) ReadDir ¶
ReadDir reads the directory named by dirname and returns a list of directory entries sorted by filename.
func (*Client) TempDir ¶
TempDir creates a temporary directory. If pattern includes a "*", the random string replaces the last "*". If dir is the empty string, TempDir uses the default directory for temporary files. TempDir returns the name of the new directory. The remote implementation calls ioutil.TempDir; see that for more details.