You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Note that <codeclass="highlighter-rouge">.get()</code> does not take an optional second parameter for a default value if the session option is unset. Instead, this default value is determined from the session option’s definition.</p>
249
+
242
250
<h2id="priority-layers">Priority layers</h2>
243
251
244
-
<p>Session options have a priority based on their source. The <codeclass="highlighter-rouge">OptionsManager</code> class implements these priorities as an ordered sequence of layers from front (high priority) to back (low priority). Each layer is a dict of option name to value. There is also an implicit lowest-priority layer from which default values specified in the option definition are derived.</p>
252
+
<p>Session options have a priority based on their source. The <codeclass="highlighter-rouge">OptionsManager</code> class implements these priorities as an ordered sequence of layers from front (high priority) to back (low priority). Each layer is a dict of option name to value. There is also an implicit lowest-priority layer derived from default values specified in the option definitions.</p>
245
253
246
254
<p>The priorities of the different sources, from front to back:</p>
247
255
248
256
<ol>
249
-
<li>Keyword arguments to the <codeclass="highlighter-rouge">Session</code> constructor. Applies to most command-line arguments.</li>
257
+
<li>Keyword arguments to the <codeclass="highlighter-rouge">Session</code> constructor. Applies to most dedicated command-line arguments.</li>
250
258
<li><em>options</em> parameter to <codeclass="highlighter-rouge">Session</code> constructor. Applies to <codeclass="highlighter-rouge">-O</code> command-line arguments.</li>
251
259
<li>Probe-specific options from a config file.</li>
<p>Note: The <codeclass="highlighter-rouge">semihosting.py</code> unit test requires a target connection and test binary. It is currently the only unit that uses a target. When no targets are available the test cases will be skipped.</p>
283
+
271
284
<h2id="functional-tests">Functional tests</h2>
272
285
273
-
<p>A series of quite comprehensive functional tests are provided in the <codeclass="highlighter-rouge">test/</code> directory. The primary
274
-
script for running these tests is <codeclass="highlighter-rouge">automated_test.py</code>. It will execute all functional tests in
286
+
<p>A series of fairly comprehensive functional tests are provided in the <codeclass="highlighter-rouge">test/</code> directory.</p>
287
+
288
+
<p>The primary script for running these tests is <codeclass="highlighter-rouge">automated_test.py</code>. It will execute all functional tests in
275
289
sequence for all connected debug probes, then produce a summary and JUnit-style XML report. This
276
290
script is used to execute our CI test plan, and we frequently use it on our personal development
277
291
systems to test prior to creating pull requests.</p>
278
292
279
-
<p>Functional tests:</p>
293
+
<p>The <codeclass="highlighter-rouge">automated_test.py</code> script has several command line arguments that can be used to control which test suites are run and on which debug probes. Use <codeclass="highlighter-rouge">--list-tests</code> to see available test suite names. Comma-separated lists of these names can be passed to the <codeclass="highlighter-rouge">-x</code> / <codeclass="highlighter-rouge">--exclude-tests</code> or <codeclass="highlighter-rouge">-i</code> / <codeclass="highlighter-rouge">--include-tests</code> arguments to exclude and include tests, respectively. Only one of these two arguments can be used at a time.</p>
280
294
281
-
<ul>
282
-
<li><codeclass="highlighter-rouge">basic_test.py</code>: a simple test that checks a range of basic functionality, from flash programming to accessing memory and core registers.</li>
283
-
<li><codeclass="highlighter-rouge">blank_test.py</code>: tests ability to connect to devices with with blank flash. (Not run by <codeclass="highlighter-rouge">automated_test.py</code>.)</li>
284
-
<li><codeclass="highlighter-rouge">commander_test.py</code>: tests the <codeclass="highlighter-rouge">pyocd commander</code> functionality.</li>
285
-
<li><codeclass="highlighter-rouge">commands_test.py</code>: tests commands supported by commander and gdb monitor commands.</li>
286
-
<li><codeclass="highlighter-rouge">concurrency_test.py</code>: verify multiple threads can simultaneously access a debug probe, specifically for memory
287
-
transfers.</li>
288
-
<li><codeclass="highlighter-rouge">connect_test.py</code>: tests all combinations of the halt on connect and disconnect resume options.</li>
289
-
<li><codeclass="highlighter-rouge">cortex_test.py</code>: validates CPU control operations and memory accesses.</li>
290
-
<li><codeclass="highlighter-rouge">debug_context_test.py</code>: tests some <codeclass="highlighter-rouge">DebugContext</code> classes.</li>
291
-
<li><codeclass="highlighter-rouge">flash_loader_test.py</code>: test the classes in the <codeclass="highlighter-rouge">pyocd.flash.loader</code> module.</li>
292
-
<li><codeclass="highlighter-rouge">flash_test.py</code>: comprehensive test of flash programming.</li>
293
-
<li><codeclass="highlighter-rouge">import_all.py</code>: imports all pyocd modules. (Not run by <codeclass="highlighter-rouge">automated_test.py</code>.)</li>
294
-
<li><codeclass="highlighter-rouge">gdb_test.py</code>: tests the gdbserver by running a script in a gdb process. Note that on Windows,
295
-
the 32-bit Python 2.7 must be installed for the Python-enabled gdb to work properly and for
296
-
this test to pass.</li>
297
-
<li><codeclass="highlighter-rouge">json_lists_test.py</code>: validates the JSON output from <codeclass="highlighter-rouge">pyocd json</code>.</li>
298
-
<li><codeclass="highlighter-rouge">parallel_test.py</code>: checks for issues with accessing debug probes from multiple processes and threads simultaneously. (Not run by <codeclass="highlighter-rouge">automated_test.py</code>.)</li>
299
-
<li><codeclass="highlighter-rouge">probeserver_test.py</code>: verify remote probe server and client.</li>
300
-
<li><codeclass="highlighter-rouge">speed_test.py</code>: performance test for memory reads and writes.</li>
301
-
<li><codeclass="highlighter-rouge">user_script_test.py</code>: verify loading of user scripts.</li>
302
-
</ul>
295
+
<p>The <codeclass="highlighter-rouge">-b</code> / <codeclass="highlighter-rouge">--board</code> argument is used to select a debug probe on which tests will be run. By default, tests will run on all available debug probes. Adding any <codeclass="highlighter-rouge">--board</code> arguments restricts tests to run on only the specified set of debug probes.</p>
296
+
297
+
<h3id="list-of-functional-tests">List of functional tests</h3>
298
+
299
+
<p>Test scripts with an “n/a” for the test name are not run by <codeclass="highlighter-rouge">automated_test.py</code> (or in CI) and have to be run directly with Python.</p>
Tests the gdbserver by running the <tt>gdb_test_script.py</tt> script in a gdb process.
351
+
Note that on Windows, the 32-bit Python 2.7 must be installed for the Python-enabled <tt>arm-none-eabi-gdb</tt> to work properly and for this test to pass.
<p>The functional tests and some unit tests (currently only <codeclass="highlighter-rouge">test/unit/semihosting.py</code>) require a test firmware binary in order to run. This firmware can be extremely simple. The only requirement is that it have a valid vector table and be executable when loaded to the base of the boot memory. Ideally an LED is blinked so there is an easily-identifiable visual signal that the firmware is running.</p>
379
+
380
+
<p>Built-in targets almost all include a test binary in the pyOCD repository under <codeclass="highlighter-rouge">test/data/binaries/</code>. If the board has a board ID, e.g., those listed in <codeclass="highlighter-rouge">pyocd/board/board_ids.py</code>, the test binary is automatically identified.</p>
381
+
382
+
<p>If the target is not built-in (DFP) or does not have a board ID then, the <codeclass="highlighter-rouge">test_binary</code> session option must be set to the path of a test firmware binary file relative to the <codeclass="highlighter-rouge">test/data/binaries</code> directory. This can be conveniently added as probe-specific options in a <codeclass="highlighter-rouge">pyocd.yaml</code> config file placed under <codeclass="highlighter-rouge">test/</code>.</p>
303
383
304
384
<h2id="azure-pipelines">Azure Pipelines</h2>
305
385
@@ -322,7 +402,7 @@ <h2 id="testing-with-tox">Testing with tox</h2>
322
402
<p>To run the functional tests via tox, just execute <codeclass="highlighter-rouge">tox</code> from the root of the pyOCD
323
403
repo. It will create new virtual environments for each Python version and run <codeclass="highlighter-rouge">automated_test.py</code>.</p>
324
404
325
-
<p>Currently only the functions tests are included in the tox configuration.</p>
405
+
<p>Currently only the functional tests are included in the tox configuration.</p>
0 commit comments