summaryrefslogtreecommitdiffstats
path: root/tests/wraps.h
Commit message (Collapse)AuthorAgeFilesLines
* tests: Add wrap for __fstat50 to fix tests for NetBSDAnastasia Klimchuk2023-03-161-0/+1
| | | | | | | | | | | | | | Tested by running unit tests on NetBSD 9.2 Ubuntu 22.04.1 (still pass) Change-Id: Icb8e453328cb40ab9d628f01ecdc3886a233dad5 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/73649 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Tested-by: Thomas Heijligen <src@posteo.de> Reviewed-by: Thomas Heijligen <src@posteo.de> Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* tests: Detect llvm coverage run and redirect to real I/O functionsEvan Benn2022-12-091-0/+2
| | | | | | | | | | | | | | | | | Code coverage writes data to disk, we need to use real io functions at this point so that the data is really written. BUG=b:187647884 BRANCH=None TEST=llvm-profdata merge -sparse default.profraw -o default.profdata TEST=llvm-cov show ./flashrom_unit_tests -instr-profile=default.profdata --format=html --output-dir=. Change-Id: I21cc1d631e92fa19006b967e85676f108e80b307 Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/69267 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tests: Redirect to real I/O to support coverage runEvan Benn2022-12-091-0/+3
| | | | | | | | | | | | | | | | Implement a check that redirects mock io functions to the real implementations. Real I/O functions are needed for the coverage tool to be able to create and write files. BUG=None BRANCH=None TEST=None Change-Id: I0817fce6ea0f53a4c127794a0d8246504675f805 Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/69539 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
* tests: Mock the mode_t variant of openEvan Benn2022-12-091-3/+3
| | | | | | | | | | | | | | | | | open has a second form with a mode_t argument. When mocking without this argument a caller trying to O_CREAT would have their mode_t argument discarded and a random stack variable would be used instead. BUG=b:187647884 BRANCH=None TEST=meson test Change-Id: I8c134e6d36a248d0f51985e389085a9e585fb83d Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/69263 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* tree: Fix drivers to pass programmer_cfg to pcidev_init()Edward O'Callaghan2022-09-071-1/+3
| | | | | | | | | | | | Allow for programmer_cfg plumbing in pcidev.c The pci drivers impacted are plumbed here as well. Change-Id: Ie0c9d1c0866d44f64d037c596f2e30547fcfd58f Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66671 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Felix Singer <felixsinger@posteo.net>
* tests: Use regular cmocka wraps for hwaccess functionsAnastasia Klimchuk2022-06-211-6/+6
| | | | | | | | | | | | | | | | | | | | | hwaccess functions used to be static inline functions and needed a special treatment so that they could be mocked for unit tests. This has changed, see include/hwaccess_x86_io.h now the functions are not static inline anymore, and it is possible to use regular cmocka wraps. Fixes https://ticket.coreboot.org/issues/385 BUG=b:181803212 TEST=ninja test Change-Id: Iafce071ea7ad5bcfdebbba968699d5743705f8e0 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/64881 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Joursoir <chat@joursoir.net> Reviewed-by: Thomas Heijligen <src@posteo.de>
* tests: Add and include headers with function prototypesAnastasia Klimchuk2022-04-291-0/+71
Part 2 of fixing -Wmissing-prototypes warnings. This patch adds headers with function prototypes and includes the headers into source files. This fixes the warnings like this: warning: no previous prototype for ‘function_name’ [-Wmissing-prototypes] This patch is needed to sync compiler warning options between meson and makefile. TEST=running the following produces no warnings: meson setup --wipe (to clean build directory) ninja test Change-Id: Ia1ff22deb2354569f277649c6575ef2d5ffbb6e0 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/63489 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de> Reviewed-by: Felix Singer <felixsinger@posteo.net> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>