diff options
author | Kim Grasman <kim.grasman@gmail.com> | 2016-08-15 21:06:36 +0200 |
---|---|---|
committer | Kim Grasman <kim.grasman@gmail.com> | 2016-08-15 21:08:28 +0200 |
commit | f09dba693412463fcca0898a202763761fe60ccc (patch) | |
tree | c603c30caacf62481c9ce119f50f34e00d1f7794 | |
parent | 04f1c925370d0f1a70642147f07c70a4c2bfb530 (diff) |
Clean up output from test runner
* Only quote the IWYU executable name when necessary
* Remove logging of IWYU and Clang flags, they are already visible on
the command-line
-rwxr-xr-x | iwyu_test_util.py | 13 | ||||
-rwxr-xr-x | run_iwyu_tests.py | 6 |
2 files changed, 11 insertions, 8 deletions
diff --git a/iwyu_test_util.py b/iwyu_test_util.py index b67327f..dfe37b6 100755 --- a/iwyu_test_util.py +++ b/iwyu_test_util.py @@ -109,6 +109,12 @@ def _GetIwyuPath(): return _IWYU_PATH +def _ShellQuote(arg): + if ' ' in arg: + arg = '"' + arg + '"' + return arg + + def _GetCommandOutput(command): p = subprocess.Popen(command, shell=True, @@ -424,8 +430,11 @@ def TestIwyuOnRelativeFile(test_case, cc_file, cpp_files_to_check, iwyu_flags = ['-Xiwyu ' + flag for flag in iwyu_flags] # TODO(csilvers): verify that has exit-status 0. - cmd = '"%s" %s %s %s' % ( - _GetIwyuPath(), ' '.join(iwyu_flags), ' '.join(clang_flags), cc_file) + cmd = '%s %s %s %s' % ( + _ShellQuote(_GetIwyuPath()), + ' '.join(iwyu_flags), + ' '.join(clang_flags), + cc_file) if verbose: print('>>> Running %s' % cmd) output = _GetCommandOutput(cmd) diff --git a/run_iwyu_tests.py b/run_iwyu_tests.py index a4501c4..b90b011 100755 --- a/run_iwyu_tests.py +++ b/run_iwyu_tests.py @@ -209,14 +209,8 @@ class OneIwyuTest(unittest.TestCase): files_to_check = [PosixPath(f) for f in files_to_check] iwyu_flags = self._iwyu_flags_map.get(filename, None) - if iwyu_flags: - logging.info('%s: Using iwyu flags %s', filename, str(iwyu_flags)) - clang_flags = self._clang_flags_map.get(filename, []) clang_flags.extend(self._include_map.get(filename, [])) - if clang_flags: - logging.info('%s: Using clang flags %s', filename, str(clang_flags)) - iwyu_test_util.TestIwyuOnRelativeFile(self, filename, files_to_check, iwyu_flags, clang_flags, verbose=True) |