summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEvan Benn <evanbenn@chromium.org>2022-11-04 17:00:40 +1100
committerAnastasia Klimchuk <aklm@chromium.org>2022-12-09 00:26:53 +0000
commitbcaaae15ae65fe8b2f0c2f9cb55c777a57eb5de4 (patch)
treeac4ce5319fe8b93f58a0c3d69bce1c5f79d91e02 /tests
parent2c3bbd91e4ccbff8aa9053ad76a62b33df3119b1 (diff)
downloadflashrom-bcaaae15ae65fe8b2f0c2f9cb55c777a57eb5de4.tar.gz
flashrom-bcaaae15ae65fe8b2f0c2f9cb55c777a57eb5de4.tar.bz2
flashrom-bcaaae15ae65fe8b2f0c2f9cb55c777a57eb5de4.zip
tests: Detect gcov run and redirect to real I/O functions
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=meson test TEST=ninja coverage Change-Id: If06053ecd78e886c8f7fc55813f4b5635be78c6b Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/69266 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/tests.c b/tests/tests.c
index 41972ba25..b11f64210 100644
--- a/tests/tests.c
+++ b/tests/tests.c
@@ -17,6 +17,7 @@
#include "io_mock.h"
#include "tests.h"
#include "wraps.h"
+#include "io_real.h"
#include <stdio.h>
#include <string.h>
@@ -77,6 +78,7 @@ uint8_t __wrap_sio_read(uint16_t port, uint8_t reg)
static int mock_open(const char *pathname, int flags, mode_t mode)
{
+ maybe_unmock_io(pathname);
if (get_io() && get_io()->iom_open)
return get_io()->iom_open(get_io()->state, pathname, flags, mode);