run_perf_tests.py
def analyze_data_files(dest_dir):
    """Analyze data files for issues that indicate a test failure."""
    overall_passed = True
    test_data_dir = os.path.join(dest_dir, 'testdata')
    for dir_name, sub_dir_list, file_list in os.walk(test_data_dir):
        if dir_name == os.path.join(dest_dir, 'testdata'):
            # in the root folder
            for fname in file_list:
                if fname == 'batterystats.dumpsys.log':
                    # pylint: disable=fixme
                    # TODO(developer): process battery data.
                    continue
                elif fname == 'locationRequests.dumpsys.log':
                    # pylint: disable=fixme
                    # TODO(developer): process location requests information.
                    continue
        else:
            # in a test folder
            print '\nAnalysing test: ' + dest_dir
            passed = True

            for fname in file_list:
                full_filename = os.path.join(dir_name, fname)
                if fname == 'gfxinfo.dumpsys.log':
                    # process gfxinfo for janky frames
                    dump_results = parse_dump_file(full_filename)
                    jank_perc = dump_results['jank_percent']
                    if jank_perc:
                        if jank_perc > JANK_THRESHOLD:
                            print ('FAIL: High level of janky frames ' +
                                   'detected (' + str(jank_perc) + '%)' +
                                   '. See trace.html for details.')
                            passed = False
                    else:
                        print 'ERROR: No dump results could be found.'
                        passed = False
                elif fname == 'test.failure.log':
                    # process test failure logs
                    print ('FAIL: Test failed. See ' + full_filename +
                           ' for details.')
                    passed = False
            if passed:
                print 'PASS. No issues detected.'
            else:
                overall_passed = False
    test_complete_file = os.path.join(dest_dir, 'testdata',
                                      'testRunComplete.log')
    if not os.path.isfile(test_complete_file):
        overall_passed = False
        print ('\nFAIL: Could not find file indicating the test run ' +
               'completed. Check that the TestListener is writing files to external storage')
    if overall_passed:
        print '\nOVERALL: PASSED.'
        return 0
    else:
        print '\nOVERALL: FAILED. See above for more information.'
        return 1
Analyze data files for issues that indicate a test failure.
Analyze data files for issues that indicate a test failure.
Analyze data files for issues that indicate a test failure .
def analyze_data_files(dest_dir):
    overall_passed = True
    test_data_dir = os.path.join(dest_dir, 'testdata')
    for dir_name, sub_dir_list, file_list in os.walk(test_data_dir):
        if dir_name == os.path.join(dest_dir, 'testdata'):
            for fname in file_list:
                if fname == 'batterystats.dumpsys.log':
                    continue
                elif fname == 'locationRequests.dumpsys.log':
                    continue
        else:
            print '\nAnalysing test: ' + dest_dir
            passed = True
            for fname in file_list:
                full_filename = os.path.join(dir_name, fname)
                if fname == 'gfxinfo.dumpsys.log':
                    dump_results = parse_dump_file(full_filename)
                    jank_perc = dump_results['jank_percent']
                    if jank_perc:
                        if jank_perc > JANK_THRESHOLD:
                            print ('FAIL: High level of janky frames ' +
                                   'detected (' + str(jank_perc) + '%)' +
                                   '. See trace.html for details.')
                            passed = False
                    else:
                        print 'ERROR: No dump results could be found.'
                        passed = False
                elif fname == 'test.failure.log':
                    print ('FAIL: Test failed. See ' + full_filename +
                           ' for details.')
                    passed = False
            if passed:
                print 'PASS. No issues detected.'
            else:
                overall_passed = False
    test_complete_file = os.path.join(dest_dir, 'testdata',
                                      'testRunComplete.log')
    if not os.path.isfile(test_complete_file):
        overall_passed = False
        print ('\nFAIL: Could not find file indicating the test run ' +
               'completed. Check that the TestListener is writing files to external storage')
    if overall_passed:
        print '\nOVERALL: PASSED.'
        return 0
    else:
        print '\nOVERALL: FAILED. See above for more information.'
        return 1
def analyze_data_files ( dest_dir ) : overall_passed = True test_data_dir = os . path . join ( dest_dir , 'testdata' ) for dir_name , sub_dir_list , file_list in os . walk ( test_data_dir ) : if dir_name == os . path . join ( dest_dir , 'testdata' ) : for fname in file_list : if fname == 'batterystats.dumpsys.log' : continue elif fname == 'locationRequests.dumpsys.log' : continue else : print '\nAnalysing test: ' + dest_dir passed = True for fname in file_list : full_filename = os . path . join ( dir_name , fname ) if fname == 'gfxinfo.dumpsys.log' : dump_results = parse_dump_file ( full_filename ) jank_perc = dump_results [ 'jank_percent' ] if jank_perc : if jank_perc > JANK_THRESHOLD : print ( 'FAIL: High level of janky frames ' + 'detected (' + str ( jank_perc ) + '%)' + '. See trace.html for details.' ) passed = False else : print 'ERROR: No dump results could be found.' passed = False elif fname == 'test.failure.log' : print ( 'FAIL: Test failed. See ' + full_filename + ' for details.' ) passed = False if passed : print 'PASS. No issues detected.' else : overall_passed = False test_complete_file = os . path . join ( dest_dir , 'testdata' , 'testRunComplete.log' ) if not os . path . isfile ( test_complete_file ) : overall_passed = False print ( '\nFAIL: Could not find file indicating the test run ' + 'completed. Check that the TestListener is writing files to external storage' ) if overall_passed : print '\nOVERALL: PASSED.' return 0 else : print '\nOVERALL: FAILED. See above for more information.' return 1
Analyze data files for issues that indicate a test failure.
Analyze data files for issues that indicate a test failure .
"""Analyze data files for issues that indicate a test failure.""" # in the root folder # pylint: disable=fixme # TODO(developer): process battery data. # pylint: disable=fixme # TODO(developer): process location requests information. # in a test folder # process gfxinfo for janky frames # process test failure logs
dest_dir