@@ -68,3 +68,76 @@ And to run only a certain set of tests (eg a directory):
6868
6969 $ ./run-tests.py -d basics
7070 $ ./run-tests.py float/builtin* .py
71+
72+ Using run-tests.py
73+ ------------------
74+
75+ The ``run-tests.py `` script supports several parameters to customize test execution:
76+
77+ **Target and Device Selection: **
78+
79+ * ``-t, --test-instance ``
80+
81+ The -t option accepts the following for the test instance:
82+
83+ - **unix ** - use the unix port of MicroPython, specified by the MICROPY_MICROPYTHON
84+ environment variable (which defaults to the standard variant of either the unix
85+ or windows ports, depending on the host platform)
86+ - **webassembly ** - use the webassembly port of MicroPython, specified by the
87+ MICROPY_MICROPYTHON_MJS environment variable (which defaults to the standard
88+ variant of the webassembly port)
89+ - **port:<device> ** - connect to and use the given serial port device
90+ - **a<n> ** - connect to and use /dev/ttyACM<n>
91+ - **u<n> ** - connect to and use /dev/ttyUSB<n>
92+ - **c<n> ** - connect to and use COM<n>
93+ - **exec:<command> ** - execute a command and attach to it's stdin/stdout
94+ - **execpty:<command> ** - execute a command and attach to the printed /dev/pts/<n> device
95+ - **<a>.<b>.<c>.<d> ** - connect to the given IPv4 address
96+ - anything else specifies a serial port
97+
98+ **Test Selection: **
99+
100+ * ``-d, --test-dirs `` - Specify one or more test directories to run
101+ * ``-i, --include REGEX `` - Include tests matching regex pattern
102+ * ``-e, --exclude REGEX `` - Exclude tests matching regex pattern
103+ * ``files `` - Specific test files to run
104+
105+ **Execution Options: **
106+
107+ * ``--emit <EMITTER> `` - MicroPython emitter, EMITTER can be bytecode or native. Default: bytecode
108+ * ``--via-mpy `` - Compile .py files to .mpy first
109+ * ``--heapsize `` - Set heap size for tests
110+ * ``-j, --jobs N `` - Number of tests to run simultaneously
111+
112+ Set the MICROPY_MPYCROSS environment variable to use a specific version of ``mpy-cross `` when using ``--via-mpy ``.
113+
114+ **Result Management: **
115+
116+ * ``-r, --result-dir `` - Directory for test results. Default: results/
117+ * ``--print-failures `` - Show diff of failed tests and exit
118+ * ``--clean-failures `` - Delete .exp and .out files from prior failed tests
119+ * ``--run-failures `` - Re-run only previously failed tests
120+
121+ **Examples: **
122+
123+ .. code-block :: bash
124+
125+ # Run only basic tests with native emitter
126+ $ ./run-tests.py --emit native -d basics extmod
127+
128+ # Run tests excluding async functionality
129+ $ ./run-tests.py -e async
130+
131+ # Run tests matching *_pep_*
132+ $ ./run-tests.py -i * _pep_*
133+
134+ # Run specific test files in parallel
135+ $ ./run-tests.py -j 4 basics/list* .py
136+
137+ # Test on connected ESP32 board
138+ $ ./run-tests.py -t /dev/ttyUSB0
139+ # or
140+ $ ./run-tests.py -t u0
141+
142+ # Re-run only failed tests from previous run
143+ $ ./run-tests.py --run-failures
0 commit comments