From: Jiri Olsa <jolsa@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Jiri Olsa <jolsa@kernel.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Corey Ashford <cjashfor@linux.vnet.ibm.com>,
David Ahern <david.ahern@oracle.com>,
Ingo Molnar <mingo@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <peterz@infradead.org>
Subject: [PATCH 14/15] tools build: Allow to override feature checks setup
Date: Wed, 11 Mar 2015 09:59:03 +0100 [thread overview]
Message-ID: <1426064344-21737-15-git-send-email-jolsa@kernel.org> (raw)
In-Reply-To: <1426064344-21737-1-git-send-email-jolsa@kernel.org>
Allowing to override configuration variables for feature
checks. Also adding automated test and documentation.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <david.ahern@oracle.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
---
tools/build/Documentation/Feature.txt | 93 +++++++++++++++++++++++++++++++
tools/build/Makefile.feature | 4 +-
tools/build/tests/features/Makefile | 23 ++++++++
tools/build/tests/features/Makefile.test1 | 16 ++++++
tools/build/tests/run.sh | 4 +-
5 files changed, 137 insertions(+), 3 deletions(-)
create mode 100644 tools/build/Documentation/Feature.txt
create mode 100644 tools/build/tests/features/Makefile
create mode 100644 tools/build/tests/features/Makefile.test1
diff --git a/tools/build/Documentation/Feature.txt b/tools/build/Documentation/Feature.txt
new file mode 100644
index 000000000000..0c75419ba803
--- /dev/null
+++ b/tools/build/Documentation/Feature.txt
@@ -0,0 +1,93 @@
+Feature Framework
+=================
+The 'feature' framework provides information for makefiles about
+installed libraries and interfaces in the system.
+
+The 'feature' is represented by its name and simple source located
+in 'tools/build/feature/test-$(name).c' file. The framework builds
+each such source for configured feature and sets $(feature-$(name))
+variable to 0 or 1 if it fails or succeeds to build respectively.
+
+The current usage example of the feature framework is:
+
+--- Makefile.test
+ FEATURE_TESTS := glibc backtrace
+ FEATURE_DISPLAY := glibc
+
+ srctree := ../../../..
+ include $(srctree)/tools/build/Makefile.feature
+
+ ifndef feature-glibc
+ $(error FAILED feature-glibc variable not defined)
+ endif
+
+ ifndef feature-backtrace
+ $(error FAILED feature-backtrace variable not defined)
+ endif
+---
+
+User defines list of features to check in FEATURE_TESTS variable:
+
+ FEATURE_TESTS := glibc backtrace
+
+and list of features she wishes to display in FEATURE_DISPLAY variable:
+
+ FEATURE_DISPLAY := glibc
+
+then user includes Makefile.feature makefile:
+
+ include $(srctree)/tools/build/Makefile.feature
+
+following output is displayed on processing of the makefile:
+
+ $ make -f Makefile.test
+
+ Auto-detecting system features:
+ ... glibc: [ on ]
+
+Plus following variables are defined indicating the
+requested feature status:
+
+ $(feature-glibc)
+ $(feature-backtrace)
+
+Following features are currently available for FEATURE_TESTS:
+
+ backtrace
+ dwarf
+ fortify-source
+ sync-compare-and-swap
+ glibc
+ gtk2
+ gtk2-infobar
+ libaudit
+ libbfd
+ libelf
+ libelf-getphdrnum
+ libelf-mmap
+ libnuma
+ libperl
+ libpython
+ libpython-version
+ libslang
+ libunwind
+ pthread-attr-setaffinity-np
+ stackprotector-all
+ timerfd
+ libdw-dwarf-unwind
+ libbabeltrace
+ zlib
+
+It's also possible to pass options for checks compilation and linking
+by using following variables:
+
+ FEATURE_CHECK_CFLAGS-$(name)
+ FEATURE_CHECK_LDFLAGS-$(name)
+
+where $(anem) represents feature name from above list.
+
+For example following settings will provide options for 'libunwind'
+feature compilation and linking:
+
+ FEATURE_CHECK_CFLAGS-libunwind = $(LIBUNWIND_CFLAGS)
+ FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS)
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index 7e534e1318aa..4abaf5f09617 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -27,7 +27,7 @@ endef
# the rule that uses them - an example for that is the 'bionic'
# feature check. ]
#
-FEATURE_TESTS = \
+FEATURE_TESTS ?= \
backtrace \
dwarf \
fortify-source \
@@ -52,7 +52,7 @@ FEATURE_TESTS = \
libdw-dwarf-unwind \
zlib
-FEATURE_DISPLAY = \
+FEATURE_DISPLAY ?= \
dwarf \
glibc \
gtk2 \
diff --git a/tools/build/tests/features/Makefile b/tools/build/tests/features/Makefile
new file mode 100644
index 000000000000..cb94dda32534
--- /dev/null
+++ b/tools/build/tests/features/Makefile
@@ -0,0 +1,23 @@
+all: test1
+
+test1:
+ rm -f FEATURE-DUMP
+ make -f Makefile.test1 > out
+ # we should get one line with 'glibc' feature status
+ features=`grep -cF ... out`; \
+ if [ "$$features" != "1" ]; then echo FAILED; exit 1; fi
+ # we should NOT get any feature status line on second run
+ make -f Makefile.test1 > out
+ features=`grep -cF ... out`; \
+ if [ "$$features" == "1" ]; then echo FAILED; exit 1; fi
+ # we should get both 'glibc' and 'backtrace' status lines now
+ make -f Makefile.test1 VF=1 > out
+ features=`grep -cF ... out`; \
+ if [ "$$features" != "2" ]; then echo FAILED; exit 1; fi
+ # and fresh start without FEATURE-DUMP, expecting 'glibc' status line
+ rm -f FEATURE-DUMP
+ make -f Makefile.test1 > out
+ features=`grep -cF ... out`; \
+ if [ "$$features" != "1" ]; then echo FAILED; exit 1; fi
+ # cleanup
+ rm -f FEATURE-DUMP out
diff --git a/tools/build/tests/features/Makefile.test1 b/tools/build/tests/features/Makefile.test1
new file mode 100644
index 000000000000..101b78f777c1
--- /dev/null
+++ b/tools/build/tests/features/Makefile.test1
@@ -0,0 +1,16 @@
+
+FEATURE_TESTS := glibc backtrace
+FEATURE_DISPLAY := glibc
+
+srctree := ../../../..
+include $(srctree)/tools/build/Makefile.feature
+
+ifndef feature-glibc
+ $(error FAILED feature-glibc variable not defined)
+endif
+
+ifndef feature-backtrace
+ $(error FAILED feature-backtrace variable not defined)
+endif
+
+all:
diff --git a/tools/build/tests/run.sh b/tools/build/tests/run.sh
index 5494f8ea7567..bd6dc8ee1830 100755
--- a/tools/build/tests/run.sh
+++ b/tools/build/tests/run.sh
@@ -39,4 +39,6 @@ echo -n Testing..
test_ex
test_ex_suffix
-echo OK
+cd features && make -s -f Makefile
+
+if [ $? -eq 0 ]; then echo OK; fi
--
1.9.3
next prev parent reply other threads:[~2015-03-11 9:00 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-11 8:58 [PATCHv2 00/15] tools build: Move features framework into tools/build Jiri Olsa
2015-03-11 8:58 ` [PATCH 01/15] perf build: Disable default check for libbabeltrace Jiri Olsa
2015-03-13 15:36 ` Arnaldo Carvalho de Melo
2015-03-13 16:20 ` Jiri Olsa
2015-03-13 20:19 ` Arnaldo Carvalho de Melo
2015-03-15 17:32 ` Jiri Olsa
2015-03-11 8:58 ` [PATCH 02/15] perf build: Add dump of features build Jiri Olsa
2015-03-11 8:58 ` [PATCH 03/15] perf build: Fix pthread-attr-setaffinity-np include in test-all Jiri Olsa
2015-03-11 8:58 ` [PATCH 04/15] perf build: Get rid of LIB_INCLUDE variable Jiri Olsa
2015-03-11 8:58 ` [PATCH 05/15] perf build: Rename CORE_FEATURE_TESTS to FEATURE_TESTS Jiri Olsa
2015-03-11 8:58 ` [PATCH 06/15] perf build: Get rid of VF_FEATURE_TESTS Jiri Olsa
2015-03-11 8:58 ` [PATCH 07/15] perf build: Rename display_lib into feature_display Jiri Olsa
2015-03-11 8:58 ` [PATCH 08/15] perf build: Rename display_vf to feature_verbose Jiri Olsa
2015-03-11 8:58 ` [PATCH 09/15] perf build: Rename PERF-FEATURES into FEATURE-DUMP Jiri Olsa
2015-03-11 8:58 ` [PATCH 10/15] perf build: Rename feature_print_var_code to print_var_code Jiri Olsa
2015-03-11 8:59 ` [PATCH 11/15] perf build: Separate feature make support into config/Makefile.feature Jiri Olsa
2015-03-11 8:59 ` [PATCH 12/15] perf build: Make features checks directory configurable Jiri Olsa
2015-03-11 8:59 ` [PATCH 13/15] tools build: Move feature checks code under tools/build Jiri Olsa
2015-03-11 8:59 ` Jiri Olsa [this message]
2015-03-11 8:59 ` [PATCH 15/15] tools build: Fix feature_check name clash Jiri Olsa
2015-03-18 18:50 ` [PATCHv2 00/15] tools build: Move features framework into tools/build Arnaldo Carvalho de Melo
2015-03-18 18:59 ` Jiri Olsa
2015-03-18 19:53 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1426064344-21737-15-git-send-email-jolsa@kernel.org \
--to=jolsa@kernel.org \
--cc=acme@redhat.com \
--cc=cjashfor@linux.vnet.ibm.com \
--cc=david.ahern@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).