This is more convenient for tests which want to terminate cleanly from the
middle of their logic, rather than needing to arrange for execution to return
from test_main().
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
-#include <xtf/types.h>
+#include <xtf/lib.h>
#include <xtf/report.h>
-#include <xtf/console.h>
+#include <xtf/hypercall.h>
enum test_status {
STATUS_RUNNING, /**< Test not yet completed. */
return status != STATUS_RUNNING;
}
+void xtf_exit(void)
+{
+ xtf_report_status();
+ hypercall_shutdown(SHUTDOWN_poweroff);
+ panic("xtf_exit(): hypercall_shutdown(SHUTDOWN_poweroff) returned\n");
+}
+
/*
* Local variables:
* mode: C
test_main();
}
- xtf_report_status();
-
- hypercall_shutdown(SHUTDOWN_poweroff);
- unreachable();
+ /* Report status and exit. */
+ xtf_exit();
}
/*
*/
bool xtf_status_reported(void);
+/**
+ * Exit the test early.
+ *
+ * Reports the current status. Does not return.
+ */
+void __noreturn xtf_exit(void);
+
#endif /* XTF_REPORT_H */
/*