[subset] Don't compare actual to itself in Fix test/subset/run-tests. Print a diff on failure.

This commit is contained in:
Garret Rieger 2018-02-22 14:07:52 -08:00 committed by Behdad Esfahbod
parent 4f6f7c3b22
commit 537698b601
1 changed files with 5 additions and 1 deletions

View File

@ -6,6 +6,7 @@
from __future__ import print_function from __future__ import print_function
import io import io
from difflib import unified_diff
import os import os
import re import re
import subprocess import subprocess
@ -59,9 +60,12 @@ def run_test(test):
return fail_test(test, cli_args, "ttx (actual) returned %d" % (return_code)) return fail_test(test, cli_args, "ttx (actual) returned %d" % (return_code))
expected_ttx = strip_check_sum (expected_ttx) expected_ttx = strip_check_sum (expected_ttx)
actual_ttx = strip_check_sum (expected_ttx) actual_ttx = strip_check_sum (actual_ttx)
if not actual_ttx == expected_ttx: if not actual_ttx == expected_ttx:
for line in unified_diff(expected_ttx.splitlines(1), actual_ttx.splitlines(1)):
sys.stdout.write(line)
sys.stdout.flush()
return fail_test(test, cli_args, 'ttx for expected and actual does not match.') return fail_test(test, cli_args, 'ttx for expected and actual does not match.')
return 0 return 0