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

Commit 120010cb authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent e3ba76de
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ FEATURE_TESTS_BASIC := \
        lzma                            \
        get_cpuid                       \
        bpf                             \
        sched_getcpu			\
        sdt

# FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
+5 −1
Original line number Diff line number Diff line
@@ -48,7 +48,8 @@ FILES= \
         test-get_cpuid.bin                     \
         test-sdt.bin                           \
         test-cxx.bin                           \
         test-jvmti.bin
         test-jvmti.bin				\
         test-sched_getcpu.bin

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

@@ -91,6 +92,9 @@ $(OUTPUT)test-libelf.bin:
$(OUTPUT)test-glibc.bin:
	$(BUILD)

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

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

#define main main_test_sched_getcpu
# include "test-sched_getcpu.c"
#undef main

# if 0
/*
 * Disable libbabeltrace check for test-all, because the requested
@@ -182,6 +186,7 @@ int main(int argc, char *argv[])
	main_test_get_cpuid();
	main_test_bpf();
	main_test_libcrypto();
	main_test_sched_getcpu();
	main_test_sdt();

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

int main(void)
{
	return sched_getcpu();
}
+4 −0
Original line number Diff line number Diff line
@@ -317,6 +317,10 @@ ifdef NO_DWARF
  NO_LIBDW_DWARF_UNWIND := 1
endif

ifeq ($(feature-sched_getcpu), 1)
  CFLAGS += -DHAVE_SCHED_GETCPU_SUPPORT
endif

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