From 26ed5fe471da1dcb167621723f372226cf85d40f Mon Sep 17 00:00:00 2001 From: Kinga Stefaniuk Date: Thu, 12 Sep 2024 10:33:50 +0200 Subject: [PATCH] [ENHANCEMENT] add README to test directory Fixes #234 Signed-off-by: Kinga Stefaniuk --- .github/workflows/review.yml | 2 +- tests/README.md | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 tests/README.md diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml index 6aacdc67..f92aa739 100644 --- a/.github/workflows/review.yml +++ b/.github/workflows/review.yml @@ -29,11 +29,11 @@ jobs: .github/** LICENSES/** .gitignore - *.md autogen.sh pytest.ini *.yapf COPYING* + */*.md - name: Run license review env: ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 00000000..d846aabe --- /dev/null +++ b/tests/README.md @@ -0,0 +1,30 @@ +## Running tests with pytest + +To run tests suite, make sure python and pytest with at least 3.11 version is installed. + +## How to compile with tests enabled + +Run `autogen.sh` to generate compilation configurations. +Run `./configure` with `--enable-test` to enable building unit tests and add a target for `make check`. This option requires `--enable-library` too. +Compile with `make` or `make check` when you want to run unit tests just after compilation. + +## Parameters to configure + +There is possibility to set: + +- `--ledctl-binary` - path to ledctl, +- `--slot-filters` - comma separated list of slot filters to exclude, +- `--controller-filters` - comma separated list of controller types to exclude. + + +## How to run tests + +There are few methods to run tests: + +- run `pytest` with or without parameters to set, + +```shell +$ pytest --ledctl-binary=src/ledctl/ledctl --slot-filters=sg3-,sg2- --controller-filters=VMD +``` +- run `make check` which will compile the code and run tests. Logs will be placed in `./test-suite.log` file, +- run script `tests/runtests.sh`. \ No newline at end of file