summaryrefslogtreecommitdiff
path: root/tests/stubs/die.c
blob: 86e5056c5b6cf6c12d76491ce85045511d984f45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* SPDX-License-Identifier: GPL-2.0-only */

#include <stdarg.h>
#include <tests/test.h>

void die(const char *msg, ...)
{
	/* die() can be called in middle a function, so we should not allow for it to return */
	static char msg_buf[256];
	va_list v;
	va_start(v, msg);
	vsnprintf(msg_buf, ARRAY_SIZE(msg_buf), msg, v);
	va_end(v);
	fail_msg("%s", msg_buf);
}