All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [RFC PATCH 0/6] Fix 32-bit cross compilation
@ 2017-10-06  1:53 Petr Vorel
  2017-10-06  1:53 ` [LTP] [RFC PATCH 1/6] m4: Fix libkeyutils detection on 32-bit cross build Petr Vorel
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Petr Vorel @ 2017-10-06  1:53 UTC (permalink / raw)
  To: ltp

Hi,

these patches fixes 32-bit cross compilation build.
I'm not an autotools expert so I tried to minimize changes.
I extended header checks with library checks.

NUMA sources would deserve to rechecks header dependencies. I tried that, but
decided to postpone it.

BTW I have to admit I'd wish we'd just filter out directories without missing
libraries, as we could avoid #if/#ifdef in sources.  But I guess we cannot
afford that as binaries are called from runtime files.

Petr Vorel (6):
  m4: Fix libkeyutils detection on 32-bit cross build
  m4: Fix libacl detection on 32-bit cross build
  m4: Simplify check for linux/can.h header
  m4: Fix libcrypto detection on 32-bit cross build
  make: Remove workarounds for build without libnuma
  m4,kernel/lib: Detect libnuma presence in kernel libs

 configure.ac                                       |  9 ++++----
 m4/ltp-acl.m4                                      |  7 +++---
 m4/ltp-can.m4                                      | 25 ----------------------
 m4/ltp-crypto.m4                                   | 10 +++++----
 m4/ltp-keyutils.m4                                 |  6 +++---
 m4/ltp-numa.m4                                     |  6 +++++-
 .../cpuset_syscall_test/cpuset_syscall_test.c      |  4 ++--
 testcases/kernel/hotplug/memory_hotplug/commands.c |  2 +-
 testcases/kernel/hotplug/memory_hotplug/memtoy.c   |  9 ++++----
 testcases/kernel/hotplug/memory_hotplug/segment.c  |  2 +-
 testcases/kernel/include/numa_helper.h             |  2 +-
 testcases/kernel/lib/numa_helper.c                 | 14 ++++++------
 testcases/kernel/mem/cpuset/cpuset01.c             |  4 ++--
 testcases/kernel/mem/ksm/ksm02.c                   |  4 ++--
 testcases/kernel/mem/ksm/ksm04.c                   |  4 ++--
 testcases/kernel/mem/lib/mem.c                     |  6 +++---
 testcases/kernel/mem/vma/vma02.c                   | 17 ++++++---------
 testcases/kernel/mem/vma/vma04.c                   | 16 +++++---------
 .../integrity/ima/src/ima_boot_aggregate.c         | 13 +++++++----
 .../security/integrity/ima/src/ima_measure.c       | 17 +++++++--------
 .../syscalls/get_mempolicy/get_mempolicy01.c       |  4 ++--
 testcases/kernel/syscalls/mbind/Makefile           |  9 --------
 testcases/kernel/syscalls/mbind/mbind01.c          |  4 ++--
 testcases/kernel/syscalls/migrate_pages/Makefile   |  3 ---
 .../syscalls/migrate_pages/migrate_pages02.c       |  2 +-
 testcases/kernel/syscalls/move_pages/Makefile      |  5 -----
 .../syscalls/move_pages/move_pages_support.c       |  8 +++----
 27 files changed, 84 insertions(+), 128 deletions(-)
 delete mode 100644 m4/ltp-can.m4

-- 
2.14.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LTP] [RFC PATCH 1/6] m4: Fix libkeyutils detection on 32-bit cross build
  2017-10-06  1:53 [LTP] [RFC PATCH 0/6] Fix 32-bit cross compilation Petr Vorel
@ 2017-10-06  1:53 ` Petr Vorel
  2017-10-06  1:53 ` [LTP] [RFC PATCH 2/6] m4: Fix libacl " Petr Vorel
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Petr Vorel @ 2017-10-06  1:53 UTC (permalink / raw)
  To: ltp

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 m4/ltp-keyutils.m4 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/m4/ltp-keyutils.m4 b/m4/ltp-keyutils.m4
index 74b7d3249..1434ca823 100644
--- a/m4/ltp-keyutils.m4
+++ b/m4/ltp-keyutils.m4
@@ -18,7 +18,7 @@ dnl
 dnl LTP_CHECK_KEYUTILS_SUPPORT
 dnl ----------------------------
 dnl
-AC_DEFUN([LTP_CHECK_KEYUTILS_SUPPORT],[
-AC_CHECK_HEADERS([keyutils.h], [keyutils_libs="-lkeyutils"])
-AC_SUBST([KEYUTILS_LIBS], [$keyutils_libs])
+AC_DEFUN([LTP_CHECK_KEYUTILS_SUPPORT], [
+	AC_CHECK_LIB([keyutils], [add_key], [keyutils_libs="-lkeyutils"])
+	AC_SUBST([KEYUTILS_LIBS], [$keyutils_libs])
 ])
-- 
2.14.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [LTP] [RFC PATCH 2/6] m4: Fix libacl detection on 32-bit cross build
  2017-10-06  1:53 [LTP] [RFC PATCH 0/6] Fix 32-bit cross compilation Petr Vorel
  2017-10-06  1:53 ` [LTP] [RFC PATCH 1/6] m4: Fix libkeyutils detection on 32-bit cross build Petr Vorel
