Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 86bcdb5a authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

tools build: Add test for setns()

And provide an alternative implementation to keep perf building on older
distros as we're about to add initial support for namespaces.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Krister Johansen <kjlx@templeofstupid.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-bqdwijunhjlvps1ardykhw1i@git.kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 59291f19
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -64,7 +64,8 @@ FEATURE_TESTS_BASIC := \
        get_cpuid                       \
        get_cpuid                       \
        bpf                             \
        bpf                             \
        sched_getcpu			\
        sched_getcpu			\
        sdt
        sdt				\
        setns


# FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
# FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
# of all feature tests
# of all feature tests
+5 −1
Original line number Original line Diff line number Diff line
@@ -49,7 +49,8 @@ FILES= \
         test-sdt.bin                           \
         test-sdt.bin                           \
         test-cxx.bin                           \
         test-cxx.bin                           \
         test-jvmti.bin				\
         test-jvmti.bin				\
         test-sched_getcpu.bin
         test-sched_getcpu.bin			\
         test-setns.bin


FILES := $(addprefix $(OUTPUT),$(FILES))
FILES := $(addprefix $(OUTPUT),$(FILES))


@@ -95,6 +96,9 @@ $(OUTPUT)test-glibc.bin:
$(OUTPUT)test-sched_getcpu.bin:
$(OUTPUT)test-sched_getcpu.bin:
	$(BUILD)
	$(BUILD)


$(OUTPUT)test-setns.bin:
	$(BUILD)

DWARFLIBS := -ldw
DWARFLIBS := -ldw
ifeq ($(findstring -static,${LDFLAGS}),-static)
ifeq ($(findstring -static,${LDFLAGS}),-static)
DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
+5 −0
Original line number Original line Diff line number Diff line
@@ -153,6 +153,10 @@
# include "test-sdt.c"
# include "test-sdt.c"
#undef main
#undef main


#define main main_test_setns
# include "test-setns.c"
#undef main

int main(int argc, char *argv[])
int main(int argc, char *argv[])
{
{
	main_test_libpython();
	main_test_libpython();
@@ -188,6 +192,7 @@ int main(int argc, char *argv[])
	main_test_libcrypto();
	main_test_libcrypto();
	main_test_sched_getcpu();
	main_test_sched_getcpu();
	main_test_sdt();
	main_test_sdt();
	main_test_setns();


	return 0;
	return 0;
}
}
+7 −0
Original line number Original line Diff line number Diff line
#define _GNU_SOURCE
#include <sched.h>

int main(void)
{
	return setns(0, 0);
}
+5 −0
Original line number Original line Diff line number Diff line
@@ -330,6 +330,11 @@ ifeq ($(feature-sched_getcpu), 1)
  CFLAGS += -DHAVE_SCHED_GETCPU_SUPPORT
  CFLAGS += -DHAVE_SCHED_GETCPU_SUPPORT
endif
endif


ifeq ($(feature-setns), 1)
  CFLAGS += -DHAVE_SETNS_SUPPORT
  $(call detected,CONFIG_SETNS)
endif

ifndef NO_LIBELF
ifndef NO_LIBELF
  CFLAGS += -DHAVE_LIBELF_SUPPORT
  CFLAGS += -DHAVE_LIBELF_SUPPORT
  EXTLIBS += -lelf
  EXTLIBS += -lelf
Loading