summaryrefslogtreecommitdiff
path: root/payloads/libpayload/tests/include/mocks
diff options
context:
space:
mode:
authorJakub Czapiga <jacz@semihalf.com>2021-10-08 09:57:14 +0000
committerFelix Held <felix-coreboot@felixheld.de>2021-10-18 12:33:49 +0000
commit12ae850dfc10709f8c3bcf92ab7ba1397eb4ae43 (patch)
treec31b1c942ba91c67a11103695b47366580fdb3e3 /payloads/libpayload/tests/include/mocks
parente8b6b07bfc4cca2e7554ac8fecb6ddf88f89bc0e (diff)
libpayload: Add unit-tests framework and first test case
This commit adds a unit-tests framework ported from coreboot, and test for drivers/speaker. Usage of the unit-tests framework is same as for the coreboot one. Change-Id: Iaa94ee4dcdc3f74af830113813df0e8fb0b31e4f Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/58242 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Diffstat (limited to 'payloads/libpayload/tests/include/mocks')
-rw-r--r--payloads/libpayload/tests/include/mocks/x86_io.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/payloads/libpayload/tests/include/mocks/x86_io.h b/payloads/libpayload/tests/include/mocks/x86_io.h
new file mode 100644
index 0000000000..c35a57263c
--- /dev/null
+++ b/payloads/libpayload/tests/include/mocks/x86_io.h
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef TESTS_MOCKS_X86_IO_H_
+#define TESTS_MOCKS_X86_IO_H_
+
+unsigned int inl(int port);
+
+unsigned short inw(int port);
+
+unsigned char inb(int port);
+
+void outl(unsigned int val, int port);
+
+void outw(unsigned short val, int port);
+
+void outb(unsigned char val, int port);
+
+void outsl(int port, const void *addr, unsigned long count);
+
+void outsw(int port, const void *addr, unsigned long count);
+
+void outsb(int port, const void *addr, unsigned long count);
+
+void insl(int port, void *addr, unsigned long count);
+
+void insw(int port, void *addr, unsigned long count);
+
+void insb(int port, void *addr, unsigned long count);
+
+#endif