diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-03-02 10:55:49 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-03-03 17:07:19 -0500 |
commit | 120010cb1eea151d38a3e66f5ffc79a0c3110292 (patch) | |
tree | 149786c6b833f4c80e6229b6e9b67b8c2bb980ea /tools/build | |
parent | e3ba76deef23064fc272424b86b506cd80b04fc5 (diff) |
tools build: Add test for sched_getcpu()
Instead of trying to go on adding more ifdef conditions, do a feature
test and define HAVE_SCHED_GETCPU_SUPPORT instead, then use it to
provide the prototype. No need to change the stub, as it is already a
__weak symbol.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-yge89er9g90sc0v6k0a0r5tr@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/build')
-rw-r--r-- | tools/build/Makefile.feature | 1 | ||||
-rw-r--r-- | tools/build/feature/Makefile | 6 | ||||
-rw-r--r-- | tools/build/feature/test-all.c | 5 | ||||
-rw-r--r-- | tools/build/feature/test-sched_getcpu.c | 7 |
4 files changed, 18 insertions, 1 deletions
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature index e3fb5ecbdcb6..523911f316ce 100644 --- a/tools/build/Makefile.feature +++ b/tools/build/Makefile.feature | |||
@@ -63,6 +63,7 @@ FEATURE_TESTS_BASIC := \ | |||
63 | lzma \ | 63 | lzma \ |
64 | get_cpuid \ | 64 | get_cpuid \ |
65 | bpf \ | 65 | bpf \ |
66 | sched_getcpu \ | ||
66 | sdt | 67 | sdt |
67 | 68 | ||
68 | # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list | 69 | # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list |
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index b564a2eea039..ab1e2bbc2e96 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile | |||
@@ -48,7 +48,8 @@ FILES= \ | |||
48 | test-get_cpuid.bin \ | 48 | test-get_cpuid.bin \ |
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 | 53 | ||
53 | FILES := $(addprefix $(OUTPUT),$(FILES)) | 54 | FILES := $(addprefix $(OUTPUT),$(FILES)) |
54 | 55 | ||
@@ -91,6 +92,9 @@ $(OUTPUT)test-libelf.bin: | |||
91 | $(OUTPUT)test-glibc.bin: | 92 | $(OUTPUT)test-glibc.bin: |
92 | $(BUILD) | 93 | $(BUILD) |
93 | 94 | ||
95 | $(OUTPUT)test-sched_getcpu.bin: | ||
96 | $(BUILD) | ||
97 | |||
94 | DWARFLIBS := -ldw | 98 | DWARFLIBS := -ldw |
95 | ifeq ($(findstring -static,${LDFLAGS}),-static) | 99 | ifeq ($(findstring -static,${LDFLAGS}),-static) |
96 | DWARFLIBS += -lelf -lebl -lz -llzma -lbz2 | 100 | DWARFLIBS += -lelf -lebl -lz -llzma -lbz2 |
diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c index 699e43627397..cc6c7c01f4ca 100644 --- a/tools/build/feature/test-all.c +++ b/tools/build/feature/test-all.c | |||
@@ -117,6 +117,10 @@ | |||
117 | # include "test-pthread-attr-setaffinity-np.c" | 117 | # include "test-pthread-attr-setaffinity-np.c" |
118 | #undef main | 118 | #undef main |
119 | 119 | ||
120 | #define main main_test_sched_getcpu | ||
121 | # include "test-sched_getcpu.c" | ||
122 | #undef main | ||
123 | |||
120 | # if 0 | 124 | # if 0 |
121 | /* | 125 | /* |
122 | * Disable libbabeltrace check for test-all, because the requested | 126 | * Disable libbabeltrace check for test-all, because the requested |
@@ -182,6 +186,7 @@ int main(int argc, char *argv[]) | |||
182 | main_test_get_cpuid(); | 186 | main_test_get_cpuid(); |
183 | main_test_bpf(); | 187 | main_test_bpf(); |
184 | main_test_libcrypto(); | 188 | main_test_libcrypto(); |
189 | main_test_sched_getcpu(); | ||
185 | main_test_sdt(); | 190 | main_test_sdt(); |
186 | 191 | ||
187 | return 0; | 192 | return 0; |
diff --git a/tools/build/feature/test-sched_getcpu.c b/tools/build/feature/test-sched_getcpu.c new file mode 100644 index 000000000000..c4a148dd7104 --- /dev/null +++ b/tools/build/feature/test-sched_getcpu.c | |||
@@ -0,0 +1,7 @@ | |||
1 | #define _GNU_SOURCE | ||
2 | #include <sched.h> | ||
3 | |||
4 | int main(void) | ||
5 | { | ||
6 | return sched_getcpu(); | ||
7 | } | ||