diff options
author | Guang Zhu <guangzhu@google.com> | 2009-06-12 15:03:45 -0700 |
---|---|---|
committer | Guang Zhu <guangzhu@google.com> | 2009-06-12 15:03:45 -0700 |
commit | 903f311fdc79b8dc804b63d0e397453d9b0e8d44 (patch) | |
tree | ad4d98d9c75c45acda16a15181fe1fc23e727bf3 /tests | |
parent | 7504da036834a661684185ef11ec2ec50a18ce1b (diff) | |
download | frameworks_base-903f311fdc79b8dc804b63d0e397453d9b0e8d44.zip frameworks_base-903f311fdc79b8dc804b63d0e397453d9b0e8d44.tar.gz frameworks_base-903f311fdc79b8dc804b63d0e397453d9b0e8d44.tar.bz2 |
Adjust order of file/section list in output diff
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/DumpRenderTree/assets/run_layout_tests.py | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/tests/DumpRenderTree/assets/run_layout_tests.py b/tests/DumpRenderTree/assets/run_layout_tests.py index 5409a0c..50ccb24 100755 --- a/tests/DumpRenderTree/assets/run_layout_tests.py +++ b/tests/DumpRenderTree/assets/run_layout_tests.py @@ -61,7 +61,8 @@ def DumpRenderTreeFinished(adb_cmd): adb_output = subprocess.Popen(shell_cmd_str, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0] return adb_output.strip() == "#DONE" -def DiffResults(marker, new_results, old_results, diff_results, strip_reason): +def DiffResults(marker, new_results, old_results, diff_results, strip_reason, + new_count_first=True): """ Given two result files, generate diff and write to diff_results file. All arguments are absolute paths to files. @@ -85,21 +86,25 @@ def DiffResults(marker, new_results, old_results, diff_results, strip_reason): for i in range(0, len(cdict)): cdict[i] = cdict[i].split(' ')[0] + "\n" - # Find results in new_results missing in old_results - new_count=0 - for line in ndict: - if line not in cdict: - diff_file.writelines("+ " + line) - new_count += 1 - - # Find results in old_results missing in new_results - missing_count=0 - for line in cdict: - if line not in ndict: - diff_file.writelines("- " + line) - missing_count += 1 - - logging.info(marker + " >>> " + str(new_count) + " new, " + str(missing_count) + " misses") + params = { + "new": [0, ndict, cdict, "+"], + "miss": [0, cdict, ndict, "-"] + } + if new_count_first: + order = ["new", "miss"] + else: + order = ["miss", "new"] + + for key in order: + for line in params[key][1]: + if line not in params[key][2]: + if line[-1] != "\n": + line += "\n"; + diff_file.writelines(params[key][3] + line) + params[key][0] += 1 + + logging.info(marker + " >>> " + str(params["new"][0]) + " new, " + + str(params["miss"][0]) + " misses") diff_file.writelines("\n\n") @@ -121,12 +126,12 @@ def CompareResults(ref_dir, results_dir): if os.path.exists(diff_result): os.remove(diff_result) - files=["passed", "failed", "nontext", "crashed"] + files=["crashed", "failed", "passed", "nontext"] for f in files: result_file_name = "layout_tests_" + f + ".txt" DiffResults(f, os.path.join(results_dir, result_file_name), os.path.join(ref_dir, result_file_name), diff_result, - f == "failed") + False, files != "passed") logging.info("Detailed diffs are in " + diff_result) def main(options, args): |