From ef0775fec884256ea733a63bbeb855f169779b56 Mon Sep 17 00:00:00 2001 From: Haitao Li Date: Mon, 16 Jan 2012 19:20:07 +0800 Subject: [PATCH] build: Check and set perf --log-fd option Linux perf tool version 3.2 introduced a new option "--log-fd" defaults to 0, which leads to error "Failed opening logfd: Illegal argument" when executing perf tests. Set logfd to stderr to let perf test work. Issue #1538 --- configure | 10 ++++++++++ mk/platform.mk | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/configure b/configure index e44338a99aa..3563f0b8826 100755 --- a/configure +++ b/configure @@ -363,6 +363,16 @@ then err "either clang or gcc is required" fi +if [ ! -z "$CFG_PERF" ] +then + HAVE_PERF_LOGFD=`$CFG_PERF stat --log-fd 2>&1 | grep 'unknown option'` + if [ -z "$HAVE_PERF_LOGFD" ]; + then + CFG_PERF_WITH_LOGFD=1 + putvar CFG_PERF_WITH_LOGFD + fi +fi + step_msg "making directories" for i in \ diff --git a/mk/platform.mk b/mk/platform.mk index 3d070724abc..0018a3bd8e5 100644 --- a/mk/platform.mk +++ b/mk/platform.mk @@ -58,7 +58,11 @@ ifneq ($(findstring linux,$(CFG_OSTYPE)),) CFG_LDENV := LD_LIBRARY_PATH CFG_DEF_SUFFIX := .linux.def ifdef CFG_PERF - CFG_PERF_TOOL := $(CFG_PERF) stat -r 3 + ifneq ($(CFG_PERF_WITH_LOGFD),) + CFG_PERF_TOOL := $(CFG_PERF) stat -r 3 --log-fd 2 + else + CFG_PERF_TOOL := $(CFG_PERF) stat -r 3 + endif else ifdef CFG_VALGRIND CFG_PERF_TOOL :=\