Merge "Fix handling of tests for variants." am: 8ddcc6c479
Original change: https://android-review.googlesource.com/c/platform/development/+/2584688 Change-Id: Ie5f044b4b945e3d0a7fcb86be42665cfa6c4ae2b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -1162,18 +1162,6 @@ class Runner(object):
|
|||||||
self.errors = ''
|
self.errors = ''
|
||||||
self.test_errors = ''
|
self.test_errors = ''
|
||||||
self.setup_cargo_path()
|
self.setup_cargo_path()
|
||||||
# Default action is cargo clean, followed by build or user given actions.
|
|
||||||
if args.cargo:
|
|
||||||
self.cargo = ['clean'] + args.cargo
|
|
||||||
else:
|
|
||||||
default_target = '--target x86_64-unknown-linux-gnu'
|
|
||||||
# Use the same target for both host and default device builds.
|
|
||||||
# Same target is used as default in host x86_64 Android compilation.
|
|
||||||
# Note: b/169872957, prebuilt cargo failed to build vsock
|
|
||||||
# on x86_64-unknown-linux-musl systems.
|
|
||||||
self.cargo = ['clean', 'build ' + default_target]
|
|
||||||
if args.tests:
|
|
||||||
self.cargo.append('build --tests ' + default_target)
|
|
||||||
self.empty_tests = set()
|
self.empty_tests = set()
|
||||||
self.empty_unittests = False
|
self.empty_unittests = False
|
||||||
|
|
||||||
@@ -1352,6 +1340,19 @@ class Runner(object):
|
|||||||
# Merge and overwrite variant args
|
# Merge and overwrite variant args
|
||||||
self.variant_args = argparse.Namespace(**vars(self.args) | variant_data)
|
self.variant_args = argparse.Namespace(**vars(self.args) | variant_data)
|
||||||
|
|
||||||
|
# Default action is cargo clean, followed by build or user given actions.
|
||||||
|
if self.variant_args.cargo:
|
||||||
|
self.cargo = ['clean'] + self.variant_args.cargo
|
||||||
|
else:
|
||||||
|
default_target = '--target x86_64-unknown-linux-gnu'
|
||||||
|
# Use the same target for both host and default device builds.
|
||||||
|
# Same target is used as default in host x86_64 Android compilation.
|
||||||
|
# Note: b/169872957, prebuilt cargo failed to build vsock
|
||||||
|
# on x86_64-unknown-linux-musl systems.
|
||||||
|
self.cargo = ['clean', 'build ' + default_target]
|
||||||
|
if self.variant_args.tests:
|
||||||
|
self.cargo.append('build --tests ' + default_target)
|
||||||
|
|
||||||
def run_cargo(self):
|
def run_cargo(self):
|
||||||
"""Calls cargo -v and save its output to ./cargo{_variant_num}.out."""
|
"""Calls cargo -v and save its output to ./cargo{_variant_num}.out."""
|
||||||
if self.skip_cargo:
|
if self.skip_cargo:
|
||||||
@@ -1600,7 +1601,7 @@ class Runner(object):
|
|||||||
# for unit tests. To figure out to which crate this corresponds, we check
|
# for unit tests. To figure out to which crate this corresponds, we check
|
||||||
# if the current source file is the main source of a non-test crate, e.g.,
|
# if the current source file is the main source of a non-test crate, e.g.,
|
||||||
# a library or a binary.
|
# a library or a binary.
|
||||||
return (src in self.args.test_blocklist or src in self.empty_tests
|
return (src in self.variant_args.test_blocklist or src in self.empty_tests
|
||||||
or (self.empty_unittests
|
or (self.empty_unittests
|
||||||
and src in [c.main_src for c in self.crates if c.crate_types != ['test']]))
|
and src in [c.main_src for c in self.crates if c.crate_types != ['test']]))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user