1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-01 06:01:16 +02:00

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>
This commit is contained in:
Evan Benn
2022-11-04 17:00:40 +11:00
committed by Anastasia Klimchuk
parent 2c3bbd91e4
commit bcaaae15ae
2 changed files with 14 additions and 0 deletions

View File

@ -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);