We can't assume the machine exists and should gracefully skip the test
if we haven't built the model. This is ostensibly fixed by
db2237c459 (tests/qtest: Restrict bcm2835-dma-test to CONFIG_RASPI)
but I still hit it during my tests. Other qtests seem to use this
pattern to gracefully skip stuff.

Signed-off-by: Alex Bennée <alex.ben...@linaro.org>
---
 tests/qtest/bcm2835-dma-test.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tests/qtest/bcm2835-dma-test.c b/tests/qtest/bcm2835-dma-test.c
index 8293d822b9..2e6245e9e2 100644
--- a/tests/qtest/bcm2835-dma-test.c
+++ b/tests/qtest/bcm2835-dma-test.c
@@ -107,12 +107,11 @@ static void bcm2835_dma_test_interrupts(void)
 
 int main(int argc, char **argv)
 {
-    int ret;
     g_test_init(&argc, &argv, NULL);
-    qtest_add_func("/bcm2835/dma/test_interrupts",
+    if (qtest_has_machine("raspi3b")) {
+        qtest_add_func("/bcm2835/dma/test_interrupts",
                    bcm2835_dma_test_interrupts);
-    qtest_start("-machine raspi3b");
-    ret = g_test_run();
-    qtest_end();
-    return ret;
+        qtest_start("-machine raspi3b");
+    }
+    return g_test_run();
 }
-- 
2.39.2


Reply via email to