Rollup merge of #127461 - c6c7:fixup-failing-fuchsia-tests, r=tmandry
Fixup failing fuchsia tests The Fuchsia platform passes all tests with these changes. Two tests are ignored because they rely on Fuchsia not returning a status code upon a process aborting. See #102032 and #58590 for more details on that topic. Many formatting changes are also included in this PR. r? tmandry r? erickt
This commit is contained in:
commit
74907296d8
5 changed files with 22 additions and 49 deletions
|
@ -8,8 +8,6 @@ https://doc.rust-lang.org/stable/rustc/platform-support/fuchsia.html#aarch64-unk
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
from concurrent.futures import ThreadPoolExecutor
|
|
||||||
from dataclasses import dataclass
|
|
||||||
import glob
|
import glob
|
||||||
import io
|
import io
|
||||||
import json
|
import json
|
||||||
|
@ -20,6 +18,8 @@ import shlex
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
|
from dataclasses import dataclass
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import ClassVar, List, Optional
|
from typing import ClassVar, List, Optional
|
||||||
|
|
||||||
|
@ -42,12 +42,8 @@ def check_call_with_logging(
|
||||||
for line in pipe:
|
for line in pipe:
|
||||||
handler(line.rstrip())
|
handler(line.rstrip())
|
||||||
|
|
||||||
executor_out = executor.submit(
|
executor_out = executor.submit(exhaust_pipe, stdout_handler, process.stdout)
|
||||||
exhaust_pipe, stdout_handler, process.stdout
|
executor_err = executor.submit(exhaust_pipe, stderr_handler, process.stderr)
|
||||||
)
|
|
||||||
executor_err = executor.submit(
|
|
||||||
exhaust_pipe, stderr_handler, process.stderr
|
|
||||||
)
|
|
||||||
executor_out.result()
|
executor_out.result()
|
||||||
executor_err.result()
|
executor_err.result()
|
||||||
retcode = process.poll()
|
retcode = process.poll()
|
||||||
|
@ -203,9 +199,7 @@ class TestEnvironment:
|
||||||
raise Exception(f"Unreadable build-id for binary {binary}")
|
raise Exception(f"Unreadable build-id for binary {binary}")
|
||||||
data = json.loads(process.stdout)
|
data = json.loads(process.stdout)
|
||||||
if len(data) != 1:
|
if len(data) != 1:
|
||||||
raise Exception(
|
raise Exception(f"Unreadable output from llvm-readelf for binary {binary}")
|
||||||
f"Unreadable output from llvm-readelf for binary {binary}"
|
|
||||||
)
|
|
||||||
notes = data[0]["Notes"]
|
notes = data[0]["Notes"]
|
||||||
for note in notes:
|
for note in notes:
|
||||||
note_section = note["NoteSection"]
|
note_section = note["NoteSection"]
|
||||||
|
@ -265,19 +259,10 @@ class TestEnvironment:
|
||||||
def setup_logging(self, log_to_file=False):
|
def setup_logging(self, log_to_file=False):
|
||||||
fs = logging.Formatter("%(asctime)s %(levelname)s:%(name)s:%(message)s")
|
fs = logging.Formatter("%(asctime)s %(levelname)s:%(name)s:%(message)s")
|
||||||
if log_to_file:
|
if log_to_file:
|
||||||
logfile_handler = logging.FileHandler(
|
logfile_handler = logging.FileHandler(self.tmp_dir().joinpath("log"))
|
||||||
self.tmp_dir().joinpath("log")
|
|
||||||
)
|
|
||||||
logfile_handler.setLevel(logging.DEBUG)
|
logfile_handler.setLevel(logging.DEBUG)
|
||||||
logfile_handler.setFormatter(fs)
|
logfile_handler.setFormatter(fs)
|
||||||
logging.getLogger().addHandler(logfile_handler)
|
logging.getLogger().addHandler(logfile_handler)
|
||||||
stream_handler = logging.StreamHandler(sys.stdout)
|
|
||||||
stream_handler.setFormatter(fs)
|
|
||||||
if self.verbose:
|
|
||||||
stream_handler.setLevel(logging.DEBUG)
|
|
||||||
else:
|
|
||||||
stream_handler.setLevel(logging.INFO)
|
|
||||||
logging.getLogger().addHandler(stream_handler)
|
|
||||||
logging.getLogger().setLevel(logging.DEBUG)
|
logging.getLogger().setLevel(logging.DEBUG)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -454,9 +439,7 @@ class TestEnvironment:
|
||||||
# Initialize temp directory
|
# Initialize temp directory
|
||||||
os.makedirs(self.tmp_dir(), exist_ok=True)
|
os.makedirs(self.tmp_dir(), exist_ok=True)
|
||||||
if len(os.listdir(self.tmp_dir())) != 0:
|
if len(os.listdir(self.tmp_dir())) != 0:
|
||||||
raise Exception(
|
raise Exception(f"Temp directory is not clean (in {self.tmp_dir()})")
|
||||||
f"Temp directory is not clean (in {self.tmp_dir()})"
|
|
||||||
)
|
|
||||||
self.setup_logging(log_to_file=True)
|
self.setup_logging(log_to_file=True)
|
||||||
os.mkdir(self.output_dir)
|
os.mkdir(self.output_dir)
|
||||||
|
|
||||||
|
@ -493,9 +476,7 @@ class TestEnvironment:
|
||||||
shutil.rmtree(self.local_pb_path, ignore_errors=True)
|
shutil.rmtree(self.local_pb_path, ignore_errors=True)
|
||||||
|
|
||||||
# Look up the product bundle transfer manifest.
|
# Look up the product bundle transfer manifest.
|
||||||
self.env_logger.info(
|
self.env_logger.info("Looking up the product bundle transfer manifest...")
|
||||||
"Looking up the product bundle transfer manifest..."
|
|
||||||
)
|
|
||||||
product_name = "minimal." + self.triple_to_arch(self.target)
|
product_name = "minimal." + self.triple_to_arch(self.target)
|
||||||
sdk_version = self.read_sdk_version()
|
sdk_version = self.read_sdk_version()
|
||||||
|
|
||||||
|
@ -517,9 +498,7 @@ class TestEnvironment:
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
transfer_manifest_url = json.loads(output)[
|
transfer_manifest_url = json.loads(output)["transfer_manifest_url"]
|
||||||
"transfer_manifest_url"
|
|
||||||
]
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
raise Exception("Unable to parse transfer manifest") from e
|
raise Exception("Unable to parse transfer manifest") from e
|
||||||
|
@ -769,9 +748,7 @@ class TestEnvironment:
|
||||||
# Use /tmp as the test temporary directory
|
# Use /tmp as the test temporary directory
|
||||||
env_vars += '\n "RUST_TEST_TMPDIR=/tmp",'
|
env_vars += '\n "RUST_TEST_TMPDIR=/tmp",'
|
||||||
|
|
||||||
cml.write(
|
cml.write(self.CML_TEMPLATE.format(env_vars=env_vars, exe_name=exe_name))
|
||||||
self.CML_TEMPLATE.format(env_vars=env_vars, exe_name=exe_name)
|
|
||||||
)
|
|
||||||
|
|
||||||
runner_logger.info("Compiling CML...")
|
runner_logger.info("Compiling CML...")
|
||||||
|
|
||||||
|
@ -922,20 +899,16 @@ class TestEnvironment:
|
||||||
|
|
||||||
if stdout_path is not None:
|
if stdout_path is not None:
|
||||||
if not os.path.exists(stdout_path):
|
if not os.path.exists(stdout_path):
|
||||||
runner_logger.error(
|
runner_logger.error(f"stdout file {stdout_path} does not exist.")
|
||||||
f"stdout file {stdout_path} does not exist."
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
with open(stdout_path, encoding="utf-8", errors="ignore") as f:
|
with open(stdout_path, encoding="utf-8", errors="ignore") as f:
|
||||||
runner_logger.info(f.read())
|
sys.stdout.write(f.read())
|
||||||
if stderr_path is not None:
|
if stderr_path is not None:
|
||||||
if not os.path.exists(stderr_path):
|
if not os.path.exists(stderr_path):
|
||||||
runner_logger.error(
|
runner_logger.error(f"stderr file {stderr_path} does not exist.")
|
||||||
f"stderr file {stderr_path} does not exist."
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
with open(stderr_path, encoding="utf-8", errors="ignore") as f:
|
with open(stderr_path, encoding="utf-8", errors="ignore") as f:
|
||||||
runner_logger.error(f.read())
|
sys.stderr.write(f.read())
|
||||||
|
|
||||||
runner_logger.info("Done!")
|
runner_logger.info("Done!")
|
||||||
return return_code
|
return return_code
|
||||||
|
@ -1037,7 +1010,7 @@ class TestEnvironment:
|
||||||
f"--symbol-path={self.rust_dir}/lib/rustlib/{self.target}/lib",
|
f"--symbol-path={self.rust_dir}/lib/rustlib/{self.target}/lib",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Add rust source if it's available
|
# Add rust source if it's available
|
||||||
rust_src_map = None
|
rust_src_map = None
|
||||||
if args.rust_src is not None:
|
if args.rust_src is not None:
|
||||||
# This matches the remapped prefix used by compiletest. There's no
|
# This matches the remapped prefix used by compiletest. There's no
|
||||||
|
@ -1210,7 +1183,7 @@ def main():
|
||||||
start_parser.add_argument(
|
start_parser.add_argument(
|
||||||
"--use-local-product-bundle-if-exists",
|
"--use-local-product-bundle-if-exists",
|
||||||
help="if the product bundle already exists in the local path, use "
|
help="if the product bundle already exists in the local path, use "
|
||||||
"it instead of downloading it again",
|
"it instead of downloading it again",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
)
|
)
|
||||||
start_parser.set_defaults(func=start)
|
start_parser.set_defaults(func=start)
|
||||||
|
@ -1246,9 +1219,7 @@ def main():
|
||||||
)
|
)
|
||||||
cleanup_parser.set_defaults(func=cleanup)
|
cleanup_parser.set_defaults(func=cleanup)
|
||||||
|
|
||||||
syslog_parser = subparsers.add_parser(
|
syslog_parser = subparsers.add_parser("syslog", help="prints the device syslog")
|
||||||
"syslog", help="prints the device syslog"
|
|
||||||
)
|
|
||||||
syslog_parser.set_defaults(func=syslog)
|
syslog_parser.set_defaults(func=syslog)
|
||||||
|
|
||||||
debug_parser = subparsers.add_parser(
|
debug_parser = subparsers.add_parser(
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
//@ ignore-wasm no panic or subprocess support
|
//@ ignore-wasm no panic or subprocess support
|
||||||
//@ ignore-emscripten no panic or subprocess support
|
//@ ignore-emscripten no panic or subprocess support
|
||||||
//@ ignore-sgx no subprocess support
|
//@ ignore-sgx no subprocess support
|
||||||
|
//@ ignore-fuchsia code returned as ZX_TASK_RETCODE_EXCEPTION_KILL, FIXME (#127539)
|
||||||
|
|
||||||
#![cfg(test)]
|
#![cfg(test)]
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
thread 'main' panicked at $DIR/test-panic-abort-nocapture.rs:34:5:
|
thread 'main' panicked at $DIR/test-panic-abort-nocapture.rs:35:5:
|
||||||
assertion `left == right` failed
|
assertion `left == right` failed
|
||||||
left: 2
|
left: 2
|
||||||
right: 4
|
right: 4
|
||||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||||
thread 'main' panicked at $DIR/test-panic-abort-nocapture.rs:28:5:
|
thread 'main' panicked at $DIR/test-panic-abort-nocapture.rs:29:5:
|
||||||
assertion `left == right` failed
|
assertion `left == right` failed
|
||||||
left: 2
|
left: 2
|
||||||
right: 4
|
right: 4
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
//@ ignore-wasm no panic or subprocess support
|
//@ ignore-wasm no panic or subprocess support
|
||||||
//@ ignore-emscripten no panic or subprocess support
|
//@ ignore-emscripten no panic or subprocess support
|
||||||
//@ ignore-sgx no subprocess support
|
//@ ignore-sgx no subprocess support
|
||||||
|
//@ ignore-fuchsia code returned as ZX_TASK_RETCODE_EXCEPTION_KILL, FIXME (#127539)
|
||||||
|
|
||||||
#![cfg(test)]
|
#![cfg(test)]
|
||||||
#![feature(test)]
|
#![feature(test)]
|
||||||
|
|
|
@ -17,7 +17,7 @@ hello, world
|
||||||
testing123
|
testing123
|
||||||
---- it_fails stderr ----
|
---- it_fails stderr ----
|
||||||
testing321
|
testing321
|
||||||
thread 'main' panicked at $DIR/test-panic-abort.rs:39:5:
|
thread 'main' panicked at $DIR/test-panic-abort.rs:40:5:
|
||||||
assertion `left == right` failed
|
assertion `left == right` failed
|
||||||
left: 2
|
left: 2
|
||||||
right: 5
|
right: 5
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue