Fix 32-bit cross compilation
v3 cover Fix 32-bit cross compilation
Hi,
I tested HEAD against:
./configure "CFLAGS=-m32" "CXXFLAGS=-m32" LDFLAGS="-m32" && make && make install (I know we don't really need CXXFLAGS)
and each commit against normal build.
Petr Vorel (18):
configure.ac: Sort headers alphabetically
m4: Simplify check for linux/can.h header
m4: Simplify check for linux/keyctl.h header lapi/keyctl.h: Add doc and reorder definitions syscalls/request_key: Port to use lapi/keyctl.h header
m4: Fix libkeyutils detection on 32-bit cross build nfsv4/acl1: Exit with TCONF when libacl not available
m4: Fix libacl detection on 32-bit cross build
m4: Fix libcrypto detection on 32-bit cross build io/aiocp: Exit with TCONF when libaio is not available
m4: Fix libaio detection on 32-bit cross build
make: Remove workarounds for build without libnuma
numa: Drop NUMA API v1 support
numa: Drop NUMA_CPPFLAGS
hotplug/memory_hotplug: Update TODO hotplug/memory_hotplug: Remove unused header hotplug/memory_hotplug: Exit with TCONF when NUMA headers not
available
m4,kernel/lib: Detect libnuma presence in kernel libs
configure.ac | 13 +++--- include/lapi/keyctl.h | 53 +++++++++++++++++----- include/mk/config.mk.default | 1 - include/mk/config.mk.in | 1 - m4/ltp-acl.m4 | 12 +++-- m4/ltp-can.m4 | 25 ---------- m4/ltp-crypto.m4 | 11 +++-- m4/ltp-eventfd.m4 | 17 ++++--- m4/ltp-keyctl.m4 | 25 ---------- m4/ltp-keyutils.m4 | 7 +-- m4/ltp-numa.m4 | 45 ++++++++---------- .../controllers/cpuset/cpuset_lib/libcpuset.c | 1 + .../cpuset/cpuset_syscall_test/Makefile | 1 - .../cpuset_syscall_test/cpuset_syscall_test.c | 5 +- testcases/kernel/hotplug/memory_hotplug/TODO | 5 -- testcases/kernel/hotplug/memory_hotplug/commands.c | 17 ++----- testcases/kernel/hotplug/memory_hotplug/memtoy.c | 17 ++++--- testcases/kernel/hotplug/memory_hotplug/segment.c | 6 ++- testcases/kernel/include/lib.mk | 2 +- testcases/kernel/include/numa_helper.h | 2 +- testcases/kernel/io/aio/aio01/aio01.c | 23 ++++------ testcases/kernel/io/aio/aio02/aio_tio.c | 3 +- testcases/kernel/io/aio/aio02/main.c | 8 ++-- testcases/kernel/io/ltp-aiodio/aio-stress.c | 15 +++++- testcases/kernel/io/ltp-aiodio/aiocp.c | 11 ++--- testcases/kernel/io/ltp-aiodio/aiodio_append.c | 14 +++++- testcases/kernel/io/ltp-aiodio/aiodio_sparse.c | 18 ++++++-- testcases/kernel/lib/Makefile | 3 +- testcases/kernel/lib/numa_helper.c | 25 +++------- testcases/kernel/mem/cpuset/cpuset01.c | 8 ++-- testcases/kernel/mem/ksm/ksm02.c | 9 ++-- testcases/kernel/mem/ksm/ksm04.c | 9 ++-- testcases/kernel/mem/ksm/ksm06.c | 12 +++-- testcases/kernel/mem/lib/mem.c | 13 +++--- testcases/kernel/mem/oom/oom02.c | 9 ++-- testcases/kernel/mem/oom/oom03.c | 10 ++-- testcases/kernel/mem/oom/oom04.c | 9 ++-- testcases/kernel/mem/oom/oom05.c | 9 ++-- testcases/kernel/mem/vma/vma02.c | 14 ++---- testcases/kernel/mem/vma/vma04.c | 13 ++---- testcases/kernel/numa/Makefile | 2 +- .../integrity/ima/src/ima_boot_aggregate.c | 21 +++++---- .../security/integrity/ima/src/ima_measure.c | 24 +++++----- testcases/kernel/syscalls/eventfd/eventfd01.c | 16 +++++-- .../syscalls/get_mempolicy/get_mempolicy01.c | 41 ++--------------- testcases/kernel/syscalls/io_cancel/io_cancel01.c | 12 +++-- .../kernel/syscalls/io_destroy/io_destroy01.c | 12 +++-- .../kernel/syscalls/io_getevents/io_getevents01.c | 13 +++--- testcases/kernel/syscalls/io_setup/io_setup01.c | 12 +++-- testcases/kernel/syscalls/io_submit/io_submit01.c | 11 +++-- testcases/kernel/syscalls/mbind/Makefile | 9 ---- testcases/kernel/syscalls/mbind/mbind01.c | 9 ++-- testcases/kernel/syscalls/migrate_pages/Makefile | 3 -- .../syscalls/migrate_pages/migrate_pages01.c | 8 ++-- .../syscalls/migrate_pages/migrate_pages02.c | 9 ++-- testcases/kernel/syscalls/move_pages/Makefile | 5 -- .../syscalls/move_pages/move_pages_support.c | 14 +++--- .../kernel/syscalls/request_key/request_key01.c | 14 +----- .../kernel/syscalls/request_key/request_key02.c | 15 +----- testcases/network/nfsv4/acl/acl1.c | 24 ++-------- 60 files changed, 359 insertions(+), 416 deletions(-) delete mode 100644 m4/ltp-can.m4 delete mode 100644 m4/ltp-keyctl.m4
Signature · 1 line
2.14.2
PATCH v3 1/18 configure.ac: Sort headers alphabetically
--- configure.ac | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
configure.ac +4 -4
@@ -33,18 +33,18 @@ AC_PREFIX_DEFAULT(/opt/ltp) AC_CHECK_HEADERS([ \ ifaddrs.h \ libaio.h \ - mm.h \ - pthread.h \ - sys/xattr.h \ linux/genetlink.h \ linux/mempolicy.h \ linux/module.h \ linux/netlink.h \ + mm.h \ + pthread.h \ sys/epoll.h \ - sys/inotify.h \ sys/fanotify.h \ + sys/inotify.h \ sys/prctl.h \ sys/ustat.h \ + sys/xattr.h \ ]) AC_CHECK_FUNCS([ \
Signature · 1 line
2.14.2
PATCH v3 1/18 configure.ac: Sort headers alphabetically
Hi!
I've pushed first three patches as these are obviously fine.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v3 2/18 m4: Simplify check for linux/can.h header
In reply to Petr Vorel--- configure.ac | 2 +- m4/ltp-can.m4 | 25 ------------------------- 2 files changed, 1 insertion(+), 26 deletions(-) delete mode 100644 m4/ltp-can.m4
configure.ac +1 -1
@@ -33,6 +33,7 @@ AC_PREFIX_DEFAULT(/opt/ltp) AC_CHECK_HEADERS([ \ ifaddrs.h \ libaio.h \ + linux/can.h \ linux/genetlink.h \ linux/mempolicy.h \ linux/module.h \
@@ -182,7 +183,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
m4/ltp-can.m4 deleted +0 -25
@@ -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]) -])
Signature · 1 line
2.14.2
PATCH v3 3/18 m4: Simplify check for linux/keyctl.h header
In reply to Petr Vorel--- configure.ac | 2 +- m4/ltp-keyctl.m4 | 25 ------------------------- 2 files changed, 1 insertion(+), 26 deletions(-) delete mode 100644 m4/ltp-keyctl.m4
configure.ac +1 -1
@@ -35,6 +35,7 @@ AC_CHECK_HEADERS([ \ libaio.h \ linux/can.h \ linux/genetlink.h \ + linux/keyctl.h \ linux/mempolicy.h \ linux/module.h \ linux/netlink.h \
@@ -184,7 +185,6 @@ LTP_CHECK_SPLICE LTP_CHECK_VMSPLICE LTP_CHECK_TIMERFD LTP_CHECK_IOVEC -LTP_CHECK_KEYCTL LTP_CHECK_LINUXRANDOM LTP_CHECK_IF_LINK LTP_CHECK_KCMP
m4/ltp-keyctl.m4 deleted +0 -25
@@ -1,25 +0,0 @@ -dnl -dnl Copyright (c) 2014 Linux Test Project -dnl -dnl This program is free software; you can redistribute it and/or -dnl modify it under the terms of the GNU General Public License as -dnl published by the Free Software Foundation; either version 2 of -dnl the License, or (at your option) any later version. -dnl -dnl This program is distributed in the hope that it would be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl 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 the Free Software Foundation, -dnl Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -dnl - -dnl -dnl LTP_CHECK_KEYCTL -dnl ---------------------------- -dnl -AC_DEFUN([LTP_CHECK_KEYCTL],[ -AC_CHECK_HEADERS([linux/keyctl.h]) -])
Signature · 1 line
2.14.2
PATCH v3 4/18 lapi/keyctl.h: Add doc and reorder definitions
In reply to Petr Vorel--- include/lapi/keyctl.h | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-)
include/lapi/keyctl.h +17 -14
@@ -65,12 +65,23 @@ static inline long keyctl(int cmd, ...) }#endif /* HAVE_KEYUTILS_H */ -#ifndef KEYCTL_GET_KEYRING_ID -# define KEYCTL_GET_KEYRING_ID 0 +/* special process keyring shortcut IDs */ +#ifndef KEY_SPEC_THREAD_KEYRING +# define KEY_SPEC_THREAD_KEYRING -1#endif -#ifndef KEYCTL_SET_REQKEY_KEYRING -# define KEYCTL_SET_REQKEY_KEYRING 14 +#ifndef KEY_SPEC_SESSION_KEYRING +# define KEY_SPEC_SESSION_KEYRING -3 +#endif + +/* request-key default keyrings */ +#ifndef KEY_REQKEY_DEFL_THREAD_KEYRING +# define KEY_REQKEY_DEFL_THREAD_KEYRING 1 +#endif + +/* keyctl commands */ +#ifndef KEYCTL_GET_KEYRING_ID +# define KEYCTL_GET_KEYRING_ID 0#endif #ifndef KEYCTL_JOIN_SESSION_KEYRING
@@ -89,16 +100,8 @@ static inline long keyctl(int cmd, ...)# define KEYCTL_UNLINK 9#endif -#ifndef KEY_SPEC_THREAD_KEYRING -# define KEY_SPEC_THREAD_KEYRING -1 -#endif - -#ifndef KEY_SPEC_SESSION_KEYRING -# define KEY_SPEC_SESSION_KEYRING -3 -#endif - -#ifndef KEY_REQKEY_DEFL_THREAD_KEYRING -# define KEY_REQKEY_DEFL_THREAD_KEYRING 1 +#ifndef KEYCTL_SET_REQKEY_KEYRING +# define KEYCTL_SET_REQKEY_KEYRING 14#endif #endif /* KEYCTL_H__ */
Signature · 1 line
2.14.2
PATCH v3 5/18 syscalls/request_key: Port to use lapi/keyctl.h header
In reply to Petr Vorel--- include/lapi/keyctl.h | 24 ++++++++++++++++++++++ .../kernel/syscalls/request_key/request_key01.c | 14 +------------ .../kernel/syscalls/request_key/request_key02.c | 15 ++------------ 3 files changed, 27 insertions(+), 26 deletions(-)
include/lapi/keyctl.h +24 -0
@@ -70,15 +70,27 @@ static inline long keyctl(int cmd, ...)# define KEY_SPEC_THREAD_KEYRING -1#endif +#ifndef KEY_SPEC_PROCESS_KEYRING +# define KEY_SPEC_PROCESS_KEYRING -2 +#endif +#ifndef KEY_SPEC_SESSION_KEYRING # define KEY_SPEC_SESSION_KEYRING -3#endif +#ifndef KEY_SPEC_USER_SESSION_KEYRING +#define KEY_SPEC_USER_SESSION_KEYRING -5 +#endif +/* request-key default keyrings */ #ifndef KEY_REQKEY_DEFL_THREAD_KEYRING # define KEY_REQKEY_DEFL_THREAD_KEYRING 1#endif +#ifndef KEY_REQKEY_DEFL_DEFAULT +#define KEY_REQKEY_DEFL_DEFAULT 0 +#endif +/* keyctl commands */ #ifndef KEYCTL_GET_KEYRING_ID # define KEYCTL_GET_KEYRING_ID 0
@@ -92,6 +104,10 @@ static inline long keyctl(int cmd, ...)# define KEYCTL_UPDATE 2#endif +#ifndef KEYCTL_REVOKE +# define KEYCTL_REVOKE 3 +#endif +#ifndef KEYCTL_SETPERM # define KEYCTL_SETPERM 5#endif
@@ -100,8 +116,16 @@ static inline long keyctl(int cmd, ...)# define KEYCTL_UNLINK 9#endif +#ifndef KEYCTL_READ +# define KEYCTL_READ 11 +#endif +#ifndef KEYCTL_SET_REQKEY_KEYRING # define KEYCTL_SET_REQKEY_KEYRING 14#endif +#ifndef KEYCTL_SET_TIMEOUT +#define KEYCTL_SET_TIMEOUT 15 +#endif +#endif /* KEYCTL_H__ */
testcases/kernel/syscalls/request_key/request_key01.c +1 -13
@@ -25,16 +25,10 @@* */ -#include "config.h" #include <errno.h> -#include <sys/types.h> -#ifdef HAVE_KEYUTILS_H -# include <keyutils.h> -#endif #include "tst_test.h" - -#ifdef HAVE_KEYUTILS_H +#include "lapi/keyctl.h" static int key;
@@ -64,9 +58,3 @@ static struct tst_test test = { .setup = setup, .test_all = verify_request_key, }; - -#else - -TST_TEST_TCONF ("keyutils.h was missing at compilation" ); - -#endif /* HAVE_LINUX_KEYCTL_H */
testcases/kernel/syscalls/request_key/request_key02.c +2 -13
@@ -29,15 +29,10 @@* */ -#include "config.h" #include <errno.h> -#include <sys/types.h> -#ifdef HAVE_KEYUTILS_H -# include <keyutils.h> -#endif -#include "tst_test.h" -#ifdef HAVE_KEYUTILS_H +#include "tst_test.h" +#include "lapi/keyctl.h" static int key1;static int key2;
@@ -111,9 +106,3 @@ static struct tst_test test = { .tcnt = ARRAY_SIZE(tcases), .test = verify_request_key, }; - -#else - -TST_TEST_TCONF ("keyutils.h was missing at compilation" ); - -#endif /* HAVE_LINUX_KEYCTL_H */
Signature · 1 line
2.14.2
PATCH v3 6/18 m4: Fix libkeyutils detection on 32-bit cross build
In reply to Petr Vorel--- configure.ac | 1 + include/lapi/keyctl.h | 6 ++++-- m4/ltp-keyutils.m4 | 7 ++++--- 3 files changed, 9 insertions(+), 5 deletions(-)
configure.ac +1 -0
@@ -32,6 +32,7 @@ AC_PREFIX_DEFAULT(/opt/ltp) AC_CHECK_HEADERS([ \ ifaddrs.h \ + keyutils.h \ libaio.h \ linux/can.h \ linux/genetlink.h \
include/lapi/keyctl.h +4 -2
@@ -19,12 +19,14 @@#define KEYCTL_H__ #include "config.h" -#ifdef HAVE_KEYUTILS_H + +#if defined(HAVE_KEYUTILS_H ) && defined(HAVE_LIBKEYUTILS )# include <keyutils.h> #else # ifdef HAVE_LINUX_KEYCTL_H # include <linux/keyctl.h> # endif /* HAVE_LINUX_KEYCTL_H */ +# include <stdarg.h> # include <stdint.h> # include "lapi/syscalls.h"
@@ -63,7 +65,7 @@ static inline long keyctl(int cmd, ...) return tst_syscall(__NR_keyctl, cmd, arg2, arg3, arg4, arg5); } -#endif /* HAVE_KEYUTILS_H */ +#endif /* defined(HAVE_KEYUTILS_H) && defined(HAVE_LIBKEYUTILS) */ /* special process keyring shortcut IDs */ #ifndef KEY_SPEC_THREAD_KEYRING
m4/ltp-keyutils.m4 +4 -3
@@ -18,7 +18,8 @@ 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], + [AC_DEFINE(HAVE_LIBKEYUTILS, 1, [Define to 1 if you have libkeyutils installed]), + AC_SUBST(KEYUTILS_LIBS, "-lkeyutils")]) ])
Signature · 1 line
2.14.2
PATCH v3 7/18 nfsv4/acl1: Exit with TCONF when libacl not available
In reply to Petr Vorel+ cleanup dos/windows headers
--- testcases/network/nfsv4/acl/acl1.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-)
testcases/network/nfsv4/acl/acl1.c +3 -16
@@ -4,31 +4,20 @@* Purpose: setting an acl on a file a verifies that the accesses are right */ -#if defined (DOS ) || defined (WIN32 ) -/* If Dos, Windows or Win32 */ -#define DOSorWIN32 -#endif - -#ifndef DOSorWIN32#include <sys/param.h> -#endif #include <stdlib.h> #include <sys/types.h> -#ifdef DOSorWIN32 -#include <time.h> -#else #include <sys/time.h> -#endif #include <sys/stat.h> #include <stdio.h> #include <string.h> -//#include "../tests.h" #include <dirent.h> #include <unistd.h> #include <errno.h> -#include <config.h> +#include "config.h" +#include "tst_res_flags.h" #ifdef HAVE_SYS_ACL_H
@@ -378,11 +367,9 @@ int main(int argc, char *argv[]) }#else -int main (void ) {printf ("The acl library was missing upon compilation.\n" ); -return 0 ; +return TCONF ; } -#endif /* HAVE_SYS_ACL_H */
Signature · 1 line
2.14.2
PATCH v3 7/18 nfsv4/acl1: Exit with TCONF when libacl not available
Hi!
Applied, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v3 8/18 m4: Fix libacl detection on 32-bit cross build
In reply to Petr Vorel--- m4/ltp-acl.m4 | 12 +++++++----- testcases/network/nfsv4/acl/acl1.c | 5 ++--- 2 files changed, 9 insertions(+), 8 deletions(-)
m4/ltp-acl.m4 +7 -5
@@ -22,9 +22,11 @@ dnl 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]) +AC_DEFUN([LTP_CHECK_ACL_SUPPORT], [ + AC_CHECK_LIB([acl], [acl_init], [have_libacl=yes], [AC_MSG_WARN(missing libacl)]) + AC_CHECK_HEADERS([sys/acl.h], [have_acl=yes], [AC_MSG_WARN(missing libacl headers)]) + if test "x$have_libacl" = "xyes" -a "x$have_acl" = "xyes"; then + AC_DEFINE(HAVE_LIBACL, 1, [Define to 1 if you have libacl and it's headers installed]) + AC_SUBST(ACL_LIBS, "-lacl") + fi ])
testcases/network/nfsv4/acl/acl1.c +2 -3
@@ -19,7 +19,7 @@#include "config.h" #include "tst_res_flags.h" -#ifdef HAVE_SYS_ACL_H +#ifdef HAVE_LIBACL #include <sys/acl.h>
@@ -365,11 +365,10 @@ int main(int argc, char *argv[])showstats (); return 1; } -#else int main (void ) {printf ("The acl library was missing upon compilation.\n" );return TCONF ; } -#endif /* HAVE_SYS_ACL_H */ +#endif /* HAVE_LIBACL */
Signature · 1 line
2.14.2
PATCH v3 8/18 m4: Fix libacl detection on 32-bit cross build
Hi!
Pushed, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v3 9/18 m4: Fix libcrypto detection on 32-bit cross build
In reply to Petr VorelWe check not only for openssl/sha.h but also for libcrypto.so. Check are added in m4 so to simplify #if checks in C sources.
--- m4/ltp-crypto.m4 | 11 ++++++---- .../integrity/ima/src/ima_boot_aggregate.c | 21 +++++++++++-------- .../security/integrity/ima/src/ima_measure.c | 24 +++++++++++----------- 3 files changed, 31 insertions(+), 25 deletions(-)
m4/ltp-crypto.m4 +7 -4
@@ -2,8 +2,11 @@ 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], [have_libcrypto=yes], [AC_MSG_WARN(missing libcrypto)]) + AC_CHECK_HEADERS([openssl/sha.h], [have_sha=yes], [AC_MSG_WARN(missing openssl headers)]) + if test "x$have_libcrypto" = "xyes" -a "x$have_sha" = "xyes"; then + AC_DEFINE(HAVE_LIBCRYPTO, 1, [Define whether libcrypto and openssl headers are installed]) + AC_SUBST(CRYPTO_LIBS, "-lcrypto") + fi ])
testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c +12 -9
@@ -13,8 +13,6 @@* * Calculate a SHA1 boot aggregate value based on the TPM * binary_bios_measurements. -* -* Requires openssl; compile with -lcrypto option */ #include <stdio.h> #include <stdlib.h>
@@ -23,18 +21,20 @@#include <fcntl.h> #include <string.h> #include <unistd.h> +#include "config.h" #include "test.h" -#if HAVE_OPENSSL_SHA_H + +char *TCID ="ima_boot_aggregate" ; + +#if HAVE_LIBCRYPTO #include <openssl/sha.h> -#endif #define MAX_EVENT_SIZE 500#define EVENT_HEADER_SIZE 32#define MAX_EVENT_DATA_SIZE (MAX_EVENT_SIZE - EVENT_HEADER_SIZE)#define NUM_PCRS 8/* PCR registers 0-7 in boot aggregate */ -char *TCID ="ima_boot_aggregate" ;int TST_TOTAL =1 ;static void display_sha1_digest (unsigned char *pcr)
@@ -48,7 +48,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 +112,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
testcases/kernel/security/integrity/ima/src/ima_measure.c +12 -12
@@ -22,15 +22,17 @@#include <fcntl.h> #include <string.h> #include <unistd.h> +#include "config.h" #include "test.h" -#if HAVE_OPENSSL_SHA_H + +char *TCID ="ima_measure" ; + +#if HAVE_LIBCRYPTO #include <openssl/sha.h> -#endif #define TCG_EVENT_NAME_LEN_MAX 255 -char *TCID ="ima_measure" ;int TST_TOTAL =1 ;static int verbose;
@@ -39,8 +41,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 +97,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 +129,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 +208,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
Signature · 1 line
2.14.2
PATCH v3 9/18 m4: Fix libcrypto detection on 32-bit cross build
Hi!
testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c int main(int argc, char *argv[]) · line 121
Quoted 4 lines
testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c +4
-0+#else +int main (void ) +{ +tst_resm (TCONF ,"test requires libcrypto and openssl development packages" );
^
I've changed these to tst_brkm() otherwise the return value from main() would be undefined because these are oldlib tests that has to either call tst_exit() or tst_brkm() to actually exit the test.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v3 9/18 m4: Fix libcrypto detection on 32-bit cross build
Hi!
Quoted 9 lines
testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c int main(int argc, char *argv[]) · line 121
Quoted 4 lines
testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c +4
-0+#else +int main (void ) +{ +tst_resm (TCONF ,"test requires libcrypto and openssl development packages" );^
I've changed these totst_brkm()otherwise the return value frommain()would be undefined because these are oldlib tests that has to either calltst_exit()ortst_brkm()to actually exit the test.
And pushed.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v3 10/18 io/aiocp: Exit with TCONF when libaio is not available
In reply to Petr Vorel--- testcases/kernel/io/ltp-aiodio/aiocp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
testcases/kernel/io/ltp-aiodio/aiocp.c +3 -1
@@ -34,7 +34,9 @@#include <mntent.h> #include <sys/select.h> #include <sys/mount.h> +#include "config.h" +#include "tst_res_flags.h" #if HAVE_LIBAIO_H
@@ -602,7 +604,7 @@ int main(int argc, char *const *argv)int main (void ) {fprintf (stderr,"System doesn't have libaio support.\n" ); -return 1 ; +return TCONF ; }#endif
Signature · 1 line
2.14.2
PATCH v3 10/18 io/aiocp: Exit with TCONF when libaio is not available
Hi!
Pushed, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v3 11/18 m4: Fix libaio detection on 32-bit cross build
In reply to Petr Vorel--- m4/ltp-eventfd.m4 | 17 +++++++++------- testcases/kernel/io/aio/aio01/aio01.c | 23 ++++++++++------------ testcases/kernel/io/aio/aio02/aio_tio.c | 3 +-- testcases/kernel/io/aio/aio02/main.c | 8 ++++---- testcases/kernel/io/ltp-aiodio/aio-stress.c | 15 ++++++++++++-- testcases/kernel/io/ltp-aiodio/aiocp.c | 7 ++----- testcases/kernel/io/ltp-aiodio/aiodio_append.c | 14 +++++++++++-- testcases/kernel/io/ltp-aiodio/aiodio_sparse.c | 18 +++++++++++++---- testcases/kernel/syscalls/eventfd/eventfd01.c | 16 ++++++++++----- testcases/kernel/syscalls/io_cancel/io_cancel01.c | 12 ++++++----- .../kernel/syscalls/io_destroy/io_destroy01.c | 12 ++++++----- .../kernel/syscalls/io_getevents/io_getevents01.c | 13 ++++++------ testcases/kernel/syscalls/io_setup/io_setup01.c | 12 ++++++----- testcases/kernel/syscalls/io_submit/io_submit01.c | 11 ++++++----- 14 files changed, 111 insertions(+), 70 deletions(-)
m4/ltp-eventfd.m4 +10 -7
@@ -22,13 +22,12 @@ dnl dnl LTP_CHECK_SYSCALL_EVENTFD dnl ---------------------------- dnl -AC_DEFUN([LTP_CHECK_SYSCALL_EVENTFD], -[dnl +AC_DEFUN([LTP_CHECK_SYSCALL_EVENTFD], [ AH_TEMPLATE(HAVE_IO_SET_EVENTFD, [Define to 1 if you have the `io_set_eventfd' function.]) -AC_CHECK_HEADERS(libaio.h,[ - AC_CHECK_LIB(aio,io_setup,[ - AIO_LIBS="-laio" +AC_CHECK_HEADERS(libaio.h, [ + AC_CHECK_LIB(aio,io_setup, [ + have_aio=yes AC_MSG_CHECKING([io_set_eventfd is defined in aio library or aio header]) AC_TRY_LINK([#include <stdio.h> #include <libaio.h>
@@ -38,6 +37,10 @@ AC_CHECK_HEADERS(libaio.h,[ [AC_DEFINE(HAVE_IO_SET_EVENTFD) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])], - AIO_LIBS="")]) -AC_SUBST(AIO_LIBS) + have_aio=no)]) + +if test "x$have_aio" = "xyes"; then + AC_SUBST(AIO_LIBS, "-laio") + AC_DEFINE(HAVE_LIBAIO, 1, [Define whether libaio and it's headers are installed]) +fi ])
testcases/kernel/io/aio/aio01/aio01.c +10 -13
@@ -47,26 +47,26 @@#define _XOPEN_SOURCE 600 -#include "test.h" -#include "config.h" - -char *TCID ="aio01" ; -int TST_TOTAL =6 ; - -#ifdef HAVE_LIBAIO_H -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <time.h> #include <errno.h> -#include <libaio.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/time.h> #include <sys/resource.h> +#include "test.h" +#include "config.h" + +char *TCID ="aio01" ; +int TST_TOTAL =6 ; + +#ifdef HAVE_LIBAIO +#include <libaio.h> +static void help (void );static void setup (void );static void cleanup (void );
@@ -413,14 +413,11 @@ static void cleanup(void)close (fd);io_queue_release (io_ctx); tst_rmdir(); - }#else -int main (void ) { -tst_brkm (TCONF ,NULL ,"libaio missing" ); +tst_brkm (TCONF ,NULL ,"test requires libaio and it's development packages" ); } -#endif
testcases/kernel/io/aio/aio02/aio_tio.c +1 -2
@@ -37,7 +37,7 @@#include <string.h> #include <errno.h> -#if HAVE_LIBAIO_H +#ifdef HAVE_LIBAIO #define AIO_MAXIO 32#define AIO_BLKSIZE (64*1024)
@@ -237,5 +237,4 @@ int test_main(void) return status; } -#endif
testcases/kernel/io/aio/aio02/main.c +4 -4
@@ -6,16 +6,16 @@#include <sys/types.h> #include <sys/stat.h> #include <unistd.h> -#include "test.h" +#include "config.h" +#include "test.h" #define TEST_NAME "aio_tio"char *TCID ="aio02/" TEST_NAME ;int TST_TOTAL =0 ; -#if HAVE_LIBAIO_H - +#ifdef HAVE_LIBAIO #include <libaio.h> int test_main (void );
@@ -32,6 +32,6 @@ int main(void)#else int main (void ) { -tst_brkm (TCONF ,NULL ,"libaio missing" ); +tst_brkm (TCONF ,NULL ,"test requires libaio and it's development packages" ); }#endif
testcases/kernel/io/ltp-aiodio/aio-stress.c +13 -2
@@ -50,19 +50,23 @@#include <errno.h> #include <assert.h> #include <stdlib.h> -#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <sys/time.h> -#include <libaio.h> #include <sys/ipc.h> #include <sys/shm.h> #include <sys/mman.h> #include <string.h> #include <pthread.h> +#include "config.h" +#include "tst_res_flags.h" + +#ifdef HAVE_LIBAIO +#include <libaio.h> +#define IO_FREE 0#define IO_PENDING 1#define RUN_FOREVER -1
@@ -1557,3 +1561,10 @@ int main(int ac, char **av) }return status; } +#else +int main (void ) +{ +fprintf (stderr,"test requires libaio and it's development packages\n" ); +return TCONF ; +} +#endif
testcases/kernel/io/ltp-aiodio/aiocp.c +2 -5
@@ -38,8 +38,7 @@#include "config.h" #include "tst_res_flags.h" -#if HAVE_LIBAIO_H - +#ifdef HAVE_LIBAIO #include <libaio.h> #define AIO_BLKSIZE (64*1024)
@@ -600,11 +599,9 @@ int main(int argc, char *const *argv)*/ #else -int main (void ) { -fprintf (stderr,"System doesn't have libaio support.\n" ); +fprintf (stderr,"test requires libaio and it's development packages\n" );return TCONF ; } -#endif
testcases/kernel/io/ltp-aiodio/aiodio_append.c +12 -2
@@ -32,10 +32,14 @@#include <fcntl.h> #include <unistd.h> -#include <libaio.h> - +#include "config.h" #include "test.h" +char *TCID ="aiodio_append" ; + +#ifdef HAVE_LIBAIO +#include <libaio.h> +#define NUM_CHILDREN 8#include "common_checkzero.h"
@@ -174,3 +178,9 @@ int main(int argc, char **argv) return 0; } +#else +int main (void ) +{ +tst_brkm (TCONF ,NULL ,"test requires libaio and it's development packages" ); +} +#endif
testcases/kernel/io/ltp-aiodio/aiodio_sparse.c +14 -4
@@ -35,11 +35,17 @@#include <limits.h> #include <getopt.h> -#include <libaio.h> +#include "config.h" #include "test.h" #include "safe_macros.h" +char *TCID ="aiodio_sparse" ; +int TST_TOTAL =1 ; + +#ifdef HAVE_LIBAIO +#include <libaio.h> +#define NUM_CHILDREN 1000int debug;
@@ -49,9 +55,6 @@ static void setup(void);static void cleanup (void );static void usage (void ); -char *TCID ="aiodio_sparse" ; -int TST_TOTAL =1 ; -#include "common_sparse.h" /*
@@ -325,3 +328,10 @@ static void cleanup(void) tst_rmdir(); } + +#else +int main (void ) +{ +tst_brkm (TCONF ,NULL ,"test requires libaio and it's development packages" ); +} +#endif
testcases/kernel/syscalls/eventfd/eventfd01.c +11 -5
@@ -61,15 +61,14 @@#define CLEANUP cleanup#include "lapi/syscalls.h" -#ifdef HAVE_LIBAIO_H +TCID_DEFINE (eventfd01); +int TST_TOTAL =15 ; + +#ifdef HAVE_LIBAIO #include <libaio.h> -#endif static void setup (void ); -TCID_DEFINE (eventfd01); -int TST_TOTAL =15 ; -static int myeventfd (unsigned int initval,int flags) {/* eventfd2 uses FLAGS but eventfd doesn't take FLAGS. */
@@ -727,3 +726,10 @@ static void cleanup(void) {tst_rmdir (); } + +#else +int main (void ) +{ +tst_brkm (TCONF ,NULL ,"test requires libaio and it's development packages" ); +} +#endif
testcases/kernel/syscalls/io_cancel/io_cancel01.c +7 -5
@@ -21,6 +21,9 @@/* Porting from Crackerjack to LTP is done by Masatake YAMATO <[email protected]> */ +#include <errno.h> +#include <string.h> +#include "config.h" #include "test.h"
@@ -28,10 +31,8 @@ char *TCID = "io_cancel01";int TST_TOTAL =1 ; -#ifdef HAVE_LIBAIO_H +#ifdef HAVE_LIBAIO #include <libaio.h> -#include <errno.h> -#include <string.h> static void cleanup (void ) {
@@ -105,9 +106,10 @@ int main(int argc, char *argv[])cleanup (); tst_exit(); } +#else -int main (int argc,char *argv[]) +int main (void ) { -tst_brkm (TCONF ,NULL ,"System doesn't have libaio support" ); +tst_brkm (TCONF ,NULL ,"test requires libaio and it's development packages" ); }#endif
testcases/kernel/syscalls/io_destroy/io_destroy01.c +7 -5
@@ -21,6 +21,9 @@/* Porting from Crackerjack to LTP is done by Masatake YAMATO <[email protected]> */ +#include <errno.h> +#include <string.h> +#include "config.h" #include "test.h"
@@ -28,10 +31,8 @@ char *TCID = "io_destroy01";int TST_TOTAL =1 ; -#ifdef HAVE_LIBAIO_H +#ifdef HAVE_LIBAIO #include <libaio.h> -#include <errno.h> -#include <string.h> static void cleanup (void ) {
@@ -99,9 +100,10 @@ int main(int argc, char *argv[])cleanup (); tst_exit(); } +#else -int main (int argc,char *argv[]) +int main (void ) { -tst_brkm (TCONF ,NULL ,"System doesn't support execution of the test" ); +tst_brkm (TCONF ,NULL ,"test requires libaio and it's development packages" ); }#endif
testcases/kernel/syscalls/io_getevents/io_getevents01.c +7 -6
@@ -21,17 +21,17 @@/* Porting from Crackerjack to LTP is done by Masatake YAMATO <[email protected]> */ +#include <errno.h> +#include <string.h> +#include "config.h" #include "test.h" char *TCID ="io_getevents01" ; -int TST_TOTAL =1 ; -#ifdef HAVE_LIBAIO_H +#ifdef HAVE_LIBAIO #include <libaio.h> -#include <errno.h> -#include <string.h> static void cleanup (void ) {
@@ -104,9 +104,10 @@ int main(int argc, char *argv[])cleanup (); tst_exit(); } +#else -int main (int argc,char *argv[]) +int main (void ) { -tst_brkm (TCONF ,NULL ,"System doesn't support execution of the test" ); +tst_brkm (TCONF ,NULL ,"test requires libaio and it's development packages" ); }#endif
testcases/kernel/syscalls/io_setup/io_setup01.c +7 -5
@@ -21,6 +21,9 @@/* Porting from Crackerjack to LTP is done by Masatake YAMATO <[email protected]> */ +#include <errno.h> +#include <string.h> +#include "config.h" #include "test.h"
@@ -28,10 +31,8 @@ char *TCID = "io_setup01";int TST_TOTAL =4 ; -#ifdef HAVE_LIBAIO_H +#ifdef HAVE_LIBAIO #include <libaio.h> -#include <errno.h> -#include <string.h> static void cleanup (void ) {
@@ -131,9 +132,10 @@ int main(int argc, char *argv[]) tst_exit(); } +#else -int main (int argc,char *argv[]) +int main (void ) { -tst_brkm (TCONF ,NULL ,"System doesn't support execution of the test" ); +tst_brkm (TCONF ,NULL ,"test requires libaio and it's development packages" ); }#endif
testcases/kernel/syscalls/io_submit/io_submit01.c +6 -5
@@ -20,14 +20,15 @@/* Porting from Crackerjack to LTP is done by Masatake YAMATO <[email protected]> */ +#include <errno.h> +#include <string.h> +#include <fcntl.h> +#include "config.h" #include "tst_test.h" -#ifdef HAVE_LIBAIO_H +#ifdef HAVE_LIBAIO #include <libaio.h> -#include <errno.h> -#include <string.h> -#include <fcntl.h> static io_context_t ctx;static io_context_t invalid_ctx;
@@ -139,5 +140,5 @@ static struct tst_test test = { };#else -TST_TEST_TCONF ("libaio.h was mission upon compilation" ); +TST_TEST_TCONF ("test requires libaio and it's development packages" );#endif
Signature · 1 line
2.14.2
PATCH v3 11/18 m4: Fix libaio detection on 32-bit cross build
Hi!
Quoted 23 lines
m4/ltp-eventfd.m4 +4
-5@@ -22,13 +22,12 @@ dnl dnl LTP_CHECK_SYSCALL_EVENTFD dnl ---------------------------- dnl -AC_DEFUN([LTP_CHECK_SYSCALL_EVENTFD], -[dnl +AC_DEFUN([LTP_CHECK_SYSCALL_EVENTFD], [ AH_TEMPLATE(HAVE_IO_SET_EVENTFD, [Define to 1 if you have the `io_set_eventfd' function.]) -AC_CHECK_HEADERS(libaio.h,[ - AC_CHECK_LIB(aio,io_setup,[ - AIO_LIBS="-laio" +AC_CHECK_HEADERS(libaio.h, [ + AC_CHECK_LIB(aio,io_setup, [ + have_aio=yes AC_MSG_CHECKING([io_set_eventfd is defined in aio library or aio header]) AC_TRY_LINK([#include <stdio.h> #include <libaio.h>
m4/ltp-eventfd.m4 AC_CHECK_HEADERS(libaio.h,[ · line 40
Quoted 6 lines
m4/ltp-eventfd.m4 +1
-2@@ -38,6 +37,10 @@ AC_CHECK_HEADERS(libaio.h,[ [AC_DEFINE(HAVE_IO_SET_EVENTFD) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])], - AIO_LIBS="")]) -AC_SUBST(AIO_LIBS) + have_aio=no)])
I guess that it would be a bit easier to read if there was less nested blocks in there.
What about we do the detection for AIO headers and numa libs separately, then if these two are tro set the AIO_LIBS and try the detection fro eventfd as well?
Something as:
if test "x$have_libaio" = "xyes" -a "x$have_aio" = "xyes"; then AC_DEFINE(HAVE_LIBAIO, ...) AC_SUBSTS(AIO_LIBS, ...) AC_TRY_LINK(... AC_DEFINE(HAVE_IO_SET_EVENTFD) ...) fi
Quoted 484 lines
m4/ltp-eventfd.m4 +5
-0+ +if test "x$have_aio" = "xyes"; then + AC_SUBST(AIO_LIBS, "-laio") + AC_DEFINE(HAVE_LIBAIO, 1, [Define whether libaio and it's headers are installed]) +fi ])testcases/kernel/io/aio/aio01/aio01.c +10
-13@@ -47,26 +47,26 @@#define _XOPEN_SOURCE 600 -#include "test.h" -#include "config.h" - -char *TCID ="aio01" ; -int TST_TOTAL =6 ; - -#ifdef HAVE_LIBAIO_H -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <time.h> #include <errno.h> -#include <libaio.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/time.h> #include <sys/resource.h> +#include "test.h" +#include "config.h" + +char *TCID ="aio01" ; +int TST_TOTAL =6 ; + +#ifdef HAVE_LIBAIO +#include <libaio.h> +static void help (void );static void setup (void );static void cleanup (void );@@ -413,14 +413,11 @@ static void cleanup(void)close (fd);io_queue_release (io_ctx); tst_rmdir(); - }#else -int main (void ) { -tst_brkm (TCONF ,NULL ,"libaio missing" ); +tst_brkm (TCONF ,NULL ,"test requires libaio and it's development packages" ); } -#endif testcases/kernel/io/aio/aio02/aio_tio.c +1
-2@@ -37,7 +37,7 @@#include <string.h> #include <errno.h> -#if HAVE_LIBAIO_H +#ifdef HAVE_LIBAIO #define AIO_MAXIO 32#define AIO_BLKSIZE (64*1024)@@ -237,5 +237,4 @@ int test_main(void) return status; } -#endif testcases/kernel/io/aio/aio02/main.c +4
-4@@ -6,16 +6,16 @@#include <sys/types.h> #include <sys/stat.h> #include <unistd.h> -#include "test.h" +#include "config.h" +#include "test.h" #define TEST_NAME "aio_tio"char *TCID ="aio02/" TEST_NAME ;int TST_TOTAL =0 ; -#if HAVE_LIBAIO_H - +#ifdef HAVE_LIBAIO #include <libaio.h> int test_main (void );@@ -32,6 +32,6 @@ int main(void)#else int main (void ) { -tst_brkm (TCONF ,NULL ,"libaio missing" ); +tst_brkm (TCONF ,NULL ,"test requires libaio and it's development packages" ); }#endif testcases/kernel/io/ltp-aiodio/aio-stress.c +13
-2@@ -50,19 +50,23 @@#include <errno.h> #include <assert.h> #include <stdlib.h> -#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <sys/time.h> -#include <libaio.h> #include <sys/ipc.h> #include <sys/shm.h> #include <sys/mman.h> #include <string.h> #include <pthread.h> +#include "config.h" +#include "tst_res_flags.h" + +#ifdef HAVE_LIBAIO +#include <libaio.h> +#define IO_FREE 0#define IO_PENDING 1#define RUN_FOREVER -1@@ -1557,3 +1561,10 @@ int main(int ac, char **av) }return status; } +#else +int main (void ) +{ +fprintf (stderr,"test requires libaio and it's development packages\n" ); +return TCONF ; +} +#endif testcases/kernel/io/ltp-aiodio/aiocp.c +2
-5@@ -38,8 +38,7 @@#include "config.h" #include "tst_res_flags.h" -#if HAVE_LIBAIO_H - +#ifdef HAVE_LIBAIO #include <libaio.h> #define AIO_BLKSIZE (64*1024)@@ -600,11 +599,9 @@ int main(int argc, char *const *argv)*/ #else -int main (void ) { -fprintf (stderr,"System doesn't have libaio support.\n" ); +fprintf (stderr,"test requires libaio and it's development packages\n" );return TCONF ; } -#endif testcases/kernel/io/ltp-aiodio/aiodio_append.c +12
-2@@ -32,10 +32,14 @@#include <fcntl.h> #include <unistd.h> -#include <libaio.h> - +#include "config.h" #include "test.h" +char *TCID ="aiodio_append" ; + +#ifdef HAVE_LIBAIO +#include <libaio.h> +#define NUM_CHILDREN 8#include "common_checkzero.h" @@ -174,3 +178,9 @@ int main(int argc, char **argv) return 0; } +#else +int main (void ) +{ +tst_brkm (TCONF ,NULL ,"test requires libaio and it's development packages" ); +} +#endif testcases/kernel/io/ltp-aiodio/aiodio_sparse.c +14
-4@@ -35,11 +35,17 @@#include <limits.h> #include <getopt.h> -#include <libaio.h> +#include "config.h" #include "test.h" #include "safe_macros.h" +char *TCID ="aiodio_sparse" ; +int TST_TOTAL =1 ; + +#ifdef HAVE_LIBAIO +#include <libaio.h> +#define NUM_CHILDREN 1000int debug;@@ -49,9 +55,6 @@ static void setup(void);static void cleanup (void );static void usage (void ); -char *TCID ="aiodio_sparse" ; -int TST_TOTAL =1 ; -#include "common_sparse.h" /* @@ -325,3 +328,10 @@ static void cleanup(void) tst_rmdir(); } + +#else +int main (void ) +{ +tst_brkm (TCONF ,NULL ,"test requires libaio and it's development packages" ); +} +#endif testcases/kernel/syscalls/eventfd/eventfd01.c +11
-5@@ -61,15 +61,14 @@#define CLEANUP cleanup#include "lapi/syscalls.h" -#ifdef HAVE_LIBAIO_H +TCID_DEFINE (eventfd01); +int TST_TOTAL =15 ; + +#ifdef HAVE_LIBAIO #include <libaio.h> -#endif static void setup (void ); -TCID_DEFINE (eventfd01); -int TST_TOTAL =15 ; -static int myeventfd (unsigned int initval,int flags) {/* eventfd2 uses FLAGS but eventfd doesn't take FLAGS. */ @@ -727,3 +726,10 @@ static void cleanup(void) {tst_rmdir (); } + +#else +int main (void ) +{ +tst_brkm (TCONF ,NULL ,"test requires libaio and it's development packages" ); +} +#endif testcases/kernel/syscalls/io_cancel/io_cancel01.c +7
-5@@ -21,6 +21,9 @@/* Porting from Crackerjack to LTP is done by Masatake YAMATO <[email protected]> */ +#include <errno.h> +#include <string.h> +#include "config.h" #include "test.h" @@ -28,10 +31,8 @@ char *TCID = "io_cancel01";int TST_TOTAL =1 ; -#ifdef HAVE_LIBAIO_H +#ifdef HAVE_LIBAIO #include <libaio.h> -#include <errno.h> -#include <string.h> static void cleanup (void ) {@@ -105,9 +106,10 @@ int main(int argc, char *argv[])cleanup (); tst_exit(); } +#else -int main (int argc,char *argv[]) +int main (void ) { -tst_brkm (TCONF ,NULL ,"System doesn't have libaio support" ); +tst_brkm (TCONF ,NULL ,"test requires libaio and it's development packages" ); }#endif testcases/kernel/syscalls/io_destroy/io_destroy01.c +7
-5@@ -21,6 +21,9 @@/* Porting from Crackerjack to LTP is done by Masatake YAMATO <[email protected]> */ +#include <errno.h> +#include <string.h> +#include "config.h" #include "test.h" @@ -28,10 +31,8 @@ char *TCID = "io_destroy01";int TST_TOTAL =1 ; -#ifdef HAVE_LIBAIO_H +#ifdef HAVE_LIBAIO #include <libaio.h> -#include <errno.h> -#include <string.h> static void cleanup (void ) {@@ -99,9 +100,10 @@ int main(int argc, char *argv[])cleanup (); tst_exit(); } +#else -int main (int argc,char *argv[]) +int main (void ) { -tst_brkm (TCONF ,NULL ,"System doesn't support execution of the test" ); +tst_brkm (TCONF ,NULL ,"test requires libaio and it's development packages" ); }#endif testcases/kernel/syscalls/io_getevents/io_getevents01.c +7
-6@@ -21,17 +21,17 @@/* Porting from Crackerjack to LTP is done by Masatake YAMATO <[email protected]> */ +#include <errno.h> +#include <string.h> +#include "config.h" #include "test.h" char *TCID ="io_getevents01" ; -int TST_TOTAL =1 ; -#ifdef HAVE_LIBAIO_H +#ifdef HAVE_LIBAIO #include <libaio.h> -#include <errno.h> -#include <string.h> static void cleanup (void ) {@@ -104,9 +104,10 @@ int main(int argc, char *argv[])cleanup (); tst_exit(); } +#else -int main (int argc,char *argv[]) +int main (void ) { -tst_brkm (TCONF ,NULL ,"System doesn't support execution of the test" ); +tst_brkm (TCONF ,NULL ,"test requires libaio and it's development packages" ); }#endif testcases/kernel/syscalls/io_setup/io_setup01.c +7
-5@@ -21,6 +21,9 @@/* Porting from Crackerjack to LTP is done by Masatake YAMATO <[email protected]> */ +#include <errno.h> +#include <string.h> +#include "config.h" #include "test.h" @@ -28,10 +31,8 @@ char *TCID = "io_setup01";int TST_TOTAL =4 ; -#ifdef HAVE_LIBAIO_H +#ifdef HAVE_LIBAIO #include <libaio.h> -#include <errno.h> -#include <string.h> static void cleanup (void ) {@@ -131,9 +132,10 @@ int main(int argc, char *argv[]) tst_exit(); } +#else -int main (int argc,char *argv[]) +int main (void ) { -tst_brkm (TCONF ,NULL ,"System doesn't support execution of the test" ); +tst_brkm (TCONF ,NULL ,"test requires libaio and it's development packages" ); }#endif testcases/kernel/syscalls/io_submit/io_submit01.c +6
-5@@ -20,14 +20,15 @@/* Porting from Crackerjack to LTP is done by Masatake YAMATO <[email protected]> */ +#include <errno.h> +#include <string.h> +#include <fcntl.h> +#include "config.h" #include "tst_test.h" -#ifdef HAVE_LIBAIO_H +#ifdef HAVE_LIBAIO #include <libaio.h> -#include <errno.h> -#include <string.h> -#include <fcntl.h> static io_context_t ctx;static io_context_t invalid_ctx;@@ -139,5 +140,5 @@ static struct tst_test test = { };#else -TST_TEST_TCONF ("libaio.h was mission upon compilation" ); +TST_TEST_TCONF ("test requires libaio and it's development packages" );#endif Signature · 5 lines
2.14.2 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v3 12/18 make: Remove workarounds for build without libnuma
In reply to Petr Vorel--- 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(-)
testcases/kernel/syscalls/mbind/Makefile +0 -9
@@ -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
testcases/kernel/syscalls/migrate_pages/Makefile +0 -3
@@ -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
testcases/kernel/syscalls/move_pages/Makefile +0 -5
@@ -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
Signature · 1 line
2.14.2
PATCH v3 13/18 numa: Drop NUMA API v1 support
In reply to Petr VorelNOTE: there still some code using v1 API (thus flag -DNUMA_VERSION1_COMPATIBILITY is needed)
--- .../cpuset_syscall_test/cpuset_syscall_test.c | 4 +-- testcases/kernel/hotplug/memory_hotplug/commands.c | 12 +------ testcases/kernel/lib/numa_helper.c | 15 ++------- testcases/kernel/mem/vma/vma02.c | 13 +++----- testcases/kernel/mem/vma/vma04.c | 12 ++----- .../syscalls/get_mempolicy/get_mempolicy01.c | 38 ++-------------------- 6 files changed, 14 insertions(+), 80 deletions(-)
testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_test.c +2 -2
@@ -51,8 +51,8 @@char *TCID ="cpuset_syscall_test" ;int TST_TOTAL =1 ; -#if HAVE_NUMA_H &&HAVE_LINUX_MEMPOLICY_H &&HAVE_NUMAIF_H \ - &&HAVE_MPOL_CONSTANTS +#if HAVE_NUMA_H &&HAVE_LINUX_MEMPOLICY_H &&HAVE_NUMAIF_H &&HAVE_MPOL_CONSTANTS \ + && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 #include "../cpuset_lib/cpuset.h" #include "../cpuset_lib/bitmask.h"
testcases/kernel/hotplug/memory_hotplug/commands.c +1 -11
@@ -29,7 +29,7 @@*/ #include "config.h" -#if HAVE_NUMA_H &&HAVE_NUMAIF_H &&HAVE_LINUX_MEMPOLICY_H +#if HAVE_NUMA_H &&HAVE_LINUX_MEMPOLICY_H &&HAVE_NUMAIF_H #include <linux/mempolicy.h> #include <sys/types.h> #include <sys/time.h>
@@ -59,7 +59,6 @@#define MPOL_MF_WAIT (1<<2)/* Wait for existing pages to migrate */ #endif -#if defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION ==2 static inline int nodemask_isset (nodemask_t * mask,int node) {if ((unsigned )node >=NUMA_NUM_NODES )
@@ -75,7 +74,6 @@ static inline void nodemask_set(nodemask_t * mask, int node) mask->n[node / (8 *sizeof (unsigned long ))] |= (1UL << (node % (8 *sizeof (unsigned long )))); } -#endif static char *whitespace =" \t" ;
@@ -385,11 +383,7 @@ static int get_arg_nodeid_list(char *args, unsigned int *list)int node, count =0 ; gcp = &glctx; -#if defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION ==2 my_allowed_nodes =numa_get_membind_compat (); -#else - my_allowed_nodes =numa_get_membind (); -#endif while (*args !='\0' ) {if (!isdigit (*args)) { fprintf(stderr, "%s: expected digit for <node/list>\n",
@@ -447,11 +441,7 @@ static int get_current_nodeid_list(unsigned int *fromids)int node; gcp = &glctx; -#if defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION ==2 my_allowed_nodes =numa_get_membind_compat (); -#else - my_allowed_nodes =numa_get_membind (); -#endif for (node =0 ; node <= max_node; ++node) {if (nodemask_isset (&my_allowed_nodes, node)) *(fromids + nr_nodes++) = node;
testcases/kernel/lib/numa_helper.c +2 -13
@@ -39,20 +39,9 @@unsigned long get_max_node (void ) {unsigned long max_node =0 ; -#if HAVE_NUMA_H -#if !defined(LIBNUMA_API_VERSION ) ||LIBNUMA_API_VERSION <2 - max_node =NUMA_NUM_NODES ; -/* -* NUMA_NUM_NODES is not reliable, libnuma >=2 is looking -* at /proc/self/status to figure out correct number. -* If buffer is not large enough get_mempolicy will fail with EINVAL. -*/ -if (max_node <1024 ) - max_node =1024 ; -#else +#if HAVE_NUMA_H && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 max_node =numa_max_possible_node () +1 ;#endif -#endif /* HAVE_NUMA_H */ return max_node; }
@@ -209,7 +198,7 @@ int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes) } }while (0 );free (nodemask); -#endif +#endif /* HAVE_NUMA_H */ return ret; }
testcases/kernel/mem/vma/vma02.c +4 -9
@@ -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_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,12 +163,7 @@ 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 */ int main (void ) {
testcases/kernel/mem/vma/vma04.c +3 -9
@@ -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_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,12 +325,6 @@ 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 */ int main (void ) {
testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c +2 -36
@@ -66,7 +66,8 @@char *TCID ="get_mempolicy01" ;int TST_TOTAL =1 ; -#if HAVE_NUMA_H &&HAVE_NUMAIF_H &&HAVE_MPOL_CONSTANTS +#if HAVE_NUMA_H &&HAVE_NUMAIF_H &&HAVE_MPOL_CONSTANTS && \ + defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 #define MEM_LENGTH (4 * 1024 * 1024)
@@ -221,13 +222,8 @@ static int do_test(struct test_case *tc) {int ret, err, result, cmp_ok;int policy, flags; -#if !defined(LIBNUMA_API_VERSION ) ||LIBNUMA_API_VERSION <2 -nodemask_t *nodemask, *getnodemask; -unsigned long maxnode =NUMA_NUM_NODES ; -#else struct bitmask *nodemask =numa_allocate_nodemask ();struct bitmask *getnodemask =numa_allocate_nodemask (); -#endif char *p =NULL ;unsigned long len =MEM_LENGTH ;int test_node =-1 ;
@@ -235,15 +231,7 @@ static int do_test(struct test_case *tc) ret =get_allowed_nodes (NH_MEMS ,1 , &test_node);if (ret <0 )tst_brkm (TBROK |TERRNO , cleanup,"get_allowed_nodes: %d" , ret); -#if !defined(LIBNUMA_API_VERSION ) ||LIBNUMA_API_VERSION <2 - nodemask =malloc (sizeof (nodemask_t)); -nodemask_zero (nodemask); -nodemask_set (nodemask, test_node); - getnodemask =malloc (sizeof (nodemask_t)); -nodemask_zero (getnodemask); -#else numa_bitmask_setbit (nodemask, test_node); -#endif switch (tc->ttype) {case DEFAULT : flags =0 ;
@@ -252,13 +240,8 @@ static int do_test(struct test_case *tc)TEST (ltp_syscall (__NR_set_mempolicy, tc->policy,NULL ,0 )); else -#if !defined(LIBNUMA_API_VERSION ) ||LIBNUMA_API_VERSION <2 -TEST (ltp_syscall (__NR_set_mempolicy, tc->policy, - nodemask, maxnode)); -#else TEST(ltp_syscall(__NR_set_mempolicy, tc->policy, nodemask->maskp, nodemask->size)); -#endif if (TEST_RETURN <0 ) {tst_resm (TBROK |TERRNO ,"set_mempolicy" );return -1 ;
@@ -275,13 +258,8 @@ static int do_test(struct test_case *tc)TEST (ltp_syscall (__NR_mbind, p, len, tc->policy,NULL ,0 ,0 )); else -#if !defined(LIBNUMA_API_VERSION ) ||LIBNUMA_API_VERSION <2 -TEST (ltp_syscall (__NR_mbind, p, len, tc->policy, - nodemask, maxnode,0 )); -#else TEST(ltp_syscall(__NR_mbind, p, len, tc->policy, nodemask->maskp, nodemask->size, 0)); -#endif if (TEST_RETURN <0 ) {tst_resm (TBROK |TERRNO ,"mbind" );return -1 ;
@@ -299,30 +277,18 @@ static int do_test(struct test_case *tc) } errno =0 ; cmp_ok =1 ; -#if !defined(LIBNUMA_API_VERSION ) ||LIBNUMA_API_VERSION <2 -TEST (ret =ltp_syscall (__NR_get_mempolicy, &policy, getnodemask, - maxnode, p, flags)); -#else TEST (ret =ltp_syscall (__NR_get_mempolicy, &policy, getnodemask->maskp, getnodemask->size, p, flags)); -#endif err =TEST_ERRNO ;if (ret <0 ) goto TEST_END;/* if policy == MPOL_DEFAULT, get_mempolicy doesn't return nodemask */ if (tc->policy ==MPOL_DEFAULT ) -#if !defined(LIBNUMA_API_VERSION ) ||LIBNUMA_API_VERSION <2 -nodemask_zero (nodemask); - cmp_ok = (tc->policy == policy && (tc->from_node ==NONE || -nodemask_equal (nodemask, - getnodemask))); -#else numa_bitmask_clearall (nodemask); cmp_ok = (tc->policy == policy && (tc->from_node ==NONE ||numa_bitmask_equal (nodemask, getnodemask))); -#endif TEST_END: result = (err != tc->err) || !cmp_ok;PRINT_RESULT_CMP (0 , tc->ret, tc->err, ret, err, cmp_ok);
Signature · 1 line
2.14.2
PATCH v3 14/18 numa: Drop NUMA_CPPFLAGS
In reply to Petr Voreland remove most -DNUMA_VERSION1_COMPATIBILITY flags. The place which requires it (e.g. using legacy code) is testcases/kernel/lib/commands.c.
--- include/mk/config.mk.default | 1 - include/mk/config.mk.in | 1 - m4/ltp-numa.m4 | 9 ++------- testcases/kernel/controllers/cpuset/cpuset_syscall_test/Makefile | 1 - testcases/kernel/include/lib.mk | 2 +- testcases/kernel/lib/Makefile | 3 ++- testcases/kernel/numa/Makefile | 2 +- 7 files changed, 6 insertions(+), 13 deletions(-)
include/mk/config.mk.default +0 -1
@@ -39,7 +39,6 @@ YACC := bison -y #ACL_LIBS := -lacl #CRYPTO_LIBS := -lcrypto #LEXLIB := -lfl -#NUMA_CPPFLAGS := -DNUMA_VERSION1_COMPATIBILITY #NUMA_LIBS := -lnuma #SELINUX_LIBS := -lselinux #TIRPC_CPPFLAGS := -I/usr/include/tirpc
include/mk/config.mk.in +0 -1
@@ -41,7 +41,6 @@ CAP_LIBS := @CAP_LIBS@ ACL_LIBS := @ACL_LIBS@ CRYPTO_LIBS := @CRYPTO_LIBS@ LEXLIB := @LEXLIB@ -NUMA_CPPFLAGS := @NUMA_CPPFLAGS@ NUMA_LIBS := @NUMA_LIBS@ SELINUX_LIBS := @SELINUX_LIBS@ TIRPC_CPPFLAGS := @TIRPC_CPPFLAGS@
m4/ltp-numa.m4 +2 -7
@@ -22,8 +22,7 @@ dnl dnl LTP_CHECK_SYSCALL_NUMA dnl ---------------------------- dnl -AC_DEFUN([LTP_CHECK_SYSCALL_NUMA], -[dnl +AC_DEFUN([LTP_CHECK_SYSCALL_NUMA], [ 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"])
@@ -35,14 +34,10 @@ AC_CHECK_HEADERS([linux/mempolicy.h numa.h numaif.h],[ AC_DEFINE(HAVE_NUMA_MOVE_PAGES,1,[define to 1 if you have 'numa_move_pages' function]) fi ] - AC_CHECK_LIB(numa,numa_available,[ -NUMA_CPPFLAGS="-DNUMA_VERSION1_COMPATIBILITY" -NUMA_LIBS="-lnuma" - ]) + AC_CHECK_LIB(numa,numa_available,[NUMA_LIBS="-lnuma"]) dnl For testcases/kernel/controllers/cpuset, testcases/kernel/syscalls/get_mempolicy, dnl testcases/kernel/syscalls/mbind AC_CHECK_DECLS([MPOL_BIND, MPOL_DEFAULT, MPOL_F_ADDR, MPOL_F_MEMS_ALLOWED, MPOL_F_NODE, MPOL_INTERLEAVE, MPOL_PREFERRED],[have_mpol_constants="yes"],,[#include <numaif.h>]) -AC_SUBST(NUMA_CPPFLAGS) AC_SUBST(NUMA_LIBS) if test "x$have_mpol_constants" = "xyes"; then AC_DEFINE(HAVE_MPOL_CONSTANTS,1,[define to 1 if you have all constants required to use mbind tests])
testcases/kernel/controllers/cpuset/cpuset_syscall_test/Makefile +0 -1
@@ -26,7 +26,6 @@ include $(top_srcdir)/include/mk/testcases.mk include $(abs_srcdir)/../Makefile.inc LDLIBS += $(NUMA_LIBS) -CPPFLAGS += $(NUMA_CPPFLAGS) include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/include/lib.mk +1 -1
@@ -22,7 +22,7 @@ LIBKERNTEST_SRCDIR := $(KERNEL_SRCDIR)/lib KERNEL_DIR := $(abs_top_builddir)/testcases/kernel LIBKERNTEST_DIR := $(KERNEL_DIR)/lib LIBKERNTEST := $(LIBKERNTEST_DIR)/libkerntest.a -CPPFLAGS += $(NUMA_CPPFLAGS) -I$(KERNEL_SRCDIR)/include +CPPFLAGS += -I$(KERNEL_SRCDIR)/include LDLIBS += -lkerntest -lltp $(NUMA_LIBS) LDFLAGS += -L$(LIBKERNTEST_DIR)
testcases/kernel/lib/Makefile +2 -1
@@ -22,7 +22,8 @@ top_srcdir ?= ../../.. include $(top_srcdir)/include/mk/env_pre.mk -CPPFLAGS += $(NUMA_CPPFLAGS) -I$(abs_srcdir)/../include \ +CPPFLAGS += -DNUMA_VERSION1_COMPATIBILITY \ + -I$(abs_srcdir)/../include \ -I$(abs_builddir)/../include INTERNAL_LIB := libkerntest.a
testcases/kernel/numa/Makefile +1 -1
@@ -20,7 +20,7 @@ top_srcdir := ../../.. include $(top_srcdir)/include/mk/testcases.mk -CPPFLAGS += -D_GNU_SOURCE -DNUMA_VERSION1_COMPATIBILITY +CPPFLAGS += -D_GNU_SOURCE LDLIBS += $(NUMA_LIBS)
Signature · 1 line
2.14.2
PATCH v3 15/18 hotplug/memory_hotplug: Update TODO
In reply to Petr Vorel_NEED_MIGRATE_PAGES definition was removed in commit 5ed9ed059 ("Address the issue reported in the following email by installing all .c files.")
--- testcases/kernel/hotplug/memory_hotplug/TODO | 5 ----- 1 file changed, 5 deletions(-)
testcases/kernel/hotplug/memory_hotplug/TODO +0 -5
@@ -1,12 +1,7 @@ memtoy: -if migrate_pages(2) system call ever becomes standard, will need to change -Makefile not to build and link against migrate_pages.o and not to define -_NEED_MIGRATE_PAGES. - More documentation? - Desired features? + verify contents after migration?
Signature · 1 line
2.14.2
PATCH v3 16/18 hotplug/memory_hotplug: Remove unused header
In reply to Petr Vorel--- testcases/kernel/hotplug/memory_hotplug/commands.c | 1 - 1 file changed, 1 deletion(-)
testcases/kernel/hotplug/memory_hotplug/commands.c +0 -1
@@ -30,7 +30,6 @@#include "config.h" #if HAVE_NUMA_H &&HAVE_LINUX_MEMPOLICY_H &&HAVE_NUMAIF_H -#include <linux/mempolicy.h> #include <sys/types.h> #include <sys/time.h> #include <sys/mman.h>
Signature · 1 line
2.14.2
PATCH v3 17/18 hotplug/memory_hotplug: Exit with TCONF when NUMA headers not available
In reply to Petr Vorel--- testcases/kernel/hotplug/memory_hotplug/memtoy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
testcases/kernel/hotplug/memory_hotplug/memtoy.c +3 -1
@@ -24,6 +24,8 @@#include <stdio.h> #include "config.h" +#include "tst_res_flags.h" +/* Shortcut because the test requires numa and mempolicy support. */ #if HAVE_NUMA_H &&HAVE_NUMAIF_H &&HAVE_LINUX_MEMPOLICY_H #include <sys/types.h>
@@ -495,6 +497,6 @@ int main(int argc, char *argv[])int main (void ) {printf ("System doesn't have required numa support.\n" ); -return 0 ; +return TCONF ; }#endif /* HAVE_NUMA_H && HAVE_NUMAIF_H */
Signature · 1 line
2.14.2
PATCH v3 18/18 m4, kernel/lib: Detect libnuma presence in kernel libs
In reply to Petr VorelThis fixes link problems when NUMA headers are available but libnuma not (e.g. on 32-bit cross build).
Dropped HAVE_MPOL_CONSTANTS definition as with dropping NUMA API v1 are these constans allways available.
TODO:
* HAVE_LIBNUMA && HAVE_NUMA_H into one in m4
* remove HAVE_MPOL_CONSTANTS
--- m4/ltp-numa.m4 | 40 +++++++++++----------- .../controllers/cpuset/cpuset_lib/libcpuset.c | 1 + .../cpuset_syscall_test/cpuset_syscall_test.c | 5 ++- testcases/kernel/hotplug/memory_hotplug/commands.c | 6 +++- testcases/kernel/hotplug/memory_hotplug/memtoy.c | 13 ++++--- testcases/kernel/hotplug/memory_hotplug/segment.c | 6 +++- testcases/kernel/include/numa_helper.h | 2 +- testcases/kernel/lib/numa_helper.c | 14 ++++---- testcases/kernel/mem/cpuset/cpuset01.c | 8 +++-- testcases/kernel/mem/ksm/ksm02.c | 9 +++-- testcases/kernel/mem/ksm/ksm04.c | 9 +++-- testcases/kernel/mem/ksm/ksm06.c | 12 ++++--- testcases/kernel/mem/lib/mem.c | 13 ++++--- testcases/kernel/mem/oom/oom02.c | 9 +++-- testcases/kernel/mem/oom/oom03.c | 10 ++++-- testcases/kernel/mem/oom/oom04.c | 9 +++-- testcases/kernel/mem/oom/oom05.c | 9 +++-- testcases/kernel/mem/vma/vma02.c | 5 ++- testcases/kernel/mem/vma/vma04.c | 5 ++- .../syscalls/get_mempolicy/get_mempolicy01.c | 7 ++-- testcases/kernel/syscalls/mbind/mbind01.c | 9 +++-- .../syscalls/migrate_pages/migrate_pages01.c | 8 +++-- .../syscalls/migrate_pages/migrate_pages02.c | 9 +++-- .../syscalls/move_pages/move_pages_support.c | 14 ++++---- 24 files changed, 137 insertions(+), 95 deletions(-)
m4/ltp-numa.m4 +20 -20
@@ -23,23 +23,23 @@ dnl LTP_CHECK_SYSCALL_NUMA dnl ---------------------------- dnl AC_DEFUN([LTP_CHECK_SYSCALL_NUMA], [ -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"]) - if test "x$have_numa_alloc_onnode" = "xyes"; then - AC_DEFINE(HAVE_NUMA_ALLOC_ONNODE,1,[define to 1 if you have 'numa_alloc_onnode' function]) - fi - AC_CHECK_LIB(numa,numa_move_pages,[have_numa_move_pages="yes"]) - if test "x$have_numa_move_pages" = "xyes"; then - AC_DEFINE(HAVE_NUMA_MOVE_PAGES,1,[define to 1 if you have 'numa_move_pages' function]) - fi -] - AC_CHECK_LIB(numa,numa_available,[NUMA_LIBS="-lnuma"]) -dnl For testcases/kernel/controllers/cpuset, testcases/kernel/syscalls/get_mempolicy, -dnl testcases/kernel/syscalls/mbind -AC_CHECK_DECLS([MPOL_BIND, MPOL_DEFAULT, MPOL_F_ADDR, MPOL_F_MEMS_ALLOWED, MPOL_F_NODE, MPOL_INTERLEAVE, MPOL_PREFERRED],[have_mpol_constants="yes"],,[#include <numaif.h>]) -AC_SUBST(NUMA_LIBS) -if test "x$have_mpol_constants" = "xyes"; then - AC_DEFINE(HAVE_MPOL_CONSTANTS,1,[define to 1 if you have all constants required to use mbind tests]) -fi -)]) + AC_CHECK_LIB(numa, numa_available, [ + AC_SUBST(NUMA_LIBS, "-lnuma") + AC_CHECK_HEADERS([numa.h numaif.h], [ + AC_DEFINE(HAVE_LIBNUMA, 1, [Define to 1 if you have libnuma and it's headers installed]) + ]) + AC_CHECK_HEADERS([numa.h numaif.h linux/mempolicy.h], [ + AC_CHECK_LIB(numa, numa_alloc_onnode, [ + AC_DEFINE(HAVE_NUMA_ALLOC_ONNODE, 1, [Define to 1 if you have 'numa_alloc_onnode' function]) + ]) + + AC_CHECK_LIB(numa, numa_move_pages, [ + AC_DEFINE(HAVE_NUMA_MOVE_PAGES, 1, [Define to 1 if you have 'numa_move_pages' function]) + ]) + ]) + ]) + + AC_CHECK_DECLS([MPOL_BIND, MPOL_DEFAULT, MPOL_F_ADDR, MPOL_F_MEMS_ALLOWED, MPOL_F_NODE, MPOL_INTERLEAVE, MPOL_PREFERRED], [ + AC_DEFINE(HAVE_MPOL_CONSTANTS, 1, [Define to 1 if you have all constants required to use mbind tests]) + ], , [#include <numaif.h>]) +])
testcases/kernel/controllers/cpuset/cpuset_lib/libcpuset.c +1 -0
@@ -50,6 +50,7 @@#include "test.h" #include "lapi/syscalls.h" #include "config.h" +#if HAVE_LINUX_MEMPOLICY_H #include <linux/mempolicy.h>
testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_test.c +2 -3
@@ -51,8 +51,7 @@char *TCID ="cpuset_syscall_test" ;int TST_TOTAL =1 ; -#if HAVE_NUMA_H &&HAVE_LINUX_MEMPOLICY_H &&HAVE_NUMAIF_H &&HAVE_MPOL_CONSTANTS \ - && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 #include "../cpuset_lib/cpuset.h" #include "../cpuset_lib/bitmask.h"
@@ -243,6 +242,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 and it's development packages" ); }#endif
testcases/kernel/hotplug/memory_hotplug/commands.c +5 -1
@@ -29,7 +29,11 @@*/ #include "config.h" -#if HAVE_NUMA_H &&HAVE_LINUX_MEMPOLICY_H &&HAVE_NUMAIF_H +#if HAVE_NUMA_H +#include <numa.h> +#endif + +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 #include <sys/types.h> #include <sys/time.h> #include <sys/mman.h>
testcases/kernel/hotplug/memory_hotplug/memtoy.c +8 -5
@@ -23,11 +23,14 @@*/ #include <stdio.h> +#include "config.h" #include "tst_res_flags.h" +#if HAVE_NUMA_H +#include <numa.h> +#endif -/* Shortcut because the test requires numa and mempolicy support. */ -#if HAVE_NUMA_H &&HAVE_NUMAIF_H &&HAVE_LINUX_MEMPOLICY_H +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 #include <sys/types.h> #include <sys/time.h> #include <sys/mman.h>
@@ -493,10 +496,10 @@ int main(int argc, char *argv[]) return 0; } -#else /* ! (HAVE_NUMA_H && HAVE_NUMAIF_H) */ +#else int main (void ) { -printf ("System doesn't have required numa support.\n" ); +fprintf (stderr,"test requires libnuma >= 2 and it's development packages\n" );return TCONF ; } -#endif /* HAVE_NUMA_H && HAVE_NUMAIF_H */ +#endif
testcases/kernel/hotplug/memory_hotplug/segment.c +5 -1
@@ -28,7 +28,11 @@*/ #include "config.h" -#if HAVE_NUMA_H &&HAVE_NUMAIF_H &&HAVE_LINUX_MEMPOLICY_H +#if HAVE_NUMA_H +#include <numa.h> +#endif + +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 #include <sys/types.h> #include <sys/ipc.h> #include <sys/mman.h>
testcases/kernel/include/numa_helper.h +1 -1
@@ -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 */
testcases/kernel/lib/numa_helper.c +7 -7
@@ -39,13 +39,13 @@unsigned long get_max_node (void ) {unsigned long max_node =0 ; -#if HAVE_NUMA_H && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 max_node =numa_max_possible_node () +1 ;#endif return max_node; } -#if HAVE_NUMA_H +#ifdef HAVE_LIBNUMA static void get_nodemask_allnodes (nodemask_t * nodemask,unsigned long max_node) {unsigned long nodemask_size = max_node /8 ;
@@ -63,7 +63,7 @@ static void get_nodemask_allnodes(nodemask_t * nodemask, unsigned long max_node)static int filter_nodemask_mem (nodemask_t * nodemask,unsigned long max_node) { -#if MPOL_F_MEMS_ALLOWED +#ifdef MPOL_F_MEMS_ALLOWED unsigned long nodemask_size = max_node /8 ;memset (nodemask,0 , nodemask_size);/*
@@ -134,7 +134,7 @@ static void filter_nodemask_cpu(nodemask_t * nodemask, unsigned long max_node) }free (cpumask); } -#endif /* HAVE_NUMA_H */ +#endif /* HAVE_LIBNUMA */ /* * get_allowed_nodes_arr - get number and array of available nodes
@@ -152,7 +152,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 int i;nodemask_t *nodemask =NULL ;#endif
@@ -160,7 +160,7 @@ int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes)if (nodes) *nodes =NULL ; -#if HAVE_NUMA_H +#if HAVE_LIBNUMA unsigned long max_node, nodemask_size;if (numa_available () ==-1 )
@@ -198,7 +198,7 @@ int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes) } }while (0 );free (nodemask); -#endif /* HAVE_NUMA_H */ +#endif /* HAVE_LIBNUMA */ return ret; }
testcases/kernel/mem/cpuset/cpuset01.c +5 -3
@@ -23,6 +23,9 @@#include "config.h" #include <stdio.h> #include <sys/wait.h> +#if HAVE_NUMA_H +#include <numa.h> +#endif #if HAVE_NUMAIF_H #include <numaif.h> #endif
@@ -30,8 +33,7 @@#include "mem.h" #include "numa_helper.h" -#if HAVE_NUMA_H &&HAVE_LINUX_MEMPOLICY_H &&HAVE_NUMAIF_H \ - &&HAVE_MPOL_CONSTANTS +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 volatile int end;static int *nodes;static int nnodes;
@@ -187,5 +189,5 @@ static struct tst_test test = { };#else /* no NUMA */ -TST_TEST_TCONF ("no NUMA development packages installed." ); +TST_TEST_TCONF ("test requires libnuma >= 2 and it's development packages" );#endif
testcases/kernel/mem/ksm/ksm02.c +6 -3
@@ -50,6 +50,9 @@#include <sys/stat.h> #include <errno.h> #include <fcntl.h> +#if HAVE_NUMA_H +#include <numa.h> +#endif #if HAVE_NUMAIF_H #include <numaif.h> #endif
@@ -59,8 +62,8 @@#include "mem.h" #include "ksm_common.h" -#if HAVE_NUMA_H &&HAVE_LINUX_MEMPOLICY_H &&HAVE_NUMAIF_H \ - &&HAVE_MPOL_CONSTANTS +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 \ + &&HAVE_LINUX_MEMPOLICY_H static void verify_ksm (void ) {
@@ -122,5 +125,5 @@ static struct tst_test test = { };#else /* no NUMA */ -TST_TEST_TCONF ("no NUMA development packages installed." ); +TST_TEST_TCONF ("test requires libnuma >= 2 and it's development packages" );#endif
testcases/kernel/mem/ksm/ksm04.c +6 -3
@@ -50,6 +50,9 @@#include <sys/stat.h> #include <errno.h> #include <fcntl.h> +#if HAVE_NUMA_H +#include <numa.h> +#endif #if HAVE_NUMAIF_H #include <numaif.h> #endif
@@ -59,8 +62,8 @@#include "mem.h" #include "ksm_common.h" -#if HAVE_NUMA_H &&HAVE_LINUX_MEMPOLICY_H &&HAVE_NUMAIF_H \ - &&HAVE_MPOL_CONSTANTS +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 \ + &&HAVE_LINUX_MEMPOLICY_H static void verify_ksm (void ) {
@@ -126,5 +129,5 @@ static struct tst_test test = { };#else /* no NUMA */ -TST_TEST_TCONF ("no NUMA development packages installed." ); +TST_TEST_TCONF ("test requires libnuma >= 2 and it's development packages" );#endif
testcases/kernel/mem/ksm/ksm06.c +8 -4
@@ -28,6 +28,9 @@#include <limits.h> #include <errno.h> #include <fcntl.h> +#if HAVE_NUMA_H +#include <numa.h> +#endif #if HAVE_NUMAIF_H #include <numaif.h> #endif
@@ -35,11 +38,12 @@#include <stdio.h> #include <unistd.h> #include <limits.h> -#include "numa_helper.h" +#include "mem.h" +#include "numa_helper.h" -#if HAVE_NUMA_H &&HAVE_LINUX_MEMPOLICY_H &&HAVE_NUMAIF_H \ - &&HAVE_MPOL_CONSTANTS +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 \ + &&HAVE_LINUX_MEMPOLICY_H static int run =-1 ;static int sleep_millisecs =-1 ;
@@ -106,5 +110,5 @@ static struct tst_test test = { };#else /* no NUMA */ -TST_TEST_TCONF ("no NUMA development packages installed." ); +TST_TEST_TCONF ("test requires libnuma >= 2 and it's development packages" );#endif
testcases/kernel/mem/lib/mem.c +6 -7
@@ -162,10 +162,9 @@ void oom(int testcase, int lite, int retcode, int allow_sigkill) } } +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 static void set_global_mempolicy (int mempolicy) { -#if 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;int ret;
@@ -203,8 +202,10 @@ static void set_global_mempolicy(int mempolicy)if (set_mempolicy (mempolicy, nmask,MAXNODES ) ==-1 ) tst_brk(TBROK|TERRNO, "set_mempolicy"); } -#endif } +#else +static void set_global_mempolicy(int mempolicy LTP_ATTRIBUTE_UNUSED) { } +#endif void testoom (int mempolicy,int lite,int retcode,int allow_sigkill) {
@@ -562,8 +563,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 \ - &&HAVE_MPOL_CONSTANTS +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 unsigned long nmask[MAXNODES /BITS_PER_LONG ] = {0 };#endif
@@ -588,8 +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 \ - &&HAVE_MPOL_CONSTANTS +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 clean_node (nmask);set_node (nmask, nodes[i]);/*
testcases/kernel/mem/oom/oom02.c +6 -3
@@ -26,11 +26,14 @@#include <errno.h> #include <fcntl.h> #include <stdio.h> +#if HAVE_NUMA_H +#include <numa.h> +#endif +#include "numa_helper.h" #include "mem.h" -#if HAVE_NUMA_H &&HAVE_LINUX_MEMPOLICY_H &&HAVE_NUMAIF_H \ - &&HAVE_MPOL_CONSTANTS +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 static void verify_oom (void ) {
@@ -72,5 +75,5 @@ static struct tst_test test = { };#else /* no NUMA */ -TST_TEST_TCONF ("no NUMA development packages installed." ); +TST_TEST_TCONF ("test requires libnuma >= 2 and it's development packages" );#endif
testcases/kernel/mem/oom/oom03.c +7 -3
@@ -20,16 +20,20 @@* the GNU General Public License for more details. */ +#include "config.h" #include <sys/types.h> #include <sys/stat.h> #include <errno.h> #include <fcntl.h> #include <stdio.h> +#if HAVE_NUMA_H +#include <numa.h> +#endif +#include "numa_helper.h" #include "mem.h" -#if HAVE_NUMA_H &&HAVE_LINUX_MEMPOLICY_H &&HAVE_NUMAIF_H \ - &&HAVE_MPOL_CONSTANTS +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 static void verify_oom (void ) {
@@ -85,5 +89,5 @@ static struct tst_test test = { };#else -TST_TEST_TCONF ("no NUMA development packages installed." ); +TST_TEST_TCONF ("test requires libnuma >= 2 and it's development packages" );#endif
testcases/kernel/mem/oom/oom04.c +6 -3
@@ -26,11 +26,14 @@#include <errno.h> #include <fcntl.h> #include <stdio.h> +#if HAVE_NUMA_H +#include <numa.h> +#endif +#include "numa_helper.h" #include "mem.h" -#if HAVE_NUMA_H &&HAVE_LINUX_MEMPOLICY_H &&HAVE_NUMAIF_H \ - &&HAVE_MPOL_CONSTANTS +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 static void verify_oom (void ) {
@@ -94,5 +97,5 @@ static struct tst_test test = { };#else /* no NUMA */ -TST_TEST_TCONF ("no NUMA development packages installed." ); +TST_TEST_TCONF ("test requires libnuma >= 2 and it's development packages" );#endif
testcases/kernel/mem/oom/oom05.c +6 -3
@@ -26,11 +26,14 @@#include <errno.h> #include <fcntl.h> #include <stdio.h> +#if HAVE_NUMA_H +#include <numa.h> +#endif +#include "numa_helper.h" #include "mem.h" -#if HAVE_NUMA_H &&HAVE_LINUX_MEMPOLICY_H &&HAVE_NUMAIF_H \ - &&HAVE_MPOL_CONSTANTS +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 static void verify_oom (void ) {
@@ -120,5 +123,5 @@ static struct tst_test test = { };#else /* no NUMA */ -TST_TEST_TCONF ("no NUMA development packages installed." ); +TST_TEST_TCONF ("test requires libnuma >= 2 and it's development packages" );#endif
testcases/kernel/mem/vma/vma02.c +2 -3
@@ -49,8 +49,7 @@char *TCID ="vma02" ;int TST_TOTAL =1 ; -#if HAVE_NUMA_H &&HAVE_NUMAIF_H &&HAVE_MPOL_CONSTANTS && \ - defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 static unsigned long pagesize;static int opt_node;
@@ -167,6 +166,6 @@ void usage(void)#else /* no NUMA */ int main (void ) { -tst_brkm (TCONF ,NULL ,"no NUMA development packages installed." ); +tst_brkm (TCONF ,NULL ,"test requires libnuma >= 2 and it's development packages" ); }#endif
testcases/kernel/mem/vma/vma04.c +2 -3
@@ -53,8 +53,7 @@char *TCID ="vma04" ;int TST_TOTAL =5 ; -#if HAVE_NUMA_H &&HAVE_NUMAIF_H &&HAVE_MPOL_CONSTANTS && \ - defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 static unsigned long pagesize;static int opt_node;
@@ -328,6 +327,6 @@ static void usage(void)#else /* no NUMA */ int main (void ) { -tst_brkm (TCONF ,NULL ,"no NUMA development packages installed." ); +tst_brkm (TCONF ,NULL ,"test requires libnuma >= 2 and it's development packages" ); }#endif
testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c +4 -3
@@ -57,6 +57,7 @@#if HAVE_NUMAIF_H #include <numaif.h> #endif +#include "test.h" #include "lapi/syscalls.h" #include "include_j_h.h"
@@ -66,8 +67,7 @@char *TCID ="get_mempolicy01" ;int TST_TOTAL =1 ; -#if HAVE_NUMA_H &&HAVE_NUMAIF_H &&HAVE_MPOL_CONSTANTS && \ - defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 #define MEM_LENGTH (4 * 1024 * 1024)
@@ -311,9 +311,10 @@ static void setup(void)TEST_PAUSE ; tst_tmpdir(); } +#else int main (void ) { -tst_brkm (TCONF ,NULL ,"System doesn't have required numa support" ); +tst_brkm (TCONF ,NULL ,"test requires libnuma >= 2 and it's development packages" ); }#endif
testcases/kernel/syscalls/mbind/mbind01.c +6 -3
@@ -22,12 +22,15 @@*/ #include <errno.h> +#if HAVE_NUMA_H +#include <numa.h> +#endif +#include "config.h" #include "numa_helper.h" #include "tst_test.h" -#if HAVE_NUMA_H &&HAVE_NUMAIF_H &&HAVE_MPOL_CONSTANTS && \ - defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 #define MEM_LENGTH (4 * 1024 * 1024)
@@ -234,5 +237,5 @@ static struct tst_test test = { };#else /* libnuma >= 2 */ -TST_TEST_TCONF ("test requires libnuma >= 2." ); +TST_TEST_TCONF ("test requires libnuma >= 2 and it's development packages" );#endif
testcases/kernel/syscalls/migrate_pages/migrate_pages01.c +5 -3
@@ -55,7 +55,9 @@ option_t options[] = { {NULL, NULL, NULL} }; -#if defined(__NR_migrate_pages) &&HAVE_NUMA_H &&HAVE_NUMAIF_H +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 \ + && defined(__NR_migrate_pages) +static unsigned long *sane_old_nodes;static unsigned long *sane_new_nodes;static int sane_nodemask_size;
@@ -252,7 +254,7 @@ static void cleanup(void)#else /* __NR_migrate_pages */ int main (void ) { -tst_brkm (TCONF ,NULL ,"System doesn't support __NR_migrate_pages" -" or libnuma is not available" ); +tst_brkm (TCONF ,NULL ,"System doesn't support __NR_migrate_pages or " +"libnuma or libnuma development packages are not available" ); }#endif
testcases/kernel/syscalls/migrate_pages/migrate_pages02.c +6 -3
@@ -45,6 +45,7 @@#include <stdlib.h> #include <unistd.h> #include <pwd.h> +#include "config.h" #include "test.h" #include "safe_macros.h"
@@ -65,7 +66,9 @@char *TCID ="migrate_pages02" ;int TST_TOTAL =1 ; -#if defined(__NR_migrate_pages) &&HAVE_NUMA_H &&HAVE_NUMAIF_H +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 \ + && defined(__NR_migrate_pages) +static const char nobody_uid[] ="nobody" ;static struct passwd *ltpuser;static int *nodes, nodeA, nodeB;
@@ -400,7 +403,7 @@ static void cleanup(void)#else /* __NR_migrate_pages */ int main (void ) { -tst_brkm (TCONF ,NULL ,"System doesn't support __NR_migrate_pages" -" or libnuma is not available" ); +tst_brkm (TCONF ,NULL ,"System doesn't support __NR_migrate_pages or " +"libnuma or libnuma development packages are not available" ); }#endif
testcases/kernel/syscalls/move_pages/move_pages_support.c +7 -7
@@ -16,6 +16,7 @@* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "config.h" #include <sys/mman.h> #include <sys/syscall.h> #include <unistd.h>
@@ -35,8 +36,7 @@ long get_page_size(void)*/ void free_pages (void **pages,unsigned int num) { - -#if HAVE_NUMA_H +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 int i;size_t onepage =get_page_size ();
@@ -111,7 +111,7 @@ int alloc_pages_linear(void **pages, unsigned int num) {int nodes[num]; -#if HAVE_NUMA_H +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 unsigned int i;unsigned int n =0 ;int num_allowed_nodes;
@@ -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 && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 unsigned int i;int which_node;int ret;
@@ -214,7 +214,7 @@ verify_pages_on_nodes(void **pages, int *status, unsigned int num, int *nodes)*/ void verify_pages_linear (void **pages,int *status,unsigned int num) { -#if HAVE_NUMA_H +#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 unsigned int i;unsigned int n =0 ;int nodes[num];
@@ -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 && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 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 && defined(LIBNUMA_API_VERSION ) &&LIBNUMA_API_VERSION >=2 int num_allowed_nodes;int ret;
Signature · 1 line
2.14.2