From 2f5a7f1d13df94b753794b69cc4c920f8bfb2128 Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Mon, 11 Jan 2016 11:54:48 +0100 Subject: tools: Add clean targets for tools directory Adding missing clean targets for following tools directories: lib/bpf lib/subcmd build This are now cleaned via 'make -C tools clean' command. Reported-and-Tested-by: Arnaldo Carvalho de Melo Signed-off-by: Jiri Olsa Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Wang Nan Link: http://lkml.kernel.org/r/1452509693-13452-2-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/Makefile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/Makefile b/tools/Makefile index 0ba0df3..4e8e107 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -127,6 +127,12 @@ liblockdep_clean: libapi_clean: $(call descend,lib/api,clean) +libbpf_clean: + $(call descend,lib/bpf,clean) + +libsubcmd_clean: + $(call descend,lib/subcmd,clean) + perf_clean: $(call descend,$(@:_clean=),clean) @@ -142,9 +148,12 @@ tmon_clean: freefall_clean: $(call descend,laptop/freefall,clean) +build_clean: + $(call descend,build,clean) + clean: acpi_clean cgroup_clean cpupower_clean hv_clean firewire_clean lguest_clean \ perf_clean selftests_clean turbostat_clean usb_clean virtio_clean \ vm_clean net_clean iio_clean x86_energy_perf_policy_clean tmon_clean \ - freefall_clean + freefall_clean build_clean libbpf_clean libsubcmd_clean liblockdep_clean .PHONY: FORCE -- cgit v1.1 From 22992a320807f8eb04b48407715aacbdedb00941 Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Mon, 11 Jan 2016 11:54:49 +0100 Subject: tools bpf: Add *.cmd files clean up Add *.cmd files to be removed within clean target. Reported-and-Tested-by: Arnaldo Carvalho de Melo Signed-off-by: Jiri Olsa Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Wang Nan Link: http://lkml.kernel.org/r/1452509693-13452-3-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/lib/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile index 919b717..84e0e98 100644 --- a/tools/lib/bpf/Makefile +++ b/tools/lib/bpf/Makefile @@ -192,7 +192,7 @@ config-clean: $(Q)$(MAKE) -C $(srctree)/tools/build/feature/ clean >/dev/null clean: - $(call QUIET_CLEAN, libbpf) $(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d \ + $(call QUIET_CLEAN, libbpf) $(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd \ $(RM) LIBBPF-CFLAGS $(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf -- cgit v1.1 From 24ee9b57b95fd4d6d0b89a47c3a8f1b145569d18 Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Mon, 11 Jan 2016 11:54:50 +0100 Subject: tools lockdep: Add *.cmd files clean up Add *.cmd files to be removed within clean target. Reported-by: Arnaldo Carvalho de Melo Signed-off-by: Jiri Olsa Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Wang Nan Link: http://lkml.kernel.org/r/1452509693-13452-4-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/lib/lockdep/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/lib/lockdep/Makefile b/tools/lib/lockdep/Makefile index 7e319af..90d2bae 100644 --- a/tools/lib/lockdep/Makefile +++ b/tools/lib/lockdep/Makefile @@ -149,7 +149,7 @@ install_lib: all_cmd install: install_lib clean: - $(RM) *.o *~ $(TARGETS) *.a *liblockdep*.so* $(VERSION_FILES) .*.d + $(RM) *.o *~ $(TARGETS) *.a *liblockdep*.so* $(VERSION_FILES) .*.d .*.cmd $(RM) tags TAGS PHONY += force -- cgit v1.1 From 3238ba01c235e3e9e12fc7bc6ac3f7d513e26a31 Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Mon, 11 Jan 2016 11:54:51 +0100 Subject: perf tools: Add missing sources to perf's MANIFEST Adding missing bitmap.[ch] sources to the MANIFEST file. Fixes building 'make perf-*-src-pkg' generated tarballs. Reported-by: Wang Nan Signed-off-by: Jiri Olsa Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Fixes: 915b0882c310 ("tools lib: Move bitmap.[ch] from tools/perf/ to tools/{lib,include}/") Link: http://lkml.kernel.org/r/1452509693-13452-5-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/MANIFEST | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tools') diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST index ddf922f..2e1fa23 100644 --- a/tools/perf/MANIFEST +++ b/tools/perf/MANIFEST @@ -28,6 +28,7 @@ tools/lib/string.c tools/lib/symbol/kallsyms.c tools/lib/symbol/kallsyms.h tools/lib/find_bit.c +tools/lib/bitmap.c tools/include/asm/atomic.h tools/include/asm/barrier.h tools/include/asm/bug.h @@ -57,6 +58,7 @@ tools/include/linux/rbtree_augmented.h tools/include/linux/string.h tools/include/linux/types.h tools/include/linux/err.h +tools/include/linux/bitmap.h include/asm-generic/bitops/arch_hweight.h include/asm-generic/bitops/const_hweight.h include/asm-generic/bitops/fls64.h -- cgit v1.1 From 11dc0c57ba8a935dec5a3240370941a4380721c4 Mon Sep 17 00:00:00 2001 From: Wang Nan Date: Mon, 11 Jan 2016 13:47:52 +0000 Subject: perf tools: Add -lutil in python lib list for broken python-config On some system the perf-config is broken, causes link failure like this: /usr/lib64/python2.7/config/libpython2.7.a(posixmodule.o): In function `posix_forkpty': /opt/wangnan/yocto-build/tmp-eglibc/work/x86_64-oe-linux/python/2.7.3-r0.3.1/Python-2.7.3/./Modules/posixmodule.c:3816: undefined reference to `forkpty' /usr/lib64/python2.7/config/libpython2.7.a(posixmodule.o): In function `posix_openpty': /opt/wangnan/yocto-build/tmp-eglibc/work/x86_64-oe-linux/python/2.7.3-r0.3.1/Python-2.7.3/./Modules/posixmodule.c:3756: undefined reference to `openpty' collect2: error: ld returned 1 exit status make[1]: *** [/home/wangnan/kernel-hydrogen/tools/perf/out/perf] Error 1 make: *** [all] Error 2 $ python-config --libs -lpthread -ldl -lpthread -lutil -lm -lpython2.7 In this case a '-lutil' should be appended to -lpython2.7. (I know we have --start-group and --end-group. I can see them in command line of collect2 by strace. However it doesn't work. Seems I have a broken environment?) Signed-off-by: Wang Nan Cc: Jiri Olsa Cc: Namhyung Kim Cc: Zefan Li Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1452520124-2073-2-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/config/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index 254d06e..0793c76 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile @@ -493,7 +493,7 @@ else PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) - PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) + PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) -- cgit v1.1 From 3167eea27b27b29d375ee6b34dd83035c04d5da8 Mon Sep 17 00:00:00 2001 From: Wang Nan Date: Mon, 11 Jan 2016 13:47:53 +0000 Subject: perf tools: Fix phony build target for build-test make_kernelsrc and make_kernelsrc_tools are skiped if a previous build-test is done, because 'make build-test' creates two files with same names. To avoid this, they should be included in .PHONY list. Signed-off-by: Wang Nan Acked-by: Jiri Olsa Cc: Namhyung Kim Cc: Zefan Li Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1452520124-2073-3-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/make | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/perf/tests/make b/tools/perf/tests/make index c1fbb8e..130be7c 100644 --- a/tools/perf/tests/make +++ b/tools/perf/tests/make @@ -280,5 +280,5 @@ all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools out: $(run_O) @echo OK -.PHONY: all $(run) $(run_O) tarpkg clean +.PHONY: all $(run) $(run_O) tarpkg clean make_kernelsrc make_kernelsrc_tools endif # ifndef MK -- cgit v1.1 From 8f9e05fb298f16c0cda2e7e78b603331a79f9c10 Mon Sep 17 00:00:00 2001 From: Wang Nan Date: Mon, 11 Jan 2016 13:47:57 +0000 Subject: perf tools: Fix PowerPC native building Checks BPF syscall number, turn off libbpf building on platform doesn't correctly support sys_bpf instead of blocking compiling. Reported-and-Tested-by: Naveen N. Rao Signed-off-by: Wang Nan Acked-by: Jiri Olsa Cc: Sukadev Bhattiprolu Cc: Zefan Li Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1452520124-2073-7-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/build/feature/test-bpf.c | 20 +++++++++++++++++++- tools/lib/bpf/bpf.c | 4 ++-- 2 files changed, 21 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/build/feature/test-bpf.c b/tools/build/feature/test-bpf.c index 062bac8..b389026 100644 --- a/tools/build/feature/test-bpf.c +++ b/tools/build/feature/test-bpf.c @@ -1,9 +1,23 @@ +#include #include +#include + +#ifndef __NR_bpf +# if defined(__i386__) +# define __NR_bpf 357 +# elif defined(__x86_64__) +# define __NR_bpf 321 +# elif defined(__aarch64__) +# define __NR_bpf 280 +# error __NR_bpf not defined. libbpf does not support your arch. +# endif +#endif int main(void) { union bpf_attr attr; + /* Check fields in attr */ attr.prog_type = BPF_PROG_TYPE_KPROBE; attr.insn_cnt = 0; attr.insns = 0; @@ -14,5 +28,9 @@ int main(void) attr.kern_version = 0; attr = attr; - return 0; + /* + * Test existence of __NR_bpf and BPF_PROG_LOAD. + * This call should fail if we run the testcase. + */ + return syscall(__NR_bpf, BPF_PROG_LOAD, attr, sizeof(attr)); } diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c index 5bdc6ea..1f91cc9 100644 --- a/tools/lib/bpf/bpf.c +++ b/tools/lib/bpf/bpf.c @@ -14,8 +14,8 @@ #include "bpf.h" /* - * When building perf, unistd.h is override. Define __NR_bpf is - * required to be defined. + * When building perf, unistd.h is overrided. __NR_bpf is + * required to be defined explicitly. */ #ifndef __NR_bpf # if defined(__i386__) -- cgit v1.1 From 935e6bd310f20d3371ae6bd6f01dd3430a4123b6 Mon Sep 17 00:00:00 2001 From: Wang Nan Date: Mon, 11 Jan 2016 13:47:58 +0000 Subject: tools: Move Makefile.arch from perf/config to tools/scripts After this patch other directories can use this architecture detector without directly including it from perf's directory. Libbpf would utilize it to get proper $(ARCH) so it can receive correct uapi include directory. Tested-by: Naveen N. Rao Acked-by: Jiri Olsa Cc: Sukadev Bhattiprolu Cc: Zefan Li Cc: pi3orama@163.com Signed-off-by: Wang Nan Link: http://lkml.kernel.org/r/1452520124-2073-8-git-send-email-wangnan0@huawei.com [ Add missing srctree definition in tests/make ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/config/Makefile | 2 +- tools/perf/config/Makefile.arch | 18 ------------------ tools/perf/tests/make | 16 +++++++++++++++- tools/scripts/Makefile.arch | 18 ++++++++++++++++++ 4 files changed, 34 insertions(+), 20 deletions(-) delete mode 100644 tools/perf/config/Makefile.arch create mode 100644 tools/scripts/Makefile.arch (limited to 'tools') diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index 0793c76..7545ba60 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile @@ -17,7 +17,7 @@ detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected) CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS) -include $(src-perf)/config/Makefile.arch +include $(srctree)/tools/scripts/Makefile.arch $(call detected_var,ARCH) diff --git a/tools/perf/config/Makefile.arch b/tools/perf/config/Makefile.arch deleted file mode 100644 index e11fbd6..0000000 --- a/tools/perf/config/Makefile.arch +++ /dev/null @@ -1,18 +0,0 @@ -ifndef ARCH -ARCH := $(shell uname -m 2>/dev/null || echo not) -endif - -ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/ \ - -e s/sun4u/sparc/ -e s/sparc64/sparc/ \ - -e /arm64/!s/arm.*/arm/ -e s/sa110/arm/ \ - -e s/s390x/s390/ -e s/parisc64/parisc/ \ - -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ - -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \ - -e s/tile.*/tile/ ) - -LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1) -ifeq ($(LP64), 1) - IS_64_BIT := 1 -else - IS_64_BIT := 0 -endif diff --git a/tools/perf/tests/make b/tools/perf/tests/make index 130be7c..df38dec 100644 --- a/tools/perf/tests/make +++ b/tools/perf/tests/make @@ -1,3 +1,5 @@ +include ../scripts/Makefile.include + ifndef MK ifeq ($(MAKECMDGOALS),) # no target specified, trigger the whole suite @@ -12,7 +14,19 @@ endif else PERF := . -include config/Makefile.arch +# As per kernel Makefile, avoid funny character set dependencies +unexport LC_ALL +LC_COLLATE=C +LC_NUMERIC=C +export LC_COLLATE LC_NUMERIC + +ifeq ($(srctree),) +srctree := $(patsubst %/,%,$(dir $(shell pwd))) +srctree := $(patsubst %/,%,$(dir $(srctree))) +#$(info Determined 'srctree' to be $(srctree)) +endif + +include $(srctree)/tools/scripts/Makefile.arch # FIXME looks like x86 is the only arch running tests ;-) # we need some IS_(32/64) flag to make this generic diff --git a/tools/scripts/Makefile.arch b/tools/scripts/Makefile.arch new file mode 100644 index 0000000..e11fbd6 --- /dev/null +++ b/tools/scripts/Makefile.arch @@ -0,0 +1,18 @@ +ifndef ARCH +ARCH := $(shell uname -m 2>/dev/null || echo not) +endif + +ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/ \ + -e s/sun4u/sparc/ -e s/sparc64/sparc/ \ + -e /arm64/!s/arm.*/arm/ -e s/sa110/arm/ \ + -e s/s390x/s390/ -e s/parisc64/parisc/ \ + -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ + -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \ + -e s/tile.*/tile/ ) + +LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1) +ifeq ($(LP64), 1) + IS_64_BIT := 1 +else + IS_64_BIT := 0 +endif -- cgit v1.1 From d5ef3140351450d240f864208317f5665e7bbd1c Mon Sep 17 00:00:00 2001 From: "Naveen N. Rao" Date: Mon, 11 Jan 2016 13:48:00 +0000 Subject: perf bpf: Fix build breakage due to libbpf perf build is currently (v4.4-rc5) broken on powerpc: bpf.c:28:4: error: #error __NR_bpf not defined. libbpf does not support your arch. # error __NR_bpf not defined. libbpf does not support your arch. ^ Fix this by including tools/scripts/Makefile.arch for the proper $ARCH macro. While at it, remove redundant LP64 macro definition. Also, since libbpf require $(srctree) now, detect the path of srctree like perf. Signed-off-by: Naveen N. Rao Acked-by: Jiri Olsa Cc: Sukadev Bhattiprolu Cc: Wang Nan Cc: Zefan Li Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1452520124-2073-10-git-send-email-wangnan0@huawei.com [Use tools/scripts/Makefile.arch] Signed-off-by: Wang Nan Signed-off-by: Arnaldo Carvalho de Melo --- tools/lib/bpf/Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'tools') diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile index 84e0e98..fc1bc75 100644 --- a/tools/lib/bpf/Makefile +++ b/tools/lib/bpf/Makefile @@ -6,6 +6,12 @@ BPF_EXTRAVERSION = 1 MAKEFLAGS += --no-print-directory +ifeq ($(srctree),) +srctree := $(patsubst %/,%,$(dir $(shell pwd))) +srctree := $(patsubst %/,%,$(dir $(srctree))) +srctree := $(patsubst %/,%,$(dir $(srctree))) +#$(info Determined 'srctree' to be $(srctree)) +endif # Makefiles suck: This macro sets a default value of $(2) for the # variable named by $(1), unless the variable has been set by @@ -31,7 +37,8 @@ INSTALL = install DESTDIR ?= DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))' -LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1) +include $(srctree)/tools/scripts/Makefile.arch + ifeq ($(LP64), 1) libdir_relative = lib64 else @@ -57,13 +64,6 @@ ifndef VERBOSE VERBOSE = 0 endif -ifeq ($(srctree),) -srctree := $(patsubst %/,%,$(dir $(shell pwd))) -srctree := $(patsubst %/,%,$(dir $(srctree))) -srctree := $(patsubst %/,%,$(dir $(srctree))) -#$(info Determined 'srctree' to be $(srctree)) -endif - FEATURE_USER = .libbpf FEATURE_TESTS = libelf libelf-getphdrnum libelf-mmap bpf FEATURE_DISPLAY = libelf bpf -- cgit v1.1 From 0c4d40d580752dd7d639208782f71e317b16be67 Mon Sep 17 00:00:00 2001 From: Wang Nan Date: Mon, 11 Jan 2016 13:48:01 +0000 Subject: tools build: Add BPF feature check to test-all The test-all.c file doesn't check BPF related features. For an environment with all other features enabled, BPF would be considered enabled without doing real feature check. This patch adds test-bpf.c into test-all.c. Signed-off-by: Wang Nan Acked-by: Jiri Olsa Cc: Namhyung Kim Cc: Zefan Li Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1452520124-2073-11-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/build/feature/test-all.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tools') diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c index 33cf6f2..81025ca 100644 --- a/tools/build/feature/test-all.c +++ b/tools/build/feature/test-all.c @@ -125,6 +125,10 @@ # include "test-get_cpuid.c" #undef main +#define main main_test_bpf +# include "test-bpf.c" +#undef main + int main(int argc, char *argv[]) { main_test_libpython(); @@ -153,6 +157,7 @@ int main(int argc, char *argv[]) main_test_pthread_attr_setaffinity_np(); main_test_lzma(); main_test_get_cpuid(); + main_test_bpf(); return 0; } -- cgit v1.1 From 71b3ee7e65ffb48135d875d9c36e3183b9ecffeb Mon Sep 17 00:00:00 2001 From: Wang Nan Date: Mon, 11 Jan 2016 13:48:02 +0000 Subject: perf test: Fix false TEST_OK result for 'perf test hist' Commit 71d6de64fedd ("perf test: Fix hist testcases when kptr_restrict is on") solves a double free problem when 'perf test hist' calling setup_fake_machine(). However, the result is still incorrect. For example: $ ./perf test -v 'filtering hist entries' 25: Test filtering hist entries : --- start --- test child forked, pid 4186 Cannot create kernel maps test child finished with 0 ---- end ---- Test filtering hist entries: Ok In this case the body of this test is not get executed at all, but the result is 'Ok'. Actually, in setup_fake_machine() there's no need to create real kernel maps. What we want are the fake maps. This patch removes the machine__create_kernel_maps() in setup_fake_machine(), so it won't be affected by kptr_restrict setting. Test result: $ cat /proc/sys/kernel/kptr_restrict 1 $ ~/perf test -v hist 15: Test matching and linking multiple hists : --- start --- test child forked, pid 24031 test child finished with 0 ---- end ---- Test matching and linking multiple hists: Ok [SNIP] Suggested-and-Acked-by: Namhyung Kim Signed-off-by: Wang Nan Tested-by: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Zefan Li Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1452520124-2073-12-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/hists_common.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'tools') diff --git a/tools/perf/tests/hists_common.c b/tools/perf/tests/hists_common.c index bcfd081..071a8b5 100644 --- a/tools/perf/tests/hists_common.c +++ b/tools/perf/tests/hists_common.c @@ -87,11 +87,6 @@ struct machine *setup_fake_machine(struct machines *machines) return NULL; } - if (machine__create_kernel_maps(machine)) { - pr_debug("Cannot create kernel maps\n"); - return NULL; - } - for (i = 0; i < ARRAY_SIZE(fake_threads); i++) { struct thread *thread; -- cgit v1.1 From b0500c169b4069e40f03391c7280cd6eaf849e49 Mon Sep 17 00:00:00 2001 From: Wang Nan Date: Mon, 11 Jan 2016 13:48:03 +0000 Subject: perf test: Reset err after using it hold errcode in hist testcases All hists test cases forget to reset err after using it to hold an error code. If error occure in setup_fake_machine() it incorrectly return TEST_OK. This patch fixes it. Suggested-and-Acked-by: Namhyung Kim Signed-off-by: Wang Nan Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Zefan Li Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1452520124-2073-13-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/hists_cumulate.c | 1 + tools/perf/tests/hists_filter.c | 1 + tools/perf/tests/hists_link.c | 1 + tools/perf/tests/hists_output.c | 1 + 4 files changed, 4 insertions(+) (limited to 'tools') diff --git a/tools/perf/tests/hists_cumulate.c b/tools/perf/tests/hists_cumulate.c index e360892..5e6a86e 100644 --- a/tools/perf/tests/hists_cumulate.c +++ b/tools/perf/tests/hists_cumulate.c @@ -706,6 +706,7 @@ int test__hists_cumulate(int subtest __maybe_unused) err = parse_events(evlist, "cpu-clock", NULL); if (err) goto out; + err = TEST_FAIL; machines__init(&machines); diff --git a/tools/perf/tests/hists_filter.c b/tools/perf/tests/hists_filter.c index 2a784be..351a424 100644 --- a/tools/perf/tests/hists_filter.c +++ b/tools/perf/tests/hists_filter.c @@ -120,6 +120,7 @@ int test__hists_filter(int subtest __maybe_unused) err = parse_events(evlist, "task-clock", NULL); if (err) goto out; + err = TEST_FAIL; /* default sort order (comm,dso,sym) will be used */ if (setup_sorting(NULL) < 0) diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c index c764d69..64b257d 100644 --- a/tools/perf/tests/hists_link.c +++ b/tools/perf/tests/hists_link.c @@ -293,6 +293,7 @@ int test__hists_link(int subtest __maybe_unused) if (err) goto out; + err = TEST_FAIL; /* default sort order (comm,dso,sym) will be used */ if (setup_sorting(NULL) < 0) goto out; diff --git a/tools/perf/tests/hists_output.c b/tools/perf/tests/hists_output.c index ebe6cd4..b231265 100644 --- a/tools/perf/tests/hists_output.c +++ b/tools/perf/tests/hists_output.c @@ -597,6 +597,7 @@ int test__hists_output(int subtest __maybe_unused) err = parse_events(evlist, "cpu-clock", NULL); if (err) goto out; + err = TEST_FAIL; machines__init(&machines); -- cgit v1.1