@@ -547,6 +547,17 @@ async def gradle_task(context):
547547 task_prefix = "connected"
548548 env ["ANDROID_SERIAL" ] = context .connected
549549
550+ if context .ci_mode :
551+ context .args [0 :0 ] = [
552+ # See _add_ci_python_opts in libregrtest/main.py.
553+ "-W" , "error" , "-bb" , "-E" ,
554+
555+ # Randomization is disabled because order-dependent failures are
556+ # much less likely to pass on a rerun in single-process mode.
557+ "-m" , "test" ,
558+ f"--{ context .ci_mode } -ci" , "--single-process" , "--no-randomize"
559+ ]
560+
550561 if not any (arg in context .args for arg in ["-c" , "-m" ]):
551562 context .args [0 :0 ] = ["-m" , "test" ]
552563
@@ -733,18 +744,11 @@ def ci(context):
733744
734745 # Prove the package is self-contained by using it to run the tests.
735746 shutil .unpack_archive (package_path , temp_dir )
736-
737- launcher_args = ["--managed" , "maxVersion" , "-v" ]
738- test_args = [
739- # See _add_ci_python_opts in libregrtest/main.py.
740- "-W" , "error" , "-bb" , "-E" ,
741-
742- # Randomization is disabled because order-dependent failures are
743- # much less likely to pass on a rerun in single-process mode.
744- "-m" , "test" , "--fast-ci" , "--single-process" , "--no-randomize"
747+ launcher_args = [
748+ "--managed" , "maxVersion" , "-v" , f"--{ context .ci_mode } -ci"
745749 ]
746750 run (
747- ["./android.py" , "test" , * launcher_args , "--" , * test_args ],
751+ ["./android.py" , "test" , * launcher_args ],
748752 cwd = temp_dir
749753 )
750754 print ("::endgroup::" )
@@ -839,6 +843,16 @@ def add_parser(*args, **kwargs):
839843 "-g" , action = "store_true" , default = False , dest = "debug" ,
840844 help = "Include debug information in package" )
841845
846+ # CI arguments
847+ for subcommand in [test , ci ]:
848+ group = subcommand .add_mutually_exclusive_group (required = subcommand is ci )
849+ group .add_argument (
850+ "--fast-ci" , action = "store_const" , dest = "ci_mode" , const = "fast" ,
851+ help = "Add test arguments for GitHub Actions" )
852+ group .add_argument (
853+ "--slow-ci" , action = "store_const" , dest = "ci_mode" , const = "slow" ,
854+ help = "Add test arguments for buildbots" )
855+
842856 return parser .parse_args ()
843857
844858
0 commit comments