Nico Huber submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved Angel Pons: Looks good to me, approved
hwaccess_x86_io_unittest: Add dummy iopl to avoid including sys/io.h

sys/io.h is platform specific, and also in tests environment we
don't need real functions anyway. Adding dummy implementation of
iopl is sufficient for tests. The rest of io is not needed
because hwaccess_x86_io_unittest.h re-defines macros OUTB/INB/etc
and those macros evaluate to test-only functions.

This is a follow up on commit 21e22ba8a7750f1cfe5cd3323e3137695ffef0a4
which introduced hwaccess_x86_io_unittest.h

BUG=b:181803212
TEST=builds and ninja test on x86 (same as before)

Change-Id: I3f2f0408be7c00f954b899031b52b2b97ef19ca3
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/55741
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Nico Huber <nico.h@gmx.de>
---
M tests/hwaccess_x86_io_unittest.h
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/tests/hwaccess_x86_io_unittest.h b/tests/hwaccess_x86_io_unittest.h
index 7bffc96..2a4cd5f 100644
--- a/tests/hwaccess_x86_io_unittest.h
+++ b/tests/hwaccess_x86_io_unittest.h
@@ -38,7 +38,17 @@
#define INL(p) test_inl(p)

#include <stdint.h>
-#include <sys/io.h>
+
+/*
+ * Dummy implementation of iopl from sys/io.h.
+ * sys/io.h by itself is platform-specific, so instead of including
+ * the header we just have this dummy function, which is sufficient
+ * for test purposes.
+ */
+static inline int iopl(int level)
+{
+ return 0;
+}

/* All functions below are mocked in unit tests. */


To view, visit change 55741. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I3f2f0408be7c00f954b899031b52b2b97ef19ca3
Gerrit-Change-Number: 55741
Gerrit-PatchSet: 7
Gerrit-Owner: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter@mailbox.org>
Gerrit-MessageType: merged