aboutsummaryrefslogtreecommitdiffstats
path: root/tools/build
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2017-07-18 16:15:29 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2017-07-18 22:14:08 -0400
commit86bcdb5a43997bb02ba25a76482c7bfc652ba45b (patch)
tree60737d10e15be7e8dbff4d7da4ba1f80f72ea5e0 /tools/build
parent59291f19824200b5a9046b79d37f02fb415335b0 (diff)
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: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/build')
-rw-r--r--tools/build/Makefile.feature3
-rw-r--r--tools/build/feature/Makefile6
-rw-r--r--tools/build/feature/test-all.c5
-rw-r--r--tools/build/feature/test-setns.c7
4 files changed, 19 insertions, 2 deletions
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index 523911f316ce..c71a05b9c984 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -64,7 +64,8 @@ FEATURE_TESTS_BASIC := \
64 get_cpuid \ 64 get_cpuid \
65 bpf \ 65 bpf \
66 sched_getcpu \ 66 sched_getcpu \
67 sdt 67 sdt \
68 setns
68 69
69# FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list 70# FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
70# of all feature tests 71# of all feature tests
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index e35e4e5ad192..ee2546ddf028 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -49,7 +49,8 @@ FILES= \
49 test-sdt.bin \ 49 test-sdt.bin \
50 test-cxx.bin \ 50 test-cxx.bin \
51 test-jvmti.bin \ 51 test-jvmti.bin \
52 test-sched_getcpu.bin 52 test-sched_getcpu.bin \
53 test-setns.bin
53 54
54FILES := $(addprefix $(OUTPUT),$(FILES)) 55FILES := $(addprefix $(OUTPUT),$(FILES))
55 56
@@ -95,6 +96,9 @@ $(OUTPUT)test-glibc.bin:
95$(OUTPUT)test-sched_getcpu.bin: 96$(OUTPUT)test-sched_getcpu.bin:
96 $(BUILD) 97 $(BUILD)
97 98
99$(OUTPUT)test-setns.bin:
100 $(BUILD)
101
98DWARFLIBS := -ldw 102DWARFLIBS := -ldw
99ifeq ($(findstring -static,${LDFLAGS}),-static) 103ifeq ($(findstring -static,${LDFLAGS}),-static)
100DWARFLIBS += -lelf -lebl -lz -llzma -lbz2 104DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
index cc6c7c01f4ca..b5cfc6445771 100644
--- a/tools/build/feature/test-all.c
+++ b/tools/build/feature/test-all.c
@@ -153,6 +153,10 @@
153# include "test-sdt.c" 153# include "test-sdt.c"
154#undef main 154#undef main
155 155
156#define main main_test_setns
157# include "test-setns.c"
158#undef main
159
156int main(int argc, char *argv[]) 160int main(int argc, char *argv[])
157{ 161{
158 main_test_libpython(); 162 main_test_libpython();
@@ -188,6 +192,7 @@ int main(int argc, char *argv[])
188 main_test_libcrypto(); 192 main_test_libcrypto();
189 main_test_sched_getcpu(); 193 main_test_sched_getcpu();
190 main_test_sdt(); 194 main_test_sdt();
195 main_test_setns();
191 196
192 return 0; 197 return 0;
193} 198}
diff --git a/tools/build/feature/test-setns.c b/tools/build/feature/test-setns.c
new file mode 100644
index 000000000000..1f714d2a658b
--- /dev/null
+++ b/tools/build/feature/test-setns.c
@@ -0,0 +1,7 @@
1#define _GNU_SOURCE
2#include <sched.h>
3
4int main(void)
5{
6 return setns(0, 0);
7}