Make mailbox clearing idempotent.
Change-Id: Ib07df13119eee7b4d916688bdb68a0760aedccaa
diff --git a/test/vmapi/primary_with_secondaries/interrupts.c b/test/vmapi/primary_with_secondaries/interrupts.c
index c18c8c9..ad61833 100644
--- a/test/vmapi/primary_with_secondaries/interrupts.c
+++ b/test/vmapi/primary_with_secondaries/interrupts.c
@@ -181,7 +181,6 @@
hf_interrupt_inject(SERVICE_VM0, 0, EXTERNAL_INTERRUPT_ID_C);
run_res = hf_vcpu_run(SERVICE_VM0, 0);
EXPECT_EQ(run_res.code, HF_VCPU_RUN_WAIT_FOR_INTERRUPT);
- EXPECT_EQ(hf_mailbox_clear(), -1);
/*
* Now send a message to the secondary to enable the interrupt ID, and
diff --git a/test/vmapi/primary_with_secondaries/mailbox.c b/test/vmapi/primary_with_secondaries/mailbox.c
index c54cdb4..bd5b588 100644
--- a/test/vmapi/primary_with_secondaries/mailbox.c
+++ b/test/vmapi/primary_with_secondaries/mailbox.c
@@ -61,6 +61,16 @@
}
/**
+ * Clearing an empty mailbox is a noop.
+ */
+TEST(mailbox, clear_empty)
+{
+ EXPECT_EQ(hf_mailbox_clear(), 0);
+ EXPECT_EQ(hf_mailbox_clear(), 0);
+ EXPECT_EQ(hf_mailbox_clear(), 0);
+}
+
+/**
* Send and receive the same message from the echo VM.
*/
TEST(mailbox, echo)