Add option for test script to build for specified target
Use --target of -t to specify target we want to build.
Test: python test_compiler.py ../../../master
../../../master/prebuilts/clang/host/linux-x86/clang-stable --build-only
--target aosp_bullhead-eng
Bug: http://b/62292583
Change-Id: I28eb2d845154cb21f3eab29197572fe4ec9b34ce
diff --git a/test_compiler.py b/test_compiler.py
index f32341c..35d2ce0 100755
--- a/test_compiler.py
+++ b/test_compiler.py
@@ -22,7 +22,7 @@
import subprocess
import utils
-TARGETS = ('aosp_angler-eng')
+TARGETS = ('aosp_angler-eng', 'aosp_bullhead-eng', 'aosp_marlin-eng')
def parse_args():
@@ -41,6 +41,9 @@
default=False, help='Build default targets only.')
parser.add_argument('--flashall-path', nargs='?', help='Use internal '
'flashall tool if the path is set.')
+ parser.add_argument('-t', '--target', nargs='?', help='Build for specified '
+ 'target. This will work only when --build-only is '
+ 'enabled.')
clean_built_target_group = parser.add_mutually_exclusive_group()
clean_built_target_group.add_argument(
'--clean-built-target', action='store_true', default=True,
@@ -147,10 +150,12 @@
if len(devices) == 0:
print("You don't have any devices connected. Will build for "
'default targets only.')
+
if args.build_only or len(device) == 0:
- for target in TARGETS:
+ targets = [args.target] if args.target else TARGETS
+ for target in targets:
build_target(args.android_path, clang_version, target,
- args.jobs)
+ args.jobs)
else:
for device in devices:
result = test_device(args.android_path, clang_version, device,