summaryrefslogtreecommitdiffstats
path: root/tests/include
Commit message (Collapse)AuthorAgeFilesLines
* tests: Move SKIP_TEST macro to common headerEvan Benn2022-11-281-0/+3
| | | | | | | | | | | | | BUG=None BRANCH=None TEST=None Change-Id: I6cca635212867dad5a8e391a46b1d943530c539a Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/69621 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tests: use MOCK_FD instead of NON_ZERODaniel Campello2022-04-061-0/+2
| | | | | | | | | | | | | | | | | | With this change the mocks are able to return a non-negative value for the file descriptor expected from open operations. This avoid issues with subsequent error checks of the form `if (fd < 0)` BUG=b:227404721 TEST=./test_build.sh; FEATURES=test emerge-amd64-generic flashrom BRANCH=none Signed-off-by: Daniel Campello <campello@chromium.org> Change-Id: Ib6bac051852aea2465665a6fd669b7f5e3772985 Reviewed-on: https://review.coreboot.org/c/flashrom/+/63193 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Nikolai Artemiev <nartemiev@google.com> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* tests: Move LOG_ME to include/tests.h to be available everywhereAnastasia Klimchuk2021-10-181-0/+2
| | | | | | | | | | | | | | | LOG_ME macro is very generic and can be useful anywhere in tests. Previously was only used in scope of tests.c. With time more tests are added, and more files, LOG_ME needs to be visible everywhere. BUG=b:181803212 TEST=builds and ninja test Change-Id: If7f3d256161bc8b81e996328e445cccab9a82174 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/57914 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* tests: Add NON_ZERO macro and not_null function instead of MOCK_HANDLEAnastasia Klimchuk2021-10-181-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | This patch adds NON_ZERO macro and not_null function into io_mock.h, so that they can be used anywhere in tests. Common usage for not_null is to indicate a valid pointer, where it doesn't matter what the pointer is, only matters it is not null. Common usage of NON_ZERO is to indicate a valid file descriptor, where it only matters the descriptor is non-zero integer. New features replace all usages of previous MOCK_HANDLE. This patch corrects return value from __wrap_ioctl to be successful by default. It used to be MOCK_HANDLE, but should be 0. Included in this patch because this is also a replacement of MOCK_HANDLE. BUG=b:181803212 TEST=builds and ninja test Change-Id: I5ad6ee4aa9091447c6c9108c92bf7f6e755fca48 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/57269 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
* tests: Update licence headersNikolai Artemiev2020-09-171-2/+14
| | | | | | | | | | Signed-off-by: Nikolai Artemiev <nartemiev@google.com> Change-Id: Ia964279ace569b4b93f4e2919c1c228a9b621745 Reviewed-on: https://review.coreboot.org/c/flashrom/+/45438 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* tests/: Add CMocka unit-test infrastructureEdward O'Callaghan2020-06-161-0/+18
This adds the CMocka unit-testing infrastructure into the meson build system which we will latter follow up with unit-tests for flashrom's core logic. BUG=b:157280555 BRANCH=none TEST=builds Change-Id: I66665f56627b3d99049176bfbebbd771b080370a Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/41622 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>