zephyr/scripts
Martí Bolívar a8612f75c5 scripts: dts: convert test suites to pytest
Use the pytest test framework in the dtlib.py and edtlib.py test
suites (testdtlib.py and testedtlib.py respectively).

The goal here is not to change what is being tested. The existing test
suite is excellent and very thorough.

However, it is made up of executable scripts where all of the tests
are run using a hand-rolled framework in a single function per file.
This is a bit all-or-nothing and prevents various nice features
available in the de-facto standard pytest test framework from being
used.

In particular, pytest can:

- drop into a debugger (pdb) when there is a problem
- accept a pattern which specifies a subset of tests to run
- print very detailed error messages about the actual and expected
  results in various traceback formats from brief to very verbose
- gather coverage data for the python scripts being tested (via plugin)
- run tests in parallel (via plugin)
- It's easy in pytest to run tests with temporary directories
  using the tmp_path and other fixtures. This us avoid
  temporarily dirtying the working tree as is done now.

Moving to pytest lets us leverage all of these things without any loss
in ease of use (in fact, some things are nicer in pytest):

- Any function that starts with "test_" is automatically picked up and
  run. No need for rolling up lists of functions into a test suite.
- Tests are written using ordinary Python 'assert'
  statements.
- Pytest magic unpacks the AST of failed asserts to print details on
  what went wrong in really nice ways. For example, it will show you
  exactly what parts of two strings that are expected to be equal
  differ.

For the most part, this is a pretty mechanical conversion:

- extract helpers and test cases into separate functions
- insert temporary paths and adjust tests accordingly to not match
  file names exactly
- use 'assert CONDITION' instead of 'if not CONDITION: fail()'

There are a few cases where making this happen required slightly
larger changes than that, but they are limited.

Move the checks from check_compliance.py to a new GitHub workflow,
removing hacks that are no longer needed.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-10-02 11:51:15 +02:00
..
checkpatch
ci scripts: dts: convert test suites to pytest 2020-10-02 11:51:15 +02:00
coccinelle scripts: coccinelle: Scripts for finding wrong device instance usage 2020-09-02 13:48:13 +02:00
coredump coredump: add support for ARM Cortex-M 2020-08-24 20:28:24 -04:00
dts scripts: dts: convert test suites to pytest 2020-10-02 11:51:15 +02:00
footprint scripts: size_report: Fix colorized output 2020-09-03 09:54:21 -04:00
gitlint
kconfig benchmarking: remove execution benchmarking code 2020-09-05 13:28:38 -05:00
net scripts: net: Fix incorrect error messages 2020-05-21 14:45:07 +02:00
release
sanity_chk sanitycheck: ignore coverage directories by matching any in path hierarchy 2020-10-01 17:11:34 -04:00
support
tests sanitycheck: tests: adapt testsuite to new filter 2020-10-01 07:28:01 -05:00
tracing tracing: scripts: add scripts for parsing ctf data 2020-08-24 13:21:12 +02:00
west_commands nrfjprog.py: Fail if hex file has UICR data and no --erase 2020-09-28 14:09:14 -05:00
.gitignore scripts: tests: sanitycheck: Add basic foundation for sanitycheck testsuite 2020-03-24 22:32:26 -04:00
checkpatch.pl scripts: update checkpatch based on current linux kernel version 2020-08-21 13:57:02 -04:00
checkstack.pl
coccicheck scripts: Fix documunt referenc for coccicheck 2020-05-08 17:44:44 +02:00
dir_is_writeable.py
file2hex.py scripts: file2hex.py: PEP 8 style fix 2020-06-12 11:09:58 +02:00
filter-known-issues.py
gen_app_partitions.py linker: tweak section naming to feet all linkers 2020-09-05 10:22:56 -05:00
gen_cfb_font_header.py zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
gen_gcov_files.py scripts: gen_gcov_files.py: add argument help text 2020-06-13 16:33:22 -04:00
gen_kobject_list.py userspace: update k_object API to support immutable objects 2020-09-02 13:48:13 +02:00
gen_offset_header.py scripts: gen_offset_header: add argument help text 2020-05-21 14:45:24 +02:00
gen_relocate_app.py zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
gen_syscalls.py scripts: gen_syscalls: typo fix 2020-06-09 10:39:49 +02:00
get_maintainer.py scripts: add maintainer script 2020-07-24 17:07:48 +02:00
mergehex.py
parse_syscalls.py userspace: net sockets are kernel objects 2020-06-03 22:33:32 +02:00
process_gperf.py scripts: process_gperf: typo fix 2020-06-09 10:40:58 +02:00
requirements-base.txt requirements: add anytree 2020-08-14 18:49:26 -04:00
requirements-build-test.txt scripts: runners: add type checking for west_commands 2020-09-03 16:49:09 -05:00
requirements-compliance.txt python3: add check_compliance package requirements 2020-08-11 14:49:48 -04:00
requirements-doc.txt doc: bump breathe>=4.21.0 2020-09-15 15:25:01 +02:00
requirements-extras.txt scripts/requirements: add lpc_checksum script 2020-07-29 20:12:24 +02:00
requirements-run-test.txt documents: update the pyocd required version 2020-09-29 13:37:53 -05:00
requirements.txt python3: add check_compliance package requirements 2020-08-11 14:49:48 -04:00
sanitycheck sanitycheck: add optional --coverage-basedir argument 2020-10-01 17:11:34 -04:00
series-push-hook.sh
spelling.txt
subfolder_list.py scripts: subfolder_list.py: refactor the code 2020-07-20 17:31:53 -04:00
tags.sh
user_wordsize.py posix arch: build on aarch64 / allow host-specific cmake includes 2020-05-09 12:17:24 +02:00
valgrind.supp
west-commands.yml cmake: West extension command for Zephyr config package registration 2020-03-27 16:23:46 +01:00
zephyr_module.py cmake: zephyr module processing improvements. 2020-08-31 12:15:02 +02:00