8
8
"""
9
9
10
10
import argparse
11
- from concurrent .futures import ThreadPoolExecutor
12
- from dataclasses import dataclass
13
11
import glob
14
12
import io
15
13
import json
20
18
import shutil
21
19
import subprocess
22
20
import sys
21
+ from concurrent .futures import ThreadPoolExecutor
22
+ from dataclasses import dataclass
23
23
from pathlib import Path
24
24
from typing import ClassVar , List , Optional
25
25
@@ -42,12 +42,8 @@ def exhaust_pipe(handler, pipe):
42
42
for line in pipe :
43
43
handler (line .rstrip ())
44
44
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 )
51
47
executor_out .result ()
52
48
executor_err .result ()
53
49
retcode = process .poll ()
@@ -203,9 +199,7 @@ def build_id(self, binary):
203
199
raise Exception (f"Unreadable build-id for binary { binary } " )
204
200
data = json .loads (process .stdout )
205
201
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 } " )
209
203
notes = data [0 ]["Notes" ]
210
204
for note in notes :
211
205
note_section = note ["NoteSection" ]
@@ -265,9 +259,7 @@ def write_to_file(self):
265
259
def setup_logging (self , log_to_file = False ):
266
260
fs = logging .Formatter ("%(asctime)s %(levelname)s:%(name)s:%(message)s" )
267
261
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" ))
271
263
logfile_handler .setLevel (logging .DEBUG )
272
264
logfile_handler .setFormatter (fs )
273
265
logging .getLogger ().addHandler (logfile_handler )
@@ -447,9 +439,7 @@ def start(self):
447
439
# Initialize temp directory
448
440
os .makedirs (self .tmp_dir (), exist_ok = True )
449
441
if len (os .listdir (self .tmp_dir ())) != 0 :
450
- raise Exception (
451
- f"Temp directory is not clean (in { self .tmp_dir ()} )"
452
- )
442
+ raise Exception (f"Temp directory is not clean (in { self .tmp_dir ()} )" )
453
443
self .setup_logging (log_to_file = True )
454
444
os .mkdir (self .output_dir )
455
445
@@ -486,9 +476,7 @@ def start(self):
486
476
shutil .rmtree (self .local_pb_path , ignore_errors = True )
487
477
488
478
# Look up the product bundle transfer manifest.
489
- self .env_logger .info (
490
- "Looking up the product bundle transfer manifest..."
491
- )
479
+ self .env_logger .info ("Looking up the product bundle transfer manifest..." )
492
480
product_name = "minimal." + self .triple_to_arch (self .target )
493
481
sdk_version = self .read_sdk_version ()
494
482
@@ -510,9 +498,7 @@ def start(self):
510
498
)
511
499
512
500
try :
513
- transfer_manifest_url = json .loads (output )[
514
- "transfer_manifest_url"
515
- ]
501
+ transfer_manifest_url = json .loads (output )["transfer_manifest_url" ]
516
502
except Exception as e :
517
503
print (e )
518
504
raise Exception ("Unable to parse transfer manifest" ) from e
@@ -762,9 +748,7 @@ def run(self, args):
762
748
# Use /tmp as the test temporary directory
763
749
env_vars += '\n "RUST_TEST_TMPDIR=/tmp",'
764
750
765
- cml .write (
766
- self .CML_TEMPLATE .format (env_vars = env_vars , exe_name = exe_name )
767
- )
751
+ cml .write (self .CML_TEMPLATE .format (env_vars = env_vars , exe_name = exe_name ))
768
752
769
753
runner_logger .info ("Compiling CML..." )
770
754
@@ -915,17 +899,13 @@ def run(self, args):
915
899
916
900
if stdout_path is not None :
917
901
if not os .path .exists (stdout_path ):
918
- runner_logger .error (
919
- f"stdout file { stdout_path } does not exist."
920
- )
902
+ runner_logger .error (f"stdout file { stdout_path } does not exist." )
921
903
else :
922
904
with open (stdout_path , encoding = "utf-8" , errors = "ignore" ) as f :
923
905
sys .stdout .write (f .read ())
924
906
if stderr_path is not None :
925
907
if not os .path .exists (stderr_path ):
926
- runner_logger .error (
927
- f"stderr file { stderr_path } does not exist."
928
- )
908
+ runner_logger .error (f"stderr file { stderr_path } does not exist." )
929
909
else :
930
910
with open (stderr_path , encoding = "utf-8" , errors = "ignore" ) as f :
931
911
sys .stderr .write (f .read ())
@@ -1030,7 +1010,7 @@ def debug(self, args):
1030
1010
f"--symbol-path={ self .rust_dir } /lib/rustlib/{ self .target } /lib" ,
1031
1011
]
1032
1012
1033
- # Add rust source if it's available
1013
+ # Add rust source if it's available
1034
1014
rust_src_map = None
1035
1015
if args .rust_src is not None :
1036
1016
# This matches the remapped prefix used by compiletest. There's no
@@ -1203,7 +1183,7 @@ def print_help(args):
1203
1183
start_parser .add_argument (
1204
1184
"--use-local-product-bundle-if-exists" ,
1205
1185
help = "if the product bundle already exists in the local path, use "
1206
- "it instead of downloading it again" ,
1186
+ "it instead of downloading it again" ,
1207
1187
action = "store_true" ,
1208
1188
)
1209
1189
start_parser .set_defaults (func = start )
@@ -1239,9 +1219,7 @@ def print_help(args):
1239
1219
)
1240
1220
cleanup_parser .set_defaults (func = cleanup )
1241
1221
1242
- syslog_parser = subparsers .add_parser (
1243
- "syslog" , help = "prints the device syslog"
1244
- )
1222
+ syslog_parser = subparsers .add_parser ("syslog" , help = "prints the device syslog" )
1245
1223
syslog_parser .set_defaults (func = syslog )
1246
1224
1247
1225
debug_parser = subparsers .add_parser (
0 commit comments