Merge "Fix handling of tests for variants."
This commit is contained in:
@@ -1162,18 +1162,6 @@ class Runner(object):
|
||||
self.errors = ''
|
||||
self.test_errors = ''
|
||||
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_unittests = False
|
||||
|
||||
@@ -1352,6 +1340,19 @@ class Runner(object):
|
||||
# Merge and overwrite variant args
|
||||
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):
|
||||
"""Calls cargo -v and save its output to ./cargo{_variant_num}.out."""
|
||||
if self.skip_cargo:
|
||||
@@ -1600,7 +1601,7 @@ class Runner(object):
|
||||
# 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.,
|
||||
# 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
|
||||
and src in [c.main_src for c in self.crates if c.crate_types != ['test']]))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user