Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Attributes | List of all members
flavor.ssh.SSHFlavor Class Reference
Inheritance diagram for flavor.ssh.SSHFlavor:
flavor.default.DefaultFlavor flavor.chromebook.ChromebookFlavor

Public Member Functions

 __init__ (self, m, app_name)
 
 user_ip (self)
 
 ssh (self, title, *cmd, **kwargs)
 
 ensure_device_dir (self, path)
 
 install (self)
 
 create_clean_device_dir (self, path)
 
 read_file_on_device (self, path, **kwargs)
 
 remove_file_on_device (self, path)
 
 scp_device_path (self, device_path)
 
 copy_file_to_device (self, host_path, device_path)
 
 step (self, name, cmd, **kwargs)
 
- Public Member Functions inherited from flavor.default.DefaultFlavor
 device_path_join (self, *args)
 
 copy_directory_contents_to_device (self, host_dir, device_dir)
 
 copy_directory_contents_to_host (self, device_dir, host_dir)
 
 create_clean_host_dir (self, path)
 
 cleanup_steps (self)
 

Public Attributes

 app_name
 
 user_ip
 
- Public Attributes inherited from flavor.default.DefaultFlavor
 app_name
 
 module
 
 m
 
 device_dirs
 
 host_dirs
 

Protected Attributes

 _user_ip
 
- Protected Attributes inherited from flavor.default.DefaultFlavor
 _chrome_path
 

Additional Inherited Members

- Protected Member Functions inherited from flavor.default.DefaultFlavor
 _run (self, title, cmd, infra_step=False, **kwargs)
 
 _py (self, title, script, infra_step=True, args=())
 

Detailed Description

Definition at line 18 of file ssh.py.

Constructor & Destructor Documentation

◆ __init__()

flavor.ssh.SSHFlavor.__init__ (   self,
  m,
  app_name 
)

Reimplemented from flavor.default.DefaultFlavor.

Reimplemented in flavor.chromebook.ChromebookFlavor.

Definition at line 20 of file ssh.py.

20 def __init__(self, m, app_name):
21 super(SSHFlavor, self).__init__(m, app_name)
22 self._user_ip = ''
23

Member Function Documentation

◆ copy_file_to_device()

flavor.ssh.SSHFlavor.copy_file_to_device (   self,
  host_path,
  device_path 
)
Like shutil.copyfile, but for copying to a connected device.

Reimplemented from flavor.default.DefaultFlavor.

Definition at line 72 of file ssh.py.

72 def copy_file_to_device(self, host_path, device_path):
73 device_path = self.scp_device_path(device_path)
74 self._run('scp %s %s' % (host_path, device_path),
75 ['scp', host_path, device_path], infra_step=True)
76

◆ create_clean_device_dir()

flavor.ssh.SSHFlavor.create_clean_device_dir (   self,
  path 
)
Like shutil.rmtree() + os.makedirs(), but on a connected device.

Reimplemented from flavor.default.DefaultFlavor.

Definition at line 54 of file ssh.py.

54 def create_clean_device_dir(self, path):
55 # use -f to silently return if path doesn't exist
56 self.ssh('rm %s' % path, 'rm', '-rf', path)
57 self.ensure_device_dir(path)
58

◆ ensure_device_dir()

flavor.ssh.SSHFlavor.ensure_device_dir (   self,
  path 
)

Definition at line 42 of file ssh.py.

42 def ensure_device_dir(self, path):
43 self.ssh('mkdir %s' % path, 'mkdir', '-p', path)
44

◆ install()

flavor.ssh.SSHFlavor.install (   self)
Run device-specific installation steps.

Reimplemented from flavor.default.DefaultFlavor.

Reimplemented in flavor.chromebook.ChromebookFlavor.

Definition at line 45 of file ssh.py.

45 def install(self):
46 self.ensure_device_dir(self.device_dirs.resource_dir)
47 if self.app_name:
48 self.create_clean_device_dir(self.device_dirs.bin_dir)
49 host_path = self.host_dirs.bin_dir.join(self.app_name)
50 device_path = self.device_path_join(self.device_dirs.bin_dir, self.app_name)
51 self.copy_file_to_device(host_path, device_path)
52 self.ssh('make %s executable' % self.app_name, 'chmod', '+x', device_path)
53
static bool install(SkBitmap *bm, const SkImageInfo &info, const SkRasterHandleAllocator::Rec &rec)

◆ read_file_on_device()

flavor.ssh.SSHFlavor.read_file_on_device (   self,
  path,
**  kwargs 
)
Reads the specified file.

Reimplemented from flavor.default.DefaultFlavor.

Definition at line 59 of file ssh.py.

59 def read_file_on_device(self, path, **kwargs):
60 rv = self.ssh('read %s' % path,
61 'cat', path, stdout=self.m.raw_io.output(),
62 **kwargs)
63 return rv.stdout.decode('utf-8').rstrip() if rv and rv.stdout else None
64

◆ remove_file_on_device()

flavor.ssh.SSHFlavor.remove_file_on_device (   self,
  path 
)
Removes the specified file.

Reimplemented from flavor.default.DefaultFlavor.

Definition at line 65 of file ssh.py.

65 def remove_file_on_device(self, path):
66 # use -f to silently return if path doesn't exist
67 self.ssh('rm %s' % path, 'rm', '-f', path)
68

◆ scp_device_path()

flavor.ssh.SSHFlavor.scp_device_path (   self,
  device_path 
)

Definition at line 69 of file ssh.py.

69 def scp_device_path(self, device_path):
70 return '%s:%s' % (self.user_ip, device_path)
71

◆ ssh()

flavor.ssh.SSHFlavor.ssh (   self,
  title,
cmd,
**  kwargs 
)

Definition at line 33 of file ssh.py.

33 def ssh(self, title, *cmd, **kwargs):
34 if 'infra_step' not in kwargs:
35 kwargs['infra_step'] = True
36
37 ssh_cmd = ['ssh', '-oConnectTimeout=15', '-oBatchMode=yes',
38 '-t', '-t', self.user_ip] + list(cmd)
39
40 return self._run(title, ssh_cmd, **kwargs)
41

◆ step()

flavor.ssh.SSHFlavor.step (   self,
  name,
  cmd,
**  kwargs 
)

Reimplemented from flavor.default.DefaultFlavor.

Definition at line 83 of file ssh.py.

83 def step(self, name, cmd, **kwargs):
84 # Run cmd (installed above)
85 cmd[0] = self.device_path_join(self.device_dirs.bin_dir, cmd[0])
86 self.ssh(str(name), *cmd)
static int step(int x, SkScalar min, SkScalar max)
Definition BlurTest.cpp:215

◆ user_ip()

flavor.ssh.SSHFlavor.user_ip (   self)

Definition at line 25 of file ssh.py.

25 def user_ip(self):
26 if not self._user_ip:
27 path = '/tmp/ssh_machine.json'
28 ssh_info = self.m.file.read_json('read ssh_machine.json', path,
29 test_data={'user_ip':'foo@127.0.0.1'})
30 self._user_ip = ssh_info.get(u'user_ip')
31 return self._user_ip
32

Member Data Documentation

◆ _user_ip

flavor.ssh.SSHFlavor._user_ip
protected

Definition at line 22 of file ssh.py.

◆ app_name

flavor.ssh.SSHFlavor.app_name

Definition at line 52 of file ssh.py.

◆ user_ip

flavor.ssh.SSHFlavor.user_ip

Definition at line 70 of file ssh.py.


The documentation for this class was generated from the following file: