Esempio n. 1
0
def main():
    parser = argparse.ArgumentParser(description='Golden image test script')
    parser.add_argument(
        'traceperiod',
        help=('Trace dir and snapshots period divided by #.'
              ' The trace dir, is the directory name in the golden repository'
              ' Example: angrybirds_nexus10_1080p_t604#50'))
    parser.add_argument(
        'devices',
        help='Device to id map. Example: "nexus10:R32D1034QMN,note3:RCV32342"')
    parser.add_argument('workspace', help='Path to the jenkins workspace')
    parser.add_argument('releases',
                        help='Path to the patrace release directory')
    parser.add_argument('repository',
                        help='Path to the golden image repository')
    args = parser.parse_args()

    tracedir, snap_period = args.traceperiod.split('#')
    device_name = tracedir.split('_')[1]
    devices = dict([pair.split(':') for pair in args.devices.split(',')])

    device = AdbDevice(devices[device_name], device_name, verbose=True)

    print("Using device: {}".format(device.model_name))

    app = Application(args.workspace, args.releases, args.repository)
    app.init(device)

    filepath = os.path.join(args.repository, tracedir, 'trace.pat')

    app.traceAndRetraceGoldenImages(filepath, snap_period, device)

    print("Success")
    def get_available_executors(self, executors, abi):
        avail_executors = \
                AdbDevice.get_available_executors(self, executors, abi)
        if base_pb2.SNPE in executors:
            avail_executors.append(base_pb2.SNPE)

        return avail_executors
    def get_available_executors(self, executors, abi):
        avail_executors = \
                AdbDevice.get_available_executors(self, executors, abi)
        if (base_pb2.HIAI in executors) and (abi == "arm64-v8a") and \
                self._support_hiai_ddk200():
            avail_executors.append(base_pb2.HIAI)

        return avail_executors
def main():
    parser = argparse.ArgumentParser(description='Golden image test script')
    parser.add_argument('traceperiod', help=(
        'Trace dir and snapshots period divided by #.'
        ' The trace dir, is the directory name in the golden repository'
        ' Example: angrybirds_nexus10_1080p_t604#50'
    ))
    parser.add_argument('devices', help='Device to id map. Example: "nexus10:R32D1034QMN,note3:RCV32342"')
    parser.add_argument('workspace', help='Path to the jenkins workspace')
    parser.add_argument('releases', help='Path to the patrace release directory')
    parser.add_argument('repository', help='Path to the golden image repository')
    args = parser.parse_args()

    tracedir, snap_period = args.traceperiod.split('#')
    device_name = tracedir.split('_')[1]
    devices = dict([pair.split(':') for pair in args.devices.split(',')])

    device = AdbDevice(devices[device_name], device_name, verbose=True)

    app = Application(args.workspace, args.releases, args.repository)
    app.init(device)

    filepath = os.path.join(args.repository, tracedir, 'trace.pat')

    for branchName, branchPath in [
        ("Development", app.paths['developmentPath']),
    ]:
        device.shell('logcat -c')
        reference_snaps_path = os.path.join(os.path.dirname(filepath), 'snap')

        if not os.path.exists(reference_snaps_path):
            raise Exception("Path {0} does not exists".format(reference_snaps_path))

        try:
            app.retraceGoldenImages(filepath, reference_snaps_path, snap_period, device, branchPath)
        except Exception as e:
            print(device.shell('logcat -d'))
            traceback.print_exc()
            raise e

        app.customPrint(branchName + "-branch succeeded for " + filepath)

    app.cleanup(device)

    print("Success")
    def get_available_device_types(self, device_types, abi, executor):
        avail_device_types = AdbDevice.get_available_device_types(
            self, device_types, abi, executor)

        if (base_pb2.NPU in device_types) and (abi == "arm64-v8a") and \
                self._support_hiai_ddk200():
            avail_device_types.append(base_pb2.NPU)

        return avail_device_types
    def get_available_device_types(self, device_types, abi, executor):
        avail_device_types = AdbDevice.get_available_device_types(
            self, device_types, abi, executor)
        if base_pb2.DSP in device_types and \
                (executor == base_pb2.SNPE or self._support_dev_dsp()):
            avail_device_types.append(base_pb2.DSP)

        if base_pb2.NPU in device_types and self._support_npu():
            avail_device_types.append(base_pb2.NPU)

        return avail_device_types
Esempio n. 7
0
    def _create_adb_device(self, adb):
        adb_device = AdbDevice(adb)
        # TODO([email protected]): optimize this match after qualcomm release
        # newer socs
        if re.match("sdm\\d+$|msm\\d+$|msmnile", adb_device.target_soc, re.I):
            # ["sdm845", "sdm660", "msm8998", "msm8996", "msmnile"]
            adb_device = QualcommAdbDevice(adb)
            print("Find qualcomm adb device:%s" % adb[0])
        elif re.match("kirin\\d+$", adb_device.target_soc, re.I):
            # ["kirin980", "kirin970", "kirin960"]
            adb_device = HuaweiAdbDevice(adb)
            print("Find huawei adb device:%s" % adb[0])
        else:
            print("Find adb device:%s" % adb[0])

        return adb_device
Esempio n. 8
0
def main():
    parser = argparse.ArgumentParser(
        description='Set up application for tracing on device.'
        'If appname is not specified, the application that currently '
        'use most CPU will be used for tracing.')
    parser.add_argument('-a',
                        '--appname',
                        help='Application name. Example: com.example.foo')
    parser.add_argument('-d', '--device', help='The id of the device')
    parser.add_argument('-v',
                        '--verbose',
                        help='Print all adb commands',
                        action='store_true')
    parser.add_argument('-s',
                        '--snap',
                        help='Enables snapshot creation',
                        action='store_true')
    parser.add_argument('-t',
                        '--snapthread',
                        help='Use this thread when creating snapshots',
                        type=int,
                        default=0)
    parser.add_argument(
        '-f',
        '--snapperiod',
        help=
        'Use this frame period when creating snapshots. 1 means each frame',
        type=int,
        default=1)

    args = parser.parse_args()

    #trace_file = '/work/test/com.wb.goog.batman.brawler2013.3fixed.pat'
    dc = AdbDevice(args.device, system_write=True, verbose=args.verbose)
    trace_file = trace(args, dc)

    update_header(dc, trace_file, args.appname)

    trace_file_fixed = '.'.join(trace_file.split('.')[:-1]) + '.fixed.pat'

    print("Remap relevant calls to default thread id...")
    remap_egl.remap(trace_file, trace_file_fixed)

    if not retrace(trace_file_fixed):
        return 1

    print("Done")
Esempio n. 9
0
def main():
    parser = argparse.ArgumentParser(description='Install tracer and fakedriver on device. Use with care.')
    parser.add_argument('version', help='Release version. For example: r0p6')
    parser.add_argument('-d', '--device', help='The id of the device')
    parser.add_argument('-v', '--verbose', help='Print all adb commands', action='store_true')
    parser.add_argument('-p', '--releasepath',
                        help='The path to where the patrace releases are located',
                        default='/projects/pr368/patrace_releases')
    args = parser.parse_args()

    path = get_android_sw_path(args.releasepath, args.version)

    print("Using path: {}".format(path))

    dc = AdbDevice(args.device, system_write=True, verbose=args.verbose)
    update_fakedriver(dc, path)
    update_interceptor(dc, path)