From a36bed395f014aa69f08ae6dadb6f9684e448275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Wed, 20 Jan 2021 15:23:40 -0800 Subject: add SKIP_IF_XDP_NOT_SUPPORTED macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test: builds, atest, TreeHugger Signed-off-by: Maciej Żenczykowski Change-Id: Ia954983565250faff547e81a53ec0df5fc26827e --- libbpf_android/include/bpf/BpfUtils.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libbpf_android/include/bpf/BpfUtils.h b/libbpf_android/include/bpf/BpfUtils.h index bb097bf..e67f664 100644 --- a/libbpf_android/include/bpf/BpfUtils.h +++ b/libbpf_android/include/bpf/BpfUtils.h @@ -57,6 +57,15 @@ static inline bool isAtLeastKernelVersion(unsigned major, unsigned minor, unsign } \ } while (0) +#define SKIP_IF_XDP_NOT_SUPPORTED \ + do { \ + if (!android::bpf::isAtLeastKernelVersion(5, 9, 0)) { \ + GTEST_LOG_(INFO) << "This test is skipped since xdp" \ + << "not supported\n"; \ + return; \ + } \ + } while (0) + } // namespace bpf } // namespace android -- cgit v1.2.3