Skip to content

Commit 181a15b

Browse files
committed
Add a verbose mode to the iOS runner to hide most Xcode output.
1 parent 21a5845 commit 181a15b

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

Makefile.pre.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2169,7 +2169,7 @@ testios:
21692169
$(PYTHON_FOR_BUILD) $(srcdir)/iOS/testbed clone --framework $(PYTHONFRAMEWORKPREFIX) "$(XCFOLDER)"
21702170

21712171
# Run the testbed project
2172-
$(PYTHON_FOR_BUILD) "$(XCFOLDER)" run -- test -uall --single-process --rerun -W
2172+
$(PYTHON_FOR_BUILD) "$(XCFOLDER)" run --verbose -- test -uall --single-process --rerun -W
21732173

21742174
# Like test, but using --slow-ci which enables all test resources and use
21752175
# longer timeout. Run an optional pybuildbot.identify script to include

iOS/testbed/__main__.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ async def log_stream_task(initial_devices):
143143
sys.stdout.write(line)
144144

145145

146-
async def xcode_test(location, simulator):
146+
async def xcode_test(location, simulator, verbose):
147147
# Run the test suite on the named simulator
148148
args = [
149149
"xcodebuild",
@@ -159,6 +159,9 @@ async def xcode_test(location, simulator):
159159
"-derivedDataPath",
160160
str(location / "DerivedData"),
161161
]
162+
if not verbose:
163+
args += ["-quiet"]
164+
162165
async with async_process(
163166
*args,
164167
stdout=subprocess.PIPE,
@@ -254,7 +257,7 @@ def update_plist(testbed_path, args):
254257
plistlib.dump(info, f)
255258

256259

257-
async def run_testbed(simulator: str, args: list[str]):
260+
async def run_testbed(simulator: str, args: list[str], verbose: bool=False):
258261
location = Path(__file__).parent
259262
print("Updating plist...")
260263
update_plist(location, args)
@@ -267,7 +270,7 @@ async def run_testbed(simulator: str, args: list[str]):
267270
try:
268271
async with asyncio.TaskGroup() as tg:
269272
tg.create_task(log_stream_task(initial_devices))
270-
tg.create_task(xcode_test(location, simulator))
273+
tg.create_task(xcode_test(location, simulator=simulator, verbose=verbose))
271274
except* MySystemExit as e:
272275
raise SystemExit(*e.exceptions[0].args) from None
273276
except* subprocess.CalledProcessError as e:
@@ -326,6 +329,11 @@ def main():
326329
default="iPhone SE (3rd Generation)",
327330
help="The name of the simulator to use (default: 'iPhone SE (3rd Generation)')",
328331
)
332+
run.add_argument(
333+
"-v", "--verbose",
334+
action="store_true",
335+
help="Enable verbose output",
336+
)
329337

330338
try:
331339
pos = sys.argv.index("--")
@@ -359,6 +367,7 @@ def main():
359367
asyncio.run(
360368
run_testbed(
361369
simulator=context.simulator,
370+
verbose=context.verbose,
362371
args=test_args,
363372
)
364373
)

0 commit comments

Comments
 (0)