Skip to content

Commit d682c84

Browse files
authored
Unrolled build for rust-lang#127461
Rollup merge of rust-lang#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 rust-lang#102032 and rust-lang#58590 for more details on that topic. Many formatting changes are also included in this PR. r? tmandry r? erickt
2 parents 7caf672 + 479b0cd commit d682c84

5 files changed

+22
-49
lines changed

src/ci/docker/scripts/fuchsia-test-runner.py

+17-46
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
"""
99

1010
import argparse
11-
from concurrent.futures import ThreadPoolExecutor
12-
from dataclasses import dataclass
1311
import glob
1412
import io
1513
import json
@@ -20,6 +18,8 @@
2018
import shutil
2119
import subprocess
2220
import sys
21+
from concurrent.futures import ThreadPoolExecutor
22+
from dataclasses import dataclass
2323
from pathlib import Path
2424
from typing import ClassVar, List, Optional
2525

@@ -42,12 +42,8 @@ def exhaust_pipe(handler, pipe):
4242
for line in pipe:
4343
handler(line.rstrip())
4444

45-
executor_out = executor.submit(
46-
exhaust_pipe, stdout_handler, process.stdout
47-
)
48-
executor_err = executor.submit(
49-
exhaust_pipe, stderr_handler, process.stderr
50-
)
45+
executor_out = executor.submit(exhaust_pipe, stdout_handler, process.stdout)
46+
executor_err = executor.submit(exhaust_pipe, stderr_handler, process.stderr)
5147
executor_out.result()
5248
executor_err.result()
5349
retcode = process.poll()
@@ -203,9 +199,7 @@ def build_id(self, binary):
203199
raise Exception(f"Unreadable build-id for binary {binary}")
204200
data = json.loads(process.stdout)
205201
if len(data) != 1:
206-
raise Exception(
207-
f"Unreadable output from llvm-readelf for binary {binary}"
208-
)
202+
raise Exception(f"Unreadable output from llvm-readelf for binary {binary}")
209203
notes = data[0]["Notes"]
210204
for note in notes:
211205
note_section = note["NoteSection"]
@@ -265,19 +259,10 @@ def write_to_file(self):
265259
def setup_logging(self, log_to_file=False):
266260
fs = logging.Formatter("%(asctime)s %(levelname)s:%(name)s:%(message)s")
267261
if log_to_file:
268-
logfile_handler = logging.FileHandler(
269-
self.tmp_dir().joinpath("log")
270-
)
262+
logfile_handler = logging.FileHandler(self.tmp_dir().joinpath("log"))
271263
logfile_handler.setLevel(logging.DEBUG)
272264
logfile_handler.setFormatter(fs)
273265
logging.getLogger().addHandler(logfile_handler)
274-
stream_handler = logging.StreamHandler(sys.stdout)
275-
stream_handler.setFormatter(fs)
276-
if self.verbose:
277-
stream_handler.setLevel(logging.DEBUG)
278-
else:
279-
stream_handler.setLevel(logging.INFO)
280-
logging.getLogger().addHandler(stream_handler)
281266
logging.getLogger().setLevel(logging.DEBUG)
282267

283268
@property
@@ -454,9 +439,7 @@ def start(self):
454439
# Initialize temp directory
455440
os.makedirs(self.tmp_dir(), exist_ok=True)
456441
if len(os.listdir(self.tmp_dir())) != 0:
457-
raise Exception(
458-
f"Temp directory is not clean (in {self.tmp_dir()})"
459-
)
442+
raise Exception(f"Temp directory is not clean (in {self.tmp_dir()})")
460443
self.setup_logging(log_to_file=True)
461444
os.mkdir(self.output_dir)
462445

@@ -493,9 +476,7 @@ def start(self):
493476
shutil.rmtree(self.local_pb_path, ignore_errors=True)
494477

495478
# Look up the product bundle transfer manifest.
496-
self.env_logger.info(
497-
"Looking up the product bundle transfer manifest..."
498-
)
479+
self.env_logger.info("Looking up the product bundle transfer manifest...")
499480
product_name = "minimal." + self.triple_to_arch(self.target)
500481
sdk_version = self.read_sdk_version()
501482

@@ -517,9 +498,7 @@ def start(self):
517498
)
518499

519500
try:
520-
transfer_manifest_url = json.loads(output)[
521-
"transfer_manifest_url"
522-
]
501+
transfer_manifest_url = json.loads(output)["transfer_manifest_url"]
523502
except Exception as e:
524503
print(e)
525504
raise Exception("Unable to parse transfer manifest") from e
@@ -769,9 +748,7 @@ def run(self, args):
769748
# Use /tmp as the test temporary directory
770749
env_vars += '\n "RUST_TEST_TMPDIR=/tmp",'
771750

772-
cml.write(
773-
self.CML_TEMPLATE.format(env_vars=env_vars, exe_name=exe_name)
774-
)
751+
cml.write(self.CML_TEMPLATE.format(env_vars=env_vars, exe_name=exe_name))
775752

776753
runner_logger.info("Compiling CML...")
777754

@@ -922,20 +899,16 @@ def run(self, args):
922899

923900
if stdout_path is not None:
924901
if not os.path.exists(stdout_path):
925-
runner_logger.error(
926-
f"stdout file {stdout_path} does not exist."
927-
)
902+
runner_logger.error(f"stdout file {stdout_path} does not exist.")
928903
else:
929904
with open(stdout_path, encoding="utf-8", errors="ignore") as f:
930-
runner_logger.info(f.read())
905+
sys.stdout.write(f.read())
931906
if stderr_path is not None:
932907
if not os.path.exists(stderr_path):
933-
runner_logger.error(
934-
f"stderr file {stderr_path} does not exist."
935-
)
908+
runner_logger.error(f"stderr file {stderr_path} does not exist.")
936909
else:
937910
with open(stderr_path, encoding="utf-8", errors="ignore") as f:
938-
runner_logger.error(f.read())
911+
sys.stderr.write(f.read())
939912

940913
runner_logger.info("Done!")
941914
return return_code
@@ -1037,7 +1010,7 @@ def debug(self, args):
10371010
f"--symbol-path={self.rust_dir}/lib/rustlib/{self.target}/lib",
10381011
]
10391012

1040-
# Add rust source if it's available
1013+
# Add rust source if it's available
10411014
rust_src_map = None
10421015
if args.rust_src is not None:
10431016
# This matches the remapped prefix used by compiletest. There's no
@@ -1210,7 +1183,7 @@ def print_help(args):
12101183
start_parser.add_argument(
12111184
"--use-local-product-bundle-if-exists",
12121185
help="if the product bundle already exists in the local path, use "
1213-
"it instead of downloading it again",
1186+
"it instead of downloading it again",
12141187
action="store_true",
12151188
)
12161189
start_parser.set_defaults(func=start)
@@ -1246,9 +1219,7 @@ def print_help(args):
12461219
)
12471220
cleanup_parser.set_defaults(func=cleanup)
12481221

1249-
syslog_parser = subparsers.add_parser(
1250-
"syslog", help="prints the device syslog"
1251-
)
1222+
syslog_parser = subparsers.add_parser("syslog", help="prints the device syslog")
12521223
syslog_parser.set_defaults(func=syslog)
12531224

12541225
debug_parser = subparsers.add_parser(

tests/ui/test-attrs/test-panic-abort-nocapture.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
//@ ignore-wasm no panic or subprocess support
1111
//@ ignore-emscripten no panic or subprocess support
1212
//@ ignore-sgx no subprocess support
13+
//@ ignore-fuchsia code returned as ZX_TASK_RETCODE_EXCEPTION_KILL, FIXME (#127539)
1314

1415
#![cfg(test)]
1516

tests/ui/test-attrs/test-panic-abort-nocapture.run.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
thread 'main' panicked at $DIR/test-panic-abort-nocapture.rs:34:5:
1+
thread 'main' panicked at $DIR/test-panic-abort-nocapture.rs:35:5:
22
assertion `left == right` failed
33
left: 2
44
right: 4
55
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
6-
thread 'main' panicked at $DIR/test-panic-abort-nocapture.rs:28:5:
6+
thread 'main' panicked at $DIR/test-panic-abort-nocapture.rs:29:5:
77
assertion `left == right` failed
88
left: 2
99
right: 4

tests/ui/test-attrs/test-panic-abort.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
//@ ignore-wasm no panic or subprocess support
1111
//@ ignore-emscripten no panic or subprocess support
1212
//@ ignore-sgx no subprocess support
13+
//@ ignore-fuchsia code returned as ZX_TASK_RETCODE_EXCEPTION_KILL, FIXME (#127539)
1314

1415
#![cfg(test)]
1516
#![feature(test)]

tests/ui/test-attrs/test-panic-abort.run.stdout

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ hello, world
1717
testing123
1818
---- it_fails stderr ----
1919
testing321
20-
thread 'main' panicked at $DIR/test-panic-abort.rs:39:5:
20+
thread 'main' panicked at $DIR/test-panic-abort.rs:40:5:
2121
assertion `left == right` failed
2222
left: 2
2323
right: 5

0 commit comments

Comments
 (0)