mirror of
https://github.com/xorgy/mediafire-fuse
synced 2026-01-13 13:14:29 -08:00
tests/iwyu.py: print diff if descrepancy is found
This commit is contained in:
@@ -4,18 +4,23 @@ from __future__ import print_function
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import shlex
|
||||||
|
|
||||||
with open("compile_commands.json", "r") as f:
|
with open("compile_commands.json", "r") as f:
|
||||||
tunits = json.load(f)
|
tunits = json.load(f)
|
||||||
|
|
||||||
result = 0
|
result = 0
|
||||||
for tu in tunits:
|
for tu in tunits:
|
||||||
_,rest = tu["command"].split(" ",1)
|
_,cmd = tu["command"].split(" ",1)
|
||||||
|
cmd = "%s %s"%("iwyu", cmd)
|
||||||
|
cmd = shlex.split(cmd)
|
||||||
# iwyu does not distinguish between different outcomes of its check
|
# iwyu does not distinguish between different outcomes of its check
|
||||||
# so instead, we grep its stderr output
|
# so instead, we grep its stderr output
|
||||||
# see http://code.google.com/p/include-what-you-use/issues/detail?id=157
|
# see http://code.google.com/p/include-what-you-use/issues/detail?id=157
|
||||||
ret = subprocess.call("%s %s 2>&1 | grep \"has correct #\""%("iwyu", rest), shell=True)
|
ret = subprocess.Popen(cmd, stderr=subprocess.PIPE)
|
||||||
if ret != 0:
|
_,ret = ret.communicate()
|
||||||
|
if "has correct #" not in ret:
|
||||||
result += 1
|
result += 1
|
||||||
|
print(ret)
|
||||||
|
|
||||||
exit(result)
|
exit(result)
|
||||||
|
|||||||
Reference in New Issue
Block a user