summaryrefslogtreecommitdiffstats
path: root/libflash/mbox-flash.c
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2017-12-05 12:01:13 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-12-18 17:58:32 -0600
commitb9774c47eecd0c90e503919432ec1e4a86355398 (patch)
treefcd3840bc3570c1364093db423692b15964677cc /libflash/mbox-flash.c
parent31f2c03b0abd43f3dadcecd6c00159ed52938081 (diff)
downloadtalos-skiboot-b9774c47eecd0c90e503919432ec1e4a86355398.tar.gz
talos-skiboot-b9774c47eecd0c90e503919432ec1e4a86355398.zip
libflash/test: Add tests for mbox-flash
A first basic set of tests for mbox-flash. These tests do their testing by stubbing out or otherwise replacing functions not in libflash/mbox-flash.c. The stubbed out version of the function can then be used to emulate a BMC mbox daemon talking to back to the code in mbox-flash and it can ensure that there is some adherence to the protocol and that from a blocklevel api point of view the world appears sane. This makes these tests simple to run and they have been integrated into `make check`. The down side is that these tests rely on duplicated feature incomplete BMC daemon behaviour. Therefore these tests are a strong indicator of broken behaviour but a very unreliable indicator of correctness. Full integration tests with a 'real' BMC daemon are probably beyond the scope of this repository. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> [stewart: fix TESTS_LOOPS printf] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'libflash/mbox-flash.c')
-rw-r--r--libflash/mbox-flash.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libflash/mbox-flash.c b/libflash/mbox-flash.c
index 8af2251a..e15fecf0 100644
--- a/libflash/mbox-flash.c
+++ b/libflash/mbox-flash.c
@@ -34,8 +34,10 @@
#include <ccan/container_of/container_of.h>
#ifndef __SKIBOOT__
+#ifndef __TEST__
#error "This libflash backend must be compiled with skiboot"
#endif
+#endif
/* Same technique as BUILD_BUG_ON from linux */
#define CHECK_HANDLER_SIZE(handlers) ((void)sizeof(char[1 - 2*!!(ARRAY_SIZE(handlers) != (MBOX_COMMAND_COUNT + 1))]))
OpenPOWER on IntegriCloud