[test] Better tests output by converting stderr to stdout (#696)

https://gitlab.kitware.com/cmake/cmake/issues/17630
This commit is contained in:
Ebrahim Byagowi 2018-01-11 08:48:22 +03:30 committed by GitHub
parent ebb9b7d633
commit 1461965c22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 9 deletions

View File

@ -8,8 +8,8 @@ def cmd(command):
p = subprocess.Popen ( p = subprocess.Popen (
command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p.wait () p.wait ()
print (p.stderr.read (), file=sys.stderr, end='') print (p.stderr.read (), end="") # file=sys.stderr
return p.stdout.read ().decode ("utf-8").strip(), p.returncode return p.stdout.read ().decode ("utf-8").strip (), p.returncode
args = sys.argv[1:] args = sys.argv[1:]
@ -61,7 +61,7 @@ for filename in args:
unicodes] + (options.split (' ') if options else [])) unicodes] + (options.split (' ') if options else []))
if returncode: if returncode:
print ("hb-shape --font-funcs=ft failed.") print ("hb-shape --font-funcs=ft failed.") # file=sys.stderr
fails = fails + 1 fails = fails + 1
#continue #continue
@ -70,13 +70,13 @@ for filename in args:
unicodes] + (options.split (' ') if options else [])) unicodes] + (options.split (' ') if options else []))
if returncode: if returncode:
print ("ERROR: hb-shape --font-funcs=ot failed.") print ("ERROR: hb-shape --font-funcs=ot failed.") # file=sys.stderr
fails = fails + 1 fails = fails + 1
#continue #continue
if glyphs1 != glyphs2: if glyphs1 != glyphs2:
print ("FT funcs: " + glyphs1) print ("FT funcs: " + glyphs1) # file=sys.stderr
print ("OT funcs: " + glyphs2) print ("OT funcs: " + glyphs2) # file=sys.stderr
fails = fails + 1 fails = fails + 1
if reference: if reference:
@ -84,13 +84,13 @@ for filename in args:
continue continue
if glyphs1.strip() != glyphs_expected.strip(): if glyphs1.strip() != glyphs_expected.strip():
print ("Actual: " + glyphs1, file=sys.stderr) print ("Actual: " + glyphs1) # file=sys.stderr
print ("Expected: " + glyphs_expected, file=sys.stderr) print ("Expected: " + glyphs_expected) # file=sys.stderr
fails = fails + 1 fails = fails + 1
if fails != 0: if fails != 0:
if not reference: if not reference:
print (str (fails) + " tests failed.") print (str (fails) + " tests failed.") # file=sys.stderr
sys.exit (1) sys.exit (1)
else: else: