From 44f44374f52229c5e1088fc6d25614360cb26861 Mon Sep 17 00:00:00 2001 From: Qining Date: Mon, 3 Dec 2018 12:47:41 -0500 Subject: [PATCH] Configurable default replay cache path for remote ssh devices (#2414) --- core/os/device/remotessh/device.go | 7 +++++++ gapir/client/session.go | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/core/os/device/remotessh/device.go b/core/os/device/remotessh/device.go index 9e9fb7b439..e831a93742 100644 --- a/core/os/device/remotessh/device.go +++ b/core/os/device/remotessh/device.go @@ -47,6 +47,8 @@ type Device interface { MakeTempDir(ctx context.Context) (string, func(ctx context.Context), error) // WriteFile writes the given file into the given location on the remote device WriteFile(ctx context.Context, contents io.Reader, mode os.FileMode, destPath string) error + // DefaultReplayCacheDir returns the default path for replay resource caches + DefaultReplayCacheDir() string } // MaxNumberOfSSHConnections defines the max number of ssh connections to each @@ -279,3 +281,8 @@ func GetConnectedDevice(ctx context.Context, c Configuration) (Device, error) { return b, nil } + +// DefaultReplayCacheDir implements Device interface +func (b *binding) DefaultReplayCacheDir() string { + return "" +} diff --git a/gapir/client/session.go b/gapir/client/session.go index 182682cd42..0288651676 100644 --- a/gapir/client/session.go +++ b/gapir/client/session.go @@ -118,6 +118,10 @@ func (s *session) newRemote(ctx context.Context, d remotessh.Device, abi *device args = append(args, launchArgs...) if forceEnableDiskCache { args = append(args, "--enable-disk-cache") + if len(d.DefaultReplayCacheDir()) > 0 { + args = append(args, "--disk-cache-path", d.DefaultReplayCacheDir()) + } + args = append(args, "--cleanup-on-disk-cache") } gapir, err := layout.Gapir(ctx, abi)