@ 2017-10-06  1:53 ` Petr Vorel
  2017-10-06  1:53 ` [LTP] [RFC PATCH 3/6] m4: Simplify check for linux/can.h header Petr Vorel
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Petr Vorel @ 2017-10-06  1:53 UTC (permalink / raw)
  To: ltp

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 m4/ltp-acl.m4 | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/m4/ltp-acl.m4 b/m4/ltp-acl.m4
index 6b739346b..789fabe0b 100644
--- a/m4/ltp-acl.m4
+++ b/m4/ltp-acl.m4
@@ -23,8 +23,7 @@ dnl LTP_CHECK_ACL_SUPPORT
 dnl ----------------------------
 dnl
 AC_DEFUN([LTP_CHECK_ACL_SUPPORT],[
-AH_TEMPLATE(HAVE_LIBACL,
-[Define to 1 if you have libacl installed.])
-AC_CHECK_HEADERS([sys/acl.h], [acl_libs="-lacl"])
-AC_SUBST([ACL_LIBS], [$acl_libs])
+	AH_TEMPLATE(HAVE_LIBACL, [Define to 1 if you have libacl installed.])
+	AC_CHECK_LIB([acl], [acl_init], [acl_libs="-lacl"])
+	AC_SUBST([ACL_LIBS], [$acl_libs])
 ])
-- 
2.14.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [LTP] [RFC PATCH 3/6] m4: Simplify check for linux/can.h header
  2017-10-06  1:53 [LTP] [RFC PATCH 0/6] Fix 32-bit cross compilation Petr Vorel
  2017-10-06  1:53 ` [LTP] [RFC PATCH 1/6] m4: Fix libkeyutils detection on 32-bit cross build Petr Vorel
  2017-10-06  1:53 ` [LTP] [RFC PATCH 2/6] m4: Fix libacl " Petr Vorel
@ 2017-10-06  1:53 ` Petr Vorel
  2017-10-06  1:53 ` [LTP] [RFC PATCH 4/6] m4: Fix libcrypto detection on 32-bit cross build Petr Vorel
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Petr Vorel @ 2017-10-06  1:53 UTC (permalink / raw)
  To: ltp

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 configure.ac  |  2 +-
 m4/ltp-can.m4 | 25 -------------------------
 2 files changed, 1 insertion(+), 26 deletions(-)
 delete mode 100644 m4/ltp-can.m4

