aboutsummaryrefslogtreecommitdiffstats
path: root/tools/build
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2018-11-19 14:56:22 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-11-19 15:12:17 -0500
commit8feb8efef97a134933620071e0b6384cb3238b4e (patch)
tree1b7f3c18e7c8c17292fe84a8b4843fe14a651e97 /tools/build
parentfb50c09e923870a358d68b0d58891bd145b8d7c7 (diff)
tools build feature: Check if get_current_dir_name() is available
As the namespace support code will use this, which is not available in some non _GNU_SOURCE libraries such as Android's bionic used in my container build tests (r12b and r15c at the moment). 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: https://lkml.kernel.org/n/tip-x56ypm940pwclwu45d7jfj47@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/build')
-rw-r--r--tools/build/Makefile.feature1
-rw-r--r--tools/build/feature/Makefile4
-rw-r--r--tools/build/feature/test-all.c5
-rw-r--r--tools/build/feature/test-get_current_dir_name.c10
4 files changed, 20 insertions, 0 deletions
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index f216b2f5c3d7..d74bb9414d7c 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -33,6 +33,7 @@ FEATURE_TESTS_BASIC := \
33 dwarf_getlocations \ 33 dwarf_getlocations \
34 fortify-source \ 34 fortify-source \
35 sync-compare-and-swap \ 35 sync-compare-and-swap \
36 get_current_dir_name \
36 glibc \ 37 glibc \
37 gtk2 \ 38 gtk2 \
38 gtk2-infobar \ 39 gtk2-infobar \
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 0516259be70f..304b984f11b9 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -7,6 +7,7 @@ FILES= \
7 test-dwarf_getlocations.bin \ 7 test-dwarf_getlocations.bin \
8 test-fortify-source.bin \ 8 test-fortify-source.bin \
9 test-sync-compare-and-swap.bin \ 9 test-sync-compare-and-swap.bin \
10 test-get_current_dir_name.bin \
10 test-glibc.bin \ 11 test-glibc.bin \
11 test-gtk2.bin \ 12 test-gtk2.bin \
12 test-gtk2-infobar.bin \ 13 test-gtk2-infobar.bin \
@@ -101,6 +102,9 @@ $(OUTPUT)test-bionic.bin:
101$(OUTPUT)test-libelf.bin: 102$(OUTPUT)test-libelf.bin:
102 $(BUILD) -lelf 103 $(BUILD) -lelf
103 104
105$(OUTPUT)test-get_current_dir_name.bin:
106 $(BUILD)
107
104$(OUTPUT)test-glibc.bin: 108$(OUTPUT)test-glibc.bin:
105 $(BUILD) 109 $(BUILD)
106 110
diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
index 8dc20a61341f..56722bfe6bdd 100644
--- a/tools/build/feature/test-all.c
+++ b/tools/build/feature/test-all.c
@@ -34,6 +34,10 @@
34# include "test-libelf-mmap.c" 34# include "test-libelf-mmap.c"
35#undef main 35#undef main
36 36
37#define main main_test_get_current_dir_name
38# include "test-get_current_dir_name.c"
39#undef main
40
37#define main main_test_glibc 41#define main main_test_glibc
38# include "test-glibc.c" 42# include "test-glibc.c"
39#undef main 43#undef main
@@ -174,6 +178,7 @@ int main(int argc, char *argv[])
174 main_test_hello(); 178 main_test_hello();
175 main_test_libelf(); 179 main_test_libelf();
176 main_test_libelf_mmap(); 180 main_test_libelf_mmap();
181 main_test_get_current_dir_name();
177 main_test_glibc(); 182 main_test_glibc();
178 main_test_dwarf(); 183 main_test_dwarf();
179 main_test_dwarf_getlocations(); 184 main_test_dwarf_getlocations();
diff --git a/tools/build/feature/test-get_current_dir_name.c b/tools/build/feature/test-get_current_dir_name.c
new file mode 100644
index 000000000000..573000f93212
--- /dev/null
+++ b/tools/build/feature/test-get_current_dir_name.c
@@ -0,0 +1,10 @@
1// SPDX-License-Identifier: GPL-2.0
2#define _GNU_SOURCE
3#include <unistd.h>
4#include <stdlib.h>
5
6int main(void)
7{
8 free(get_current_dir_name());
9 return 0;
10}