Merge "Comment out errors encountered when running cargo test." am: b5b71540cc am: 5a32724103
Original change: https://android-review.googlesource.com/c/platform/development/+/1906753 Change-Id: I4d07a8c22ef744c369424e8bec9debe3bcfa2f78
This commit is contained in:
@@ -131,6 +131,8 @@ CARGO_TEST_LIST_START_PAT = re.compile('^\s*Running (.*) \(.*\)$')
|
|||||||
# cargo test --list output of the end of running a binary.
|
# cargo test --list output of the end of running a binary.
|
||||||
CARGO_TEST_LIST_END_PAT = re.compile('^(\d+) tests, (\d+) benchmarks$')
|
CARGO_TEST_LIST_END_PAT = re.compile('^(\d+) tests, (\d+) benchmarks$')
|
||||||
|
|
||||||
|
CARGO2ANDROID_RUNNING_PAT = re.compile('^### Running: .*$')
|
||||||
|
|
||||||
# Rust package name with suffix -d1.d2.d3(+.*)?.
|
# Rust package name with suffix -d1.d2.d3(+.*)?.
|
||||||
VERSION_SUFFIX_PAT = re.compile(r'^(.*)-[0-9]+\.[0-9]+\.[0-9]+(?:\+.*)?$')
|
VERSION_SUFFIX_PAT = re.compile(r'^(.*)-[0-9]+\.[0-9]+\.[0-9]+(?:\+.*)?$')
|
||||||
|
|
||||||
@@ -1140,6 +1142,7 @@ class Runner(object):
|
|||||||
self.name_owners = {}
|
self.name_owners = {}
|
||||||
# Save and dump all errors from cargo to Android.bp.
|
# Save and dump all errors from cargo to Android.bp.
|
||||||
self.errors = ''
|
self.errors = ''
|
||||||
|
self.test_errors = ''
|
||||||
self.setup_cargo_path()
|
self.setup_cargo_path()
|
||||||
# Default action is cargo clean, followed by build or user given actions.
|
# Default action is cargo clean, followed by build or user given actions.
|
||||||
if args.cargo:
|
if args.cargo:
|
||||||
@@ -1466,6 +1469,8 @@ class Runner(object):
|
|||||||
self.append_to_bp('\n' + f.read() + '\n')
|
self.append_to_bp('\n' + f.read() + '\n')
|
||||||
if self.errors:
|
if self.errors:
|
||||||
self.append_to_bp('\n' + ERRORS_LINE + '\n' + self.errors)
|
self.append_to_bp('\n' + ERRORS_LINE + '\n' + self.errors)
|
||||||
|
if self.test_errors:
|
||||||
|
self.append_to_bp('\n// Errors when listing tests:\n' + self.test_errors)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def add_ar_object(self, obj):
|
def add_ar_object(self, obj):
|
||||||
@@ -1575,6 +1580,7 @@ class Runner(object):
|
|||||||
inf.seek(0)
|
inf.seek(0)
|
||||||
prev_warning = False # true if the previous line was warning: ...
|
prev_warning = False # true if the previous line was warning: ...
|
||||||
rustc_line = '' # previous line(s) matching RUSTC_VV_PAT
|
rustc_line = '' # previous line(s) matching RUSTC_VV_PAT
|
||||||
|
in_tests = False
|
||||||
for line in inf:
|
for line in inf:
|
||||||
n += 1
|
n += 1
|
||||||
if line.startswith('warning: '):
|
if line.startswith('warning: '):
|
||||||
@@ -1597,7 +1603,12 @@ class Runner(object):
|
|||||||
self.warning_files.add(fpath)
|
self.warning_files.add(fpath)
|
||||||
elif line.startswith('error: ') or line.startswith('error[E'):
|
elif line.startswith('error: ') or line.startswith('error[E'):
|
||||||
if not self.args.ignore_cargo_errors:
|
if not self.args.ignore_cargo_errors:
|
||||||
self.errors += line
|
if in_tests:
|
||||||
|
self.test_errors += '// ' + line
|
||||||
|
else:
|
||||||
|
self.errors += line
|
||||||
|
elif CARGO2ANDROID_RUNNING_PAT.match(line):
|
||||||
|
in_tests = "cargo test" in line and "--list" in line
|
||||||
prev_warning = False
|
prev_warning = False
|
||||||
rustc_line = new_rustc
|
rustc_line = new_rustc
|
||||||
self.find_warning_owners()
|
self.find_warning_owners()
|
||||||
|
|||||||
Reference in New Issue
Block a user