diff --git a/configure.ac b/configure.ac
index 458a5b13f..56fc9248e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,6 +36,7 @@ AC_CHECK_HEADERS([ \
     mm.h \
     pthread.h \
     sys/xattr.h \
+    linux/can.h \
     linux/genetlink.h \
     linux/mempolicy.h \
     linux/module.h \
@@ -176,7 +177,6 @@ LTP_CHECK_TEE
 LTP_CHECK_SPLICE
 LTP_CHECK_VMSPLICE
 LTP_CHECK_TIMERFD
-LTP_CHECK_CAN_SUPPORT
 LTP_CHECK_IOVEC
 LTP_CHECK_KEYCTL
 LTP_CHECK_LINUXRANDOM
diff --git a/m4/ltp-can.m4 b/m4/ltp-can.m4
deleted file mode 100644
index af437ef5e..000000000
--- a/m4/ltp-can.m4
+++ /dev/null
@@ -1,25 +0,0 @@
-dnl
-dnl Copyright (c) Linux Test Project, 2014
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
-
-dnl
-dnl LTP_CHECK_CAN_SUPPORT
-dnl ----------------------------
-dnl
-AC_DEFUN([LTP_CHECK_CAN_SUPPORT],[
-AC_CHECK_HEADERS([linux/can.h])
-])
-- 
2.14.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [LTP] [RFC PATCH 4/6] m4: Fix libcrypto detection on 32-bit cross build
  2017-10-06  1:53 [LTP] [RFC PATCH 0/6] Fix 32-bit cross compilation Petr Vorel
                   ` (2 preceding siblings ...)
  2017-10-06  1:53 ` [LTP] [RFC PATCH 3/6] m4: Simplify check for linux/can.h header Petr Vorel
@ 2017-10-06  1:53 ` Petr Vorel
  2017-10-06  1:53 ` [LTP] [RFC PATCH 5/6] make: Remove workarounds for build without libnuma Petr Vorel
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Petr Vorel @ 2017-10-06  1:53 UTC (permalink / raw)
  To: ltp

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 configure.ac                                            |  7 ++++---
 m4/ltp-crypto.m4                                        | 10 ++++++----
 .../security/integrity/ima/src/ima_boot_aggregate.c     | 13 +++++++++----
 .../kernel/security/integrity/ima/src/ima_measure.c     | 17 ++++++++---------
 4 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/configure.ac b/configure.ac
index 56fc9248e..43282cfeb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,14 +33,15 @@ AC_PREFIX_DEFAULT(/opt/ltp)
 AC_CHECK_HEADERS([ \
     ifaddrs.h \
     libaio.h \
-    mm.h \
-    pthread.h \
-    sys/xattr.h \
     linux/can.h \
     linux/genetlink.h \
     linux/mempolicy.h \
     linux/module.h \
     linux/netlink.h \
+    mm.h \
+    openssl/sha.h \
+    pthread.h \
+    sys/xattr.h \
     sys/epoll.h \
     sys/inotify.h \
     sys/fanotify.h \
diff --git a/m4/ltp-crypto.m4 b/m4/ltp-crypto.m4
index 3dfc51266..d066ab7e0 100644
--- a/m4/ltp-crypto.m4
+++ b/m4/ltp-crypto.m4
@@ -2,8 +2,10 @@ dnl
 dnl LTP_CHECK_CRYPTO
 dnl ----------------------------
 dnl
-AC_DEFUN([LTP_CHECK_CRYPTO],
-[dnl
-AC_CHECK_HEADERS(openssl/sha.h,[CRYPTO_LIBS=-lcrypto],[CRYPTO_LIBS=])
-AC_SUBST(CRYPTO_LIBS)
+AC_DEFUN([LTP_CHECK_CRYPTO], [
+	AC_CHECK_LIB([crypto], [SHA1_Init], [crypto_libs="-lcrypto"])
+	AC_SUBST([CRYPTO_LIBS], [$crypto_libs])
+	if test "x$have_libnuma" != "x"; then
+		AC_DEFINE(HAVE_LIBCRYPTO,1,[define whether libcrypto is installed])
+	fi
 ])
diff --git a/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c b/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c
index f67eb684b..9f500553c 100644
--- a/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c
+++ b/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c
@@ -29,6 +29,8 @@
 #include <openssl/sha.h>
 #endif
 
+#if HAVE_LIBCRYPTO && HAVE_OPENSSL_SHA_H
+
 #define MAX_EVENT_SIZE 500
 #define EVENT_HEADER_SIZE 32
 #define MAX_EVENT_DATA_SIZE (MAX_EVENT_SIZE - EVENT_HEADER_SIZE)
@@ -48,7 +50,6 @@ static void display_sha1_digest(unsigned char *pcr)
 
 int main(int argc, char *argv[])
 {
-#if HAVE_OPENSSL_SHA_H
 	unsigned char boot_aggregate[SHA_DIGEST_LENGTH];
 	struct {
 		struct {
@@ -113,8 +114,12 @@ int main(int argc, char *argv[])
 
 	printf("boot_aggregate:");
 	display_sha1_digest(boot_aggregate);
-#else
-	tst_resm(TCONF, "System doesn't have openssl/sha.h");
-#endif
 	tst_exit();
 }
+
+#else
+int main(void)
+{
+	tst_resm(TCONF, "test requires libcrypto and openssl development packages");
+}
+#endif
diff --git a/testcases/kernel/security/integrity/ima/src/ima_measure.c b/testcases/kernel/security/integrity/ima/src/ima_measure.c
index 61851a36a..7c37b7c20 100644
--- a/testcases/kernel/security/integrity/ima/src/ima_measure.c
+++ b/testcases/kernel/security/integrity/ima/src/ima_measure.c
@@ -28,6 +28,7 @@
 #include <openssl/sha.h>
 #endif
 
+#if HAVE_LIBCRYPTO && HAVE_OPENSSL_SHA_H
 #define TCG_EVENT_NAME_LEN_MAX	255
 
 char *TCID = "ima_measure";
@@ -39,8 +40,6 @@ static int verbose;
 	if (verbose) \
 		printf(format, ##arg)
 
-#if HAVE_OPENSSL_SHA_H
-
 static u_int8_t zero[SHA_DIGEST_LENGTH];
 static u_int8_t fox[SHA_DIGEST_LENGTH];
 
@@ -97,8 +96,6 @@ static int verify_template_hash(struct event *template)
 	return 0;
 }
 
-#endif
-
 /*
  * ima_measurements.c - calculate the SHA1 aggregate-pcr value based
  * on the IMA runtime binary measurements.
@@ -131,8 +128,6 @@ static int verify_template_hash(struct event *template)
  */
 int main(int argc, char *argv[])
 {
-
-#if HAVE_OPENSSL_SHA_H
 	FILE *fp;
 	struct event template;
 	u_int8_t pcr[SHA_DIGEST_LENGTH];
@@ -212,8 +207,12 @@ int main(int argc, char *argv[])
 	verbose = 1;
 	print_info("PCRAggr (re-calculated):");
 	display_sha1_digest(pcr);
-#else
-	tst_resm(TCONF, "System doesn't have openssl/sha.h");
-#endif
 	tst_exit();
 }
+
+#else
+int main(void)
+{
+	tst_resm(TCONF, "test requires libcrypto and openssl development packages");
+}
+#endif
-- 
2.14.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [LTP] [RFC PATCH 5/6] make: Remove workarounds for build without libnuma
  2017-10-06  1:53 [LTP] [RFC PATCH 0/6] Fix 32-bit cross compilation Petr Vorel
                   ` (3 preceding siblings ...)
  2017-10-06  1:53 ` [LTP] [RFC PATCH 4/6] m4: Fix libcrypto detection on 32-bit cross build Petr Vorel
@ 2017-10-06  1:53 ` Petr Vorel
  2017-10-06  1:53 ` [LTP] [RFC PATCH 6/6] m4, kernel/lib: Detect libnuma presence in kernel libs Petr Vorel
  2017-10-06 10:02 ` [LTP] [RFC PATCH 0/6] Fix 32-bit cross compilation Richard Palethorpe
  6 siblings, 0 replies; 9+ messages in thread
From: Petr Vorel @ 2017-10-06  1:53 UTC (permalink / raw)
  To: ltp

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/syscalls/mbind/Makefile         | 9 ---------
 testcases/kernel/syscalls/migrate_pages/Makefile | 3 ---
 testcases/kernel/syscalls/move_pages/Makefile    | 5 -----
 3 files changed, 17 deletions(-)

diff --git a/testcases/kernel/syscalls/mbind/Makefile b/testcases/kernel/syscalls/mbind/Makefile
index 5132dffa4..1e2f5e4de 100644
--- a/testcases/kernel/syscalls/mbind/Makefile
+++ b/testcases/kernel/syscalls/mbind/Makefile
@@ -20,15 +20,6 @@ top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-#
-# gcc complains about unused functions / variables when HAS_NUMA_H isn't
-# defined, so let's just skip the warning. It's nothing more than a few extra
-# variables and functions allocated on the stack, so meh... no harm, no foul.
-#
-ifeq ($(NUMA_LIBS),)
-CPPFLAGS		+= -Wno-unused
-endif
-
 CPPFLAGS		+= -I$(abs_srcdir)/../utils/
 
 include $(top_srcdir)/testcases/kernel/include/lib.mk
diff --git a/testcases/kernel/syscalls/migrate_pages/Makefile b/testcases/kernel/syscalls/migrate_pages/Makefile
index 7168cd6e1..46a35d3e0 100644
--- a/testcases/kernel/syscalls/migrate_pages/Makefile
+++ b/testcases/kernel/syscalls/migrate_pages/Makefile
@@ -23,9 +23,6 @@ include $(top_srcdir)/include/mk/testcases.mk
 MAKE_TARGETS		:= $(patsubst $(abs_srcdir)/%.c,%,$(wildcard $(abs_srcdir)/*[0-9].c))
 $(MAKE_TARGETS): %: %.o migrate_pages_common.o
 
-ifeq ($(NUMA_LIBS),)
-CPPFLAGS		+= -Wno-unused
-endif
 CPPFLAGS		+= -I$(abs_srcdir)/../utils/
 
 include $(top_srcdir)/testcases/kernel/include/lib.mk
diff --git a/testcases/kernel/syscalls/move_pages/Makefile b/testcases/kernel/syscalls/move_pages/Makefile
index d4620e10a..989277019 100644
--- a/testcases/kernel/syscalls/move_pages/Makefile
+++ b/testcases/kernel/syscalls/move_pages/Makefile
@@ -26,11 +26,6 @@ INSTALL_TARGETS		:= move_pages.sh
 
 MAKE_TARGETS		:= $(patsubst $(abs_srcdir)/%.c,%,$(wildcard $(abs_srcdir)/*[0-9].c))
 
-# linux_syscall_numbers.h is forcing move_pages_support.o to complain about
-# cleanup being undefined [and when defined] unused. Let's just skip this
-# warning...
-move_pages_support.o: CFLAGS += -Wno-unused-function
-
 $(MAKE_TARGETS): %: %.o move_pages_support.o
 
 LDLIBS			+= -lpthread -lrt
-- 
2.14.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [LTP] [RFC PATCH 6/6] m4, kernel/lib: Detect libnuma presence in kernel libs
  2017-10-06  1:53 [LTP] [RFC PATCH 0/6] Fix 32-bit cross compilation Petr Vorel
                   ` (4 preceding siblings ...)
  2017-10-06  1:53 ` [LTP] [RFC PATCH 5/6] make: Remove workarounds for build without libnuma Petr Vorel
@ 2017-10-06  1:53 ` Petr Vorel
  2017-10-06 10:02 ` [LTP] [RFC PATCH 0/6] Fix 32-bit cross compilation Richard Palethorpe
  6 siblings, 0 replies; 9+ messages in thread
From: Petr Vorel @ 2017-10-06  1:53 UTC (permalink / raw)
  To: ltp

This fixes link problems when NUMA headers are available
but libnuma don't (e.g. on 32-bit cross build).

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 m4/ltp-numa.m4                                          |  6 +++++-
 .../cpuset/cpuset_syscall_test/cpuset_syscall_test.c    |  4 ++--
 testcases/kernel/hotplug/memory_hotplug/commands.c      |  2 +-
 testcases/kernel/hotplug/memory_hotplug/memtoy.c        |  9 ++++-----
 testcases/kernel/hotplug/memory_hotplug/segment.c       |  2 +-
 testcases/kernel/include/numa_helper.h                  |  2 +-
 testcases/kernel/lib/numa_helper.c                      | 14 +++++++-------
 testcases/kernel/mem/cpuset/cpuset01.c                  |  4 ++--
 testcases/kernel/mem/ksm/ksm02.c                        |  4 ++--
 testcases/kernel/mem/ksm/ksm04.c                        |  4 ++--
 testcases/kernel/mem/lib/mem.c                          |  6 +++---
 testcases/kernel/mem/vma/vma02.c                        | 17 ++++++-----------
 testcases/kernel/mem/vma/vma04.c                        | 16 +++++-----------
 .../kernel/syscalls/get_mempolicy/get_mempolicy01.c     |  4 ++--
 testcases/kernel/syscalls/mbind/mbind01.c               |  4 ++--
 .../kernel/syscalls/migrate_pages/migrate_pages02.c     |  2 +-
 .../kernel/syscalls/move_pages/move_pages_support.c     |  8 ++++----
 17 files changed, 50 insertions(+), 58 deletions(-)

diff --git a/m4/ltp-numa.m4 b/m4/ltp-numa.m4
index 30650cd00..efa30886a 100644
--- a/m4/ltp-numa.m4
+++ b/m4/ltp-numa.m4
@@ -23,7 +23,11 @@ dnl LTP_CHECK_SYSCALL_NUMA
 dnl ----------------------------
 dnl
 AC_DEFUN([LTP_CHECK_SYSCALL_NUMA],
-[dnl
+[
+AC_CHECK_LIB(numa,numa_available,[have_libnuma="yes"])
+if test "x$have_libnuma" = "xyes"; then
+	AC_DEFINE(HAVE_LIBNUMA,1,[define whether libnuma is installed])
+fi
 AC_CHECK_HEADERS([linux/mempolicy.h numa.h numaif.h],[
 	LTP_SYSCALL_NUMA_HEADERS=yes
 	AC_CHECK_LIB(numa,numa_alloc_onnode,[have_numa_alloc_onnode="yes"])
diff --git a/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_test.c b/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_test.c
index 371cbc751..36867ab0e 100644
--- a/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_test.c
+++ b/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_test.c
@@ -51,7 +51,7 @@
 char *TCID = "cpuset_syscall_test";
 int TST_TOTAL = 1;
 
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
+#if HAVE_LIBNUMA && HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
 	&& HAVE_MPOL_CONSTANTS
 
 #include "../cpuset_lib/cpuset.h"
@@ -243,6 +243,6 @@ int main(int argc, char *argv[])
 #else
 int main(void)
 {
-	tst_brkm(TCONF, NULL, "System doesn't have required mempolicy support");
+	tst_brkm(TCONF, NULL, "test requires libnuma >= 2");
 }
 #endif
diff --git a/testcases/kernel/hotplug/memory_hotplug/commands.c b/testcases/kernel/hotplug/memory_hotplug/commands.c
index a9c618d82..bd23697a6 100644
--- a/testcases/kernel/hotplug/memory_hotplug/commands.c
+++ b/testcases/kernel/hotplug/memory_hotplug/commands.c
@@ -29,7 +29,7 @@
  */
 
 #include "config.h"
-#if HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_LINUX_MEMPOLICY_H
+#if HAVE_LIBNUMA && HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_LINUX_MEMPOLICY_H
 #include <linux/mempolicy.h>
 #include <sys/types.h>
 #include <sys/time.h>
diff --git a/testcases/kernel/hotplug/memory_hotplug/memtoy.c b/testcases/kernel/hotplug/memory_hotplug/memtoy.c
index 1a96d914a..aa5cfdeb5 100644
--- a/testcases/kernel/hotplug/memory_hotplug/memtoy.c
+++ b/testcases/kernel/hotplug/memory_hotplug/memtoy.c
@@ -24,8 +24,7 @@
 
 #include <stdio.h>
 #include "config.h"
-/* Shortcut because the test requires numa and mempolicy support. */
-#if HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_LINUX_MEMPOLICY_H
+#if HAVE_LIBNUMA && HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_LINUX_MEMPOLICY_H
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/mman.h>
@@ -491,10 +490,10 @@ int main(int argc, char *argv[])
 	return 0;
 
 }
-#else /* ! (HAVE_NUMA_H && HAVE_NUMAIF_H) */
+#else /* HAVE_LIBNUMA && HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_LINUX_MEMPOLICY_H */
 int main(void)
 {
-	printf("System doesn't have required numa support.\n");
+	printf("test requires libnuma >= 2\n");
 	return 0;
 }
-#endif /* HAVE_NUMA_H && HAVE_NUMAIF_H */
+#endif
diff --git a/testcases/kernel/hotplug/memory_hotplug/segment.c b/testcases/kernel/hotplug/memory_hotplug/segment.c
index 62ccd81f9..1cb06a67f 100644
--- a/testcases/kernel/hotplug/memory_hotplug/segment.c
+++ b/testcases/kernel/hotplug/memory_hotplug/segment.c
@@ -28,7 +28,7 @@
  */
 
 #include "config.h"
-#if HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_LINUX_MEMPOLICY_H
+#if HAVE_LIBNUMA && HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_LINUX_MEMPOLICY_H
 #include <sys/types.h>
 #include <sys/ipc.h>
 #include <sys/mman.h>
diff --git a/testcases/kernel/include/numa_helper.h b/testcases/kernel/include/numa_helper.h
index b9d55f04d..39cf7aa23 100644
--- a/testcases/kernel/include/numa_helper.h
+++ b/testcases/kernel/include/numa_helper.h
@@ -36,4 +36,4 @@ int get_allowed_nodes(int flag, int count, ...);
 void nh_dump_nodes(void);
 int is_numa(void (*cleanup_fn)(void), int flag, int min_nodes);
 
-#endif
+#endif /* NUMA_HELPER_H */
diff --git a/testcases/kernel/lib/numa_helper.c b/testcases/kernel/lib/numa_helper.c
index dd080ee4e..d98cf3fa2 100644
--- a/testcases/kernel/lib/numa_helper.c
+++ b/testcases/kernel/lib/numa_helper.c
@@ -39,7 +39,7 @@
 unsigned long get_max_node(void)
 {
 	unsigned long max_node = 0;
-#if HAVE_NUMA_H
+#if HAVE_LIBNUMA && HAVE_NUMA_H
 #if !defined(LIBNUMA_API_VERSION) || LIBNUMA_API_VERSION < 2
 	max_node = NUMA_NUM_NODES;
 	/*
@@ -52,11 +52,11 @@ unsigned long get_max_node(void)
 #else
 	max_node = numa_max_possible_node() + 1;
 #endif
-#endif /* HAVE_NUMA_H */
+#endif /* HAVE_LIBNUMA && HAVE_NUMA_H */
 	return max_node;
 }
 
-#if HAVE_NUMA_H
+#if HAVE_LIBNUMA && HAVE_NUMA_H
 static void get_nodemask_allnodes(nodemask_t * nodemask, unsigned long max_node)
 {
 	unsigned long nodemask_size = max_node / 8;
@@ -145,7 +145,7 @@ static void filter_nodemask_cpu(nodemask_t * nodemask, unsigned long max_node)
 	}
 	free(cpumask);
 }
-#endif /* HAVE_NUMA_H */
+#endif /* HAVE_LIBNUMA && HAVE_NUMA_H */
 
 /*
  * get_allowed_nodes_arr - get number and array of available nodes
@@ -163,7 +163,7 @@ static void filter_nodemask_cpu(nodemask_t * nodemask, unsigned long max_node)
 int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes)
 {
 	int ret = 0;
-#if HAVE_NUMA_H
+#if HAVE_LIBNUMA && HAVE_NUMA_H
 	int i;
 	nodemask_t *nodemask = NULL;
 #endif
@@ -171,7 +171,7 @@ int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes)
 	if (nodes)
 		*nodes = NULL;
 
-#if HAVE_NUMA_H
+#if HAVE_LIBNUMA && HAVE_NUMA_H
 	unsigned long max_node, nodemask_size;
 
 	if (numa_available() == -1)
@@ -209,7 +209,7 @@ int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes)
 		}
 	} while (0);
 	free(nodemask);
-#endif
+#endif /* HAVE_LIBNUMA && HAVE_NUMA_H */
 	return ret;
 }
 
diff --git a/testcases/kernel/mem/cpuset/cpuset01.c b/testcases/kernel/mem/cpuset/cpuset01.c
index 3d68cc07a..6fe5cdec9 100644
--- a/testcases/kernel/mem/cpuset/cpuset01.c
+++ b/testcases/kernel/mem/cpuset/cpuset01.c
@@ -30,7 +30,7 @@
 #include "mem.h"
 #include "numa_helper.h"
 
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
+#if HAVE_LIBNUMA && HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
 	&& HAVE_MPOL_CONSTANTS
 volatile int end;
 static int *nodes;
@@ -187,5 +187,5 @@ static struct tst_test test = {
 };
 
 #else /* no NUMA */
-	TST_TEST_TCONF("no NUMA development packages installed.");
+	TST_TEST_TCONF("test requires libnuma >= 2");
 #endif
diff --git a/testcases/kernel/mem/ksm/ksm02.c b/testcases/kernel/mem/ksm/ksm02.c
index 6fe75d380..b13d1e9c4 100644
--- a/testcases/kernel/mem/ksm/ksm02.c
+++ b/testcases/kernel/mem/ksm/ksm02.c
@@ -59,7 +59,7 @@
 #include "mem.h"
 #include "ksm_common.h"
 
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
+#if HAVE_LIBNUMA &&  HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
 	&& HAVE_MPOL_CONSTANTS
 
 static void verify_ksm(void)
@@ -122,5 +122,5 @@ static struct tst_test test = {
 };
 
 #else /* no NUMA */
-	TST_TEST_TCONF("no NUMA development packages installed.");
+	TST_TEST_TCONF("test requires libnuma and NUMA development packages");
 #endif
diff --git a/testcases/kernel/mem/ksm/ksm04.c b/testcases/kernel/mem/ksm/ksm04.c
index 1c8bf20c2..027dfb2fe 100644
--- a/testcases/kernel/mem/ksm/ksm04.c
+++ b/testcases/kernel/mem/ksm/ksm04.c
@@ -59,7 +59,7 @@
 #include "mem.h"
 #include "ksm_common.h"
 
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
+#if HAVE_LIBNUMA && HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
 	&& HAVE_MPOL_CONSTANTS
 
 static void verify_ksm(void)
@@ -126,5 +126,5 @@ static struct tst_test test = {
 };
 
 #else /* no NUMA */
-	TST_TEST_TCONF("no NUMA development packages installed.");
+	TST_TEST_TCONF("test requires libnuma and NUMA development packages");
 #endif
diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index dd82b08d2..5b431ebe9 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -164,7 +164,7 @@ void oom(int testcase, int lite, int retcode, int allow_sigkill)
 
 static void set_global_mempolicy(int mempolicy)
 {
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
+#if HAVE_LIBNUMA && HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
 	&& HAVE_MPOL_CONSTANTS
 	unsigned long nmask[MAXNODES / BITS_PER_LONG] = { 0 };
 	int num_nodes, *nodes;
@@ -562,7 +562,7 @@ void test_ksm_merge_across_nodes(unsigned long nr_pages)
 	unsigned long length;
 	unsigned long pagesize;
 
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
+#if HAVE_LIBNUMA && HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
 	&& HAVE_MPOL_CONSTANTS
 	unsigned long nmask[MAXNODES / BITS_PER_LONG] = { 0 };
 #endif
@@ -588,7 +588,7 @@ void test_ksm_merge_across_nodes(unsigned long nr_pages)
 			tst_brk(TBROK|TERRNO, "madvise");
 #endif
 
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
+#if HAVE_LIBNUMA && HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
 	&& HAVE_MPOL_CONSTANTS
 		clean_node(nmask);
 		set_node(nmask, nodes[i]);
diff --git a/testcases/kernel/mem/vma/vma02.c b/testcases/kernel/mem/vma/vma02.c
index ae35b2a07..5e767d393 100644
--- a/testcases/kernel/mem/vma/vma02.c
+++ b/testcases/kernel/mem/vma/vma02.c
@@ -49,9 +49,9 @@
 char *TCID = "vma02";
 int TST_TOTAL = 1;
 
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
-	&& HAVE_MPOL_CONSTANTS
-#if defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION == 2
+#if HAVE_LIBNUMA && HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_MPOL_CONSTANTS && \
+	defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+
 static unsigned long pagesize;
 static int opt_node;
 static char *opt_nodestr;
@@ -163,15 +163,10 @@ void usage(void)
 {
 	printf("  -n      Number of NUMA nodes\n");
 }
-#else /* libnuma v1 */
-int main(void)
-{
-	tst_brkm(TCONF, NULL, "XXX: test is only supported on libnuma v2.");
-}
-#endif
-#else /* no NUMA */
+
+#else /* libnuma >= 2 */
 int main(void)
 {
-	tst_brkm(TCONF, NULL, "no NUMA development packages installed.");
+	tst_brkm(TCONF, NULL, "test requires libnuma >= 2");
 }
 #endif
diff --git a/testcases/kernel/mem/vma/vma04.c b/testcases/kernel/mem/vma/vma04.c
index 5e2cc91b7..36549e132 100644
--- a/testcases/kernel/mem/vma/vma04.c
+++ b/testcases/kernel/mem/vma/vma04.c
@@ -53,9 +53,9 @@
 char *TCID = "vma04";
 int TST_TOTAL = 5;
 
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
-	&& HAVE_MPOL_CONSTANTS
-#if defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION == 2
+#if HAVE_LIBNUMA && HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_MPOL_CONSTANTS && \
+	defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+
 static unsigned long pagesize;
 static int opt_node;
 static char *opt_nodestr;
@@ -325,15 +325,9 @@ static void usage(void)
 	printf("  -n      Number of NUMA nodes\n");
 }
 
-#else /* libnuma v1 */
-int main(void)
-{
-	tst_brkm(TCONF, NULL, "XXX: test is only supported on libnuma v2.");
-}
-#endif
-#else /* no NUMA */
+#else /* libnuma >= 2 */
 int main(void)
 {
-	tst_brkm(TCONF, NULL, "no NUMA development packages installed.");
+	tst_brkm(TCONF, NULL, "test requires libnuma >= 2");
 }
 #endif
diff --git a/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c b/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
index cca50288f..f3d76d29d 100644
--- a/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
+++ b/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
@@ -66,7 +66,7 @@
 char *TCID = "get_mempolicy01";
 int TST_TOTAL = 1;
 
-#if HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_MPOL_CONSTANTS
+#if HAVE_LIBNUMA && HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_MPOL_CONSTANTS
 
 #define MEM_LENGTH	(4 * 1024 * 1024)
 
@@ -348,6 +348,6 @@ static void setup(void)
 #else
 int main(void)
 {
-	tst_brkm(TCONF, NULL, "System doesn't have required numa support");
+	tst_brkm(TCONF, NULL, "test requires libnuma >= 2");
 }
 #endif
diff --git a/testcases/kernel/syscalls/mbind/mbind01.c b/testcases/kernel/syscalls/mbind/mbind01.c
index be5470691..d498c0efe 100644
--- a/testcases/kernel/syscalls/mbind/mbind01.c
+++ b/testcases/kernel/syscalls/mbind/mbind01.c
@@ -26,7 +26,7 @@
 #include "numa_helper.h"
 #include "tst_test.h"
 
-#if HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_MPOL_CONSTANTS && \
+#if HAVE_LIBNUMA && HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_MPOL_CONSTANTS && \
 	defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 
 #define MEM_LENGTH (4 * 1024 * 1024)
@@ -234,5 +234,5 @@ static struct tst_test test = {
 };
 
 #else /* libnuma >= 2 */
-TST_TEST_TCONF("test requires libnuma >= 2.");
+TST_TEST_TCONF("test requires libnuma >= 2");
 #endif
diff --git a/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c b/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c
index 6755a384d..e3e08d83c 100644
--- a/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c
+++ b/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c
@@ -65,7 +65,7 @@
 char *TCID = "migrate_pages02";
 int TST_TOTAL = 1;
 
-#if defined(__NR_migrate_pages) && HAVE_NUMA_H && HAVE_NUMAIF_H
+#if defined(__NR_migrate_pages) && HAVE_LIBNUMA && HAVE_NUMA_H && HAVE_NUMAIF_H
 static const char nobody_uid[] = "nobody";
 static struct passwd *ltpuser;
 static int *nodes, nodeA, nodeB;
diff --git a/testcases/kernel/syscalls/move_pages/move_pages_support.c b/testcases/kernel/syscalls/move_pages/move_pages_support.c
index a488c88f0..4ab07c3c5 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages_support.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages_support.c
@@ -36,7 +36,7 @@ long get_page_size(void)
 void free_pages(void **pages, unsigned int num)
 {
 
-#if HAVE_NUMA_H
+#if HAVE_LIBNUMA && HAVE_NUMA_H
 	int i;
 	size_t onepage = get_page_size();
 
@@ -168,7 +168,7 @@ int alloc_pages_on_node(void **pages, unsigned int num, int node)
 void
 verify_pages_on_nodes(void **pages, int *status, unsigned int num, int *nodes)
 {
-#if HAVE_NUMA_H
+#if HAVE_LIBNUMA && HAVE_NUMA_H
 	unsigned int i;
 	int which_node;
 	int ret;
@@ -269,7 +269,7 @@ void verify_pages_on_node(void **pages, int *status, unsigned int num, int node)
  */
 int alloc_shared_pages_on_node(void **pages, unsigned int num, int node)
 {
-#if HAVE_NUMA_H
+#if HAVE_LIBNUMA && HAVE_NUMA_H
 	char *shared;
 	unsigned int i;
 	int nodes[num];
@@ -392,7 +392,7 @@ void free_sem(sem_t * sem, int num)
  */
 void check_config(unsigned int min_nodes)
 {
-#if HAVE_NUMA_H && HAVE_NUMAIF_H
+#if HAVE_LIBNUMA && HAVE_NUMA_H && HAVE_NUMAIF_H
 	int num_allowed_nodes;
 	int ret;
 
-- 
2.14.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [LTP] [RFC PATCH 0/6] Fix 32-bit cross compilation
  2017-10-06  1:53 [LTP] [RFC PATCH 0/6] Fix 32-bit cross compilation Petr Vorel
                   ` (5 preceding siblings ...)
  2017-10-06  1:53 ` [LTP] [RFC PATCH 6/6] m4, kernel/lib: Detect libnuma presence in kernel libs Petr Vorel
@ 2017-10-06 10:02 ` Richard Palethorpe
  2017-10-06 14:43   ` Petr Vorel
  6 siblings, 1 reply; 9+ messages in thread
From: Richard Palethorpe @ 2017-10-06 10:02 UTC (permalink / raw)
  To: ltp


Hello Petr,

Petr Vorel writes:

> Hi,
>
> these patches fixes 32-bit cross compilation build.
> I'm not an autotools expert so I tried to minimize changes.
> I extended header checks with library checks.

Good stuff, I have briefly tested the patch and it seems to
work. However I am wondering whether it is a good idea to remove the
header checks. It is not clear to me that AC_CHECK_LIB also somehow
checks that the relevant header exists as well. Perhaps it guesses the
header path from the library name, but it doesn't quite make sense to
me.

--
Thank you,
Richard.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LTP] [RFC PATCH 0/6] Fix 32-bit cross compilation
  2017-10-06 10:02 ` [LTP] [RFC PATCH 0/6] Fix 32-bit cross compilation Richard Palethorpe
@ 2017-10-06 14:43   ` Petr Vorel
  0 siblings, 0 replies; 9+ messages in thread
From: Petr Vorel @ 2017-10-06 14:43 UTC (permalink / raw)
  To: ltp

Hi Richard,

thanks a lot for a feadback.
> > these patches fixes 32-bit cross compilation build.
> > I'm not an autotools expert so I tried to minimize changes.
> > I extended header checks with library checks.

> Good stuff, I have briefly tested the patch and it seems to
> work. However I am wondering whether it is a good idea to remove the
> header checks. It is not clear to me that AC_CHECK_LIB also somehow
> checks that the relevant header exists as well. Perhaps it guesses the
> header path from the library name, but it doesn't quite make sense to
> me.
No, it an error, AC_CHECK_LIB doesn't check it. I'll put the relevant checks back in v2,
into AC_CHECK_HEADERS in configure.ac.


Kind regards,
Petr

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-10-06 14:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-06  1:53 [LTP] [RFC PATCH 0/6] Fix 32-bit cross compilation Petr Vorel
2017-10-06  1:53 ` [LTP] [RFC PATCH 1/6] m4: Fix libkeyutils detection on 32-bit cross build Petr Vorel
2017-10-06  1:53 ` [LTP] [RFC PATCH 2/6] m4: Fix libacl " Petr Vorel
2017-10-06  1:53 ` [LTP] [RFC PATCH 3/6] m4: Simplify check for linux/can.h header Petr Vorel
2017-10-06  1:53 ` [LTP] [RFC PATCH 4/6] m4: Fix libcrypto detection on 32-bit cross build Petr Vorel
2017-10-06  1:53 ` [LTP] [RFC PATCH 5/6] make: Remove workarounds for build without libnuma Petr Vorel
2017-10-06  1:53 ` [LTP] [RFC PATCH 6/6] m4, kernel/lib: Detect libnuma presence in kernel libs Petr Vorel
2017-10-06 10:02 ` [LTP] [RFC PATCH 0/6] Fix 32-bit cross compilation Richard Palethorpe
2017-10-06 14:43   ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.