Commit 17283337 authored by Alan Maguire's avatar Alan Maguire Committed by Andrii Nakryiko
Browse files

selftests/bpf: Add ASSERT_STRNEQ() variant for test_progs

parent 920d16af
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -221,6 +221,18 @@ extern int test__join_cgroup(const char *path);
	___ok;								\
})

#define ASSERT_STRNEQ(actual, expected, len, name) ({			\
	static int duration = 0;					\
	const char *___act = actual;					\
	const char *___exp = expected;					\
	int ___len = len;						\
	bool ___ok = strncmp(___act, ___exp, ___len) == 0;		\
	CHECK(!___ok, (name),						\
	      "unexpected %s: actual '%.*s' != expected '%.*s'\n",	\
	      (name), ___len, ___act, ___len, ___exp);			\
	___ok;								\
})

#define ASSERT_OK(res, name) ({						\
	static int duration = 0;					\
	long long ___res = (res);					\