1import lit.util # pylint: disable=import-error 2 3 4class AdbError(RuntimeError): 5 def __init__(self, cmd, out, err, exit_code): 6 super(AdbError, self).__init__(err) 7 self.cmd = cmd 8 self.out = out 9 self.err = err 10 self.exit_code = exit_code 11 12 13def mkdir(path): 14 cmd = ['adb', 'shell', 'mkdir', path] 15 out, err, exit_code = lit.util.executeCommand(cmd) 16 if exit_code != 0: 17 raise AdbError(cmd, out, err, exit_code) 18 19 20def push(src, dst): 21 cmd = ['adb', 'push', src, dst] 22 out, err, exit_code = lit.util.executeCommand(cmd) 23 if exit_code != 0: 24 raise AdbError(cmd, out, err, exit_code) 25