Only capture errors when clang return value is not zero.
Since stderr is parsed to warnings.html, we only capture stderr when
clang return value is not zero.
Bug: http://b/62292583
Test: python test_compiler.py ../../.. --build-only --target
aosp_angler-eng
Change-Id: If737a034b4f13a648df8cab26e704da2b9b695ff
diff --git a/test_compiler.py b/test_compiler.py
index 55ca5ab..e987010 100755
--- a/test_compiler.py
+++ b/test_compiler.py
@@ -66,7 +66,7 @@
redirect_stderr_group.add_argument(
'--redirect-stderr', action='store_true', default=True,
help='Redirect clang stderr to $OUT/clang-error.log.')
- clean_built_target_group.add_argument(
+ redirect_stderr_group.add_argument(
'--no-redirect-stderr', action='store_false',
dest='redirect_stderr', help='Do not redirect clang stderr.')
return parser.parse_args()
@@ -113,9 +113,13 @@
if redirect_stderr:
redirect_key = compiler_wrapper.STDERR_REDIRECT_KEY
- redirect_path = os.path.abspath(os.path.join(android_base, 'out',
- 'clang-error.log'))
- utils.remove(redirect_path)
+ if 'DIST_DIR' in env:
+ redirect_path = os.path.join(env['DIST_DIR'], 'logs',
+ 'clang-error.log')
+ else:
+ redirect_path = os.path.abspath(os.path.join(android_base, 'out',
+ 'clang-error.log'))
+ utils.remove(redirect_path)
env[redirect_key] = redirect_path
fallback_path = build.clang_prebuilt_bin_dir()