Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add --fast-ci and --slow-ci as options of test and ci subcomm…
…ands
  • Loading branch information
mhsmith committed Oct 4, 2025
commit 1fd81f93eaa924685c1846efbd2d705895472bf9
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ jobs:
with:
persist-credentials: false
- name: Build and test
run: ./Android/android.py ci ${{ matrix.arch }}-linux-android
run: ./Android/android.py ci --fast-ci ${{ matrix.arch }}-linux-android

build-wasi:
name: 'WASI'
Expand Down
34 changes: 24 additions & 10 deletions Android/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,17 @@ async def gradle_task(context):
task_prefix = "connected"
env["ANDROID_SERIAL"] = context.connected

if context.ci_mode:
context.args[0:0] = [
# See _add_ci_python_opts in libregrtest/main.py.
"-W", "error", "-bb", "-E",

# Randomization is disabled because order-dependent failures are
# much less likely to pass on a rerun in single-process mode.
"-m", "test",
f"--{context.ci_mode}-ci", "--single-process", "--no-randomize"
]

if not any(arg in context.args for arg in ["-c", "-m"]):
context.args[0:0] = ["-m", "test"]

Expand Down Expand Up @@ -733,18 +744,11 @@ def ci(context):

# Prove the package is self-contained by using it to run the tests.
shutil.unpack_archive(package_path, temp_dir)

launcher_args = ["--managed", "maxVersion", "-v"]
test_args = [
# See _add_ci_python_opts in libregrtest/main.py.
"-W", "error", "-bb", "-E",

# Randomization is disabled because order-dependent failures are
# much less likely to pass on a rerun in single-process mode.
"-m", "test", "--fast-ci", "--single-process", "--no-randomize"
launcher_args = [
"--managed", "maxVersion", "-v", f"--{context.ci_mode}-ci"
]
run(
["./android.py", "test", *launcher_args, "--", *test_args],
["./android.py", "test", *launcher_args],
cwd=temp_dir
)
print("::endgroup::")
Expand Down Expand Up @@ -839,6 +843,16 @@ def add_parser(*args, **kwargs):
"-g", action="store_true", default=False, dest="debug",
help="Include debug information in package")

# CI arguments
for subcommand in [test, ci]:
group = subcommand.add_mutually_exclusive_group(required=subcommand is ci)
group.add_argument(
"--fast-ci", action="store_const", dest="ci_mode", const="fast",
help="Add test arguments for GitHub Actions")
group.add_argument(
"--slow-ci", action="store_const", dest="ci_mode", const="slow",
help="Add test arguments for buildbots")

return parser.parse_args()


Expand Down
10 changes: 5 additions & 5 deletions Lib/test/libregrtest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,10 +648,9 @@ def _add_cross_compile_opts(self, regrtest_opts):
def _add_ci_python_opts(self, python_opts, keep_environ):
# --fast-ci and --slow-ci add options to Python.
#
# Some platforms cannot change options after startup, so if these
# options are changed, also update the copies in:
# * cpython/Android/android.py
# * buildmaster-config/master/custom/factories.py
# Some platforms run tests in embedded mode and cannot change options
# after startup, so if this function changes, consider also updating:
# * gradle_task in Android/android.py

# Unbuffered stdout and stderr. This isn't helpful on Android, because
# it would cause lines to be split into multiple log messages.
Expand All @@ -678,7 +677,8 @@ def _execute_python(self, cmd, environ):

cmd_text = shlex.join(cmd)
try:
# Android and iOS run tests in embedded mode.
# Android and iOS run tests in embedded mode. To update their
# Python options, see the comment in _add_ci_python_opts.
if not cmd[0]:
raise ValueError("No Python executable is present")

Expand Down