Example #1
0
        print
        sys.exit(1)
    try:
        #if (android.settings.DEVICES['TestDevice']['id'] == connection.device.id() and not isConnecting):
        if not isConnecting:
            _copyLogs(connection, 
                      android.settings.LOCATIONS_PULLED_AFTER_EACH_TEST)
    except Exception, e:
        try:
            err = "managePhoneLogs(): Failure, with exception message: {0}."
            android.log.warning(TAG, err.format(str(e)))
        except:
            pass


android.register_connect_hook(managePhoneLogs)


@android.ui.waitfor_hook
def detect_force_close_and_anr_output_bugreport(a, s):
    #if a.device.id() != android.settings.DEVICES['TestDevice']['id']:
        #return False
    anr_fcs = []
    fc_regexp = re.compile(a.settings.UI_DETECT_FORCE_CLOSE_TEXT)
    anr_regexp = re.compile(a.settings.UI_DETECT_ANR_TEXT)
    if (    s.widget(id='message', text=fc_regexp) and
            s.widget(id='alertTitle') and
            s.widget(id='button1')):
        fname = 'bugreport_for_FC.txt'
        err_line1 = 'detect_force_close_output_bugreport(): '
        anr_fcs.append((fname, err_line1))
Example #2
0
    time_information = "%s_%s_%s_%s_%s_%s_" %(now.year,now.month,now.day,now.hour,now.minute,now.second)

    try:
        # Get graphics info
        graphics_file =  "SurfaceFlinger_%s" % str(time_information)
        filename = connection.log.log_filename(graphics_file+str('.txt'))

        fh = open(filename,'a')
        fh.write("".join(std_out))
        fh.close() 

    except Exception,e:
        print str(e) 

#android.register_connect_hook(__getAdditionalLogs) 
android.register_connect_hook(enableAdbRoot)
android.register_connect_hook(managePhoneLogs)
android.register_connect_hook(terminatePostconLogcatLogs)
android.register_connection_recovery_hook(productInitConnectionRecoveryHook)

def determine_device_ip( device_barcode ):
    """
        Try to determine device ip address that matches provide device_barcode
    """
    ip_command = "ipconfig"
    if sys.platform != "win32" and sys.platform != "cygwin":    
        ip_command = "ifconfig"  
    co = subprocess.Popen( ip_command, stdout = subprocess.PIPE )
    output = co.stdout.read()
    ip_regex = re.compile('((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-4]|2[0-5][0-9]|[01]?[0-9][0-9]?))')
    addresses = [match[0] for match in ip_regex.findall( output, re.MULTILINE) if str(match[0]).startswith( "192.")]
Example #3
0
        print
        sys.exit(1)
    try:
        #if (android.settings.DEVICES['TestDevice']['id'] == connection.device.id() and not isConnecting):
        if not isConnecting:
            _copyLogs(connection,
                      android.settings.LOCATIONS_PULLED_AFTER_EACH_TEST)
    except Exception, e:
        try:
            err = "managePhoneLogs(): Failure, with exception message: {0}."
            android.log.warning(TAG, err.format(str(e)))
        except:
            pass


android.register_connect_hook(managePhoneLogs)


@android.ui.waitfor_hook
def detect_force_close_and_anr_output_bugreport(a, s):
    #if a.device.id() != android.settings.DEVICES['TestDevice']['id']:
    #return False
    anr_fcs = []
    fc_regexp = re.compile(a.settings.UI_DETECT_FORCE_CLOSE_TEXT)
    anr_regexp = re.compile(a.settings.UI_DETECT_ANR_TEXT)
    if (s.widget(id='message', text=fc_regexp) and s.widget(id='alertTitle')
            and s.widget(id='button1')):
        fname = 'bugreport_for_FC.txt'
        err_line1 = 'detect_force_close_output_bugreport(): '
        anr_fcs.append((fname, err_line1))
    if (s.widget(id='message', text=anr_regexp) and s.widget(id='alertTitle')
Example #4
0
    try:
        # Get graphics info
        graphics_file = "SurfaceFlinger_%s" % str(time_information)
        filename = connection.log.log_filename(graphics_file + str('.txt'))

        fh = open(filename, 'a')
        fh.write("".join(std_out))
        fh.close()

    except Exception, e:
        print str(e)


#android.register_connect_hook(__getAdditionalLogs)
android.register_connect_hook(enableAdbRoot)
android.register_connect_hook(managePhoneLogs)
android.register_connect_hook(terminatePostconLogcatLogs)
android.register_connection_recovery_hook(productInitConnectionRecoveryHook)


def determine_device_ip(device_barcode):
    """
        Try to determine device ip address that matches provide device_barcode
    """
    ip_command = "ipconfig"
    if sys.platform != "win32" and sys.platform != "cygwin":
        ip_command = "ifconfig"
    co = subprocess.Popen(ip_command, stdout=subprocess.PIPE)
    output = co.stdout.read()
    ip_regex = re.compile(