Commit 38219f24 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

perf tests: Skip the llvm and bpf tests if HAVE_LIBBPF_SUPPORT isn't defined



If either NO_LIBBPF=1 is passed, explicitely disabling it or if libbpf
is not available due to some missing dependency, skip its tests, telling
the user the feature isn't available.

  # perf test
  <SNIP>
  40: LLVM search and compile                                         : Skip (not compiled in)
  41: Session topology                                                : Ok
  42: BPF filter                                                      : Skip (not compiled in)
  <SNIP>

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent c18cf78d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -9,12 +9,10 @@
#include <util/util.h>
#include <util/bpf-loader.h>
#include <util/evlist.h>
#include <linux/bpf.h>
#include <linux/filter.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <api/fs/fs.h>
#include <bpf/bpf.h>
#include <perf/mmap.h>
#include "tests.h"
#include "llvm.h"
@@ -25,6 +23,8 @@
#define PERF_TEST_BPF_PATH "/sys/fs/bpf/perf_test"

#ifdef HAVE_LIBBPF_SUPPORT
#include <linux/bpf.h>
#include <bpf/bpf.h>

static int epoll_pwait_loop(void)
{
+19 −11
Original line number Diff line number Diff line
@@ -2,13 +2,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <bpf/libbpf.h>
#include <util/llvm-utils.h>
#include "llvm.h"
#include "tests.h"
#include "debug.h"

#ifdef HAVE_LIBBPF_SUPPORT
#include <bpf/libbpf.h>
#include <util/llvm-utils.h>
#include "llvm.h"
static int test__bpf_parsing(void *obj_buf, size_t obj_buf_sz)
{
	struct bpf_object *obj;
@@ -19,14 +19,6 @@ static int test__bpf_parsing(void *obj_buf, size_t obj_buf_sz)
	bpf_object__close(obj);
	return TEST_OK;
}
#else
static int test__bpf_parsing(void *obj_buf __maybe_unused,
			     size_t obj_buf_sz __maybe_unused)
{
	pr_debug("Skip bpf parsing\n");
	return TEST_OK;
}
#endif

static struct {
	const char *source;
@@ -170,3 +162,19 @@ const char *test__llvm_subtest_get_desc(int subtest)

	return bpf_source_table[subtest].desc;
}
#else //HAVE_LIBBPF_SUPPORT
int test__llvm(struct test *test __maybe_unused, int subtest __maybe_unused)
{
	return TEST_SKIP;
}

int test__llvm_subtest_get_nr(void)
{
	return 0;
}

const char *test__llvm_subtest_get_desc(int subtest __maybe_unused)
{
	return NULL;
}
#endif // HAVE_LIBBPF_SUPPORT