Hi Yamato,
Thanks for the patch introducing autoconf in LTP. I have few
questions/doubts here:
On Fri, 2008-10-31 at 15:39 +0900, Masatake YAMATO wrote:
> Hi,
>
> I've clean my signalfd test case up with autoconf.
> After applying the patch, do at ltp/
>
> autoconf
> autoheader
> ./configure
This does not work in the first place.
$ ./configure
configure: error: cannot find sources (ltp) in . or ..
I think the problem is with:
diff --git a/configure.ac b/configure.ac
> new file mode 100644
> index 0000000..977b49b
> --- /dev/null
> +++ b/configure.ac
> @@ -0,0 +1,9 @@
> +AC_INIT([ltp])
If we change it to:
+AC_INIT([ltp-full-20081031])
it works fine. Since this is the directory under which the tests are
being built. And this will change for all the subsequent ltp releases.
So, we might need a symlink here which points to the latest ltp version
always.
Regards--
Subrata
> make (or cd testcases/kernel/syscalls/signalfd; make)
>
>
> Benefits are:
>
> - signalfd01.c doesn't depends on kernel version
> (it used KERNEL_VERSION macro.)
> - Makefile becomes simple.
> - #ifdef/#endif of signalfd01.c becomes readable.
> - signalfd.m4 can use other program than ltp.
>
>
> Signed-off-by: Masatake YAMATO <[EMAIL PROTECTED]>
>
> diff --git a/configure.ac b/configure.ac
> new file mode 100644
> index 0000000..977b49b
> --- /dev/null
> +++ b/configure.ac
> @@ -0,0 +1,9 @@
> +AC_INIT([ltp])
> +AC_CONFIG_HEADERS([include/config.h])
> +
> +
> +m4_include([m4/signalfd.m4])
> +LTP_CHECK_SYSCALL_SIGNALFD
> +
> +
> +AC_OUTPUT
> \ No newline at end of file
> diff --git a/m4/signalfd.m4 b/m4/signalfd.m4
> new file mode 100644
> index 0000000..ca8a715
> --- /dev/null
> +++ b/m4/signalfd.m4
> @@ -0,0 +1,91 @@
> +dnl
> +dnl Copyright (c) Red Hat Inc., 2008
> +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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> +dnl
> +dnl Author: Masatake YAMATO <[EMAIL PROTECTED]>
> +dnl
> +
> +dnl
> +dnl LTP_CHECK_SYSCALL_SIGNALFD
> +dnl --------------------------
> +dnl
> +dnl * Checking the existence of the libc wrapper for signalfd.
> +dnl If it exists, a shell variable LTP_SYSCALL_SIGNALFD_FUNCTION is set to
> "yes".
> +dnl
> +dnl * Checking the existence of signalfd.h.
> +dnl If it exists, a shell variable LTP_SYSCALL_SIGNALFD_HEADER is set to
> "yes".
> +dnl
> +dnl * Checking the prefix used in fileds for signalfd_siginfo structure.
> +dnl If it exists, a shell variable LTP_SYSCALL_SIGNALFD_FIELD_PREFIX is
> set to "given".
> +dnl
> +dnl About cpp macros defined in this macro,
> +dnl see testcases/kernel/syscalls/signalfd/signalfd01.c of ltp.
> +dnl
> +
> +AC_DEFUN([LTP_CHECK_SYSCALL_SIGNALFD],
> +[dnl
> +_LTP_CHECK_SYSCALL_SIGNALFD_FUNCTION
> +_LTP_CHECK_SYSCALL_SIGNALFD_HEADER
> +
> +if test "$LTP_SYSCALL_SIGNALFD_HEADER" = yes; then
> + _LTP_CHECK_SYSCALL_SIGNALFD_FIELD_PREFIX
> +fi]dnl
> +)dnl
> +
> +dnl _LTP_CHECK_SYSCALL_SIGNALFD_FUNCTION
> +dnl ------------------------------------
> +dnl
> +dnl
> +AC_DEFUN([_LTP_CHECK_SYSCALL_SIGNALFD_FUNCTION],[dnl
> +AC_CHECK_FUNCS(signalfd,[LTP_SYSCALL_SIGNALFD_FUNCTION=yes])])
> +
> +dnl _LTP_CHECK_SYSCALL_SIGNALFD_HEADER
> +dnl ----------------------------------
> +dnl
> +dnl
> +AC_DEFUN([_LTP_CHECK_SYSCALL_SIGNALFD_HEADER],
> +[dnl
> +AC_CHECK_HEADERS([linux/types.h])
> +AC_CHECK_HEADERS(sys/signalfd.h linux/signalfd.h signalfd.h,[dnl
> +LTP_SYSCALL_SIGNALFD_HEADER=yes],[],[dnl
> +#ifdef HAVE_LINUX_TYPES_H
> +#include <linux/types.h>
> +#endif)
> +]dnl
> +)dnl
> +]dnl
> +)dnl
> +
> +dnl _LTP_CHECK_SYSCALL_SIGNALFD_FIELD_PREFIX
> +dnl ----------------------------------------
> +dnl
> +dnl
> +AC_DEFUN([_LTP_CHECK_SYSCALL_SIGNALFD_FIELD_PREFIX],
> +[dnl
> +AC_CHECK_MEMBERS([struct signalfd_siginfo.ssi_signo, struct
> signalfd_siginfo.signo],[dnl
> +LTP_SYSCALL_SIGNALFD_FIELD_PREFIX=given],[],[dnl
> +#ifdef HAVE_LINUX_TYPES_H
> +#include <linux/types.h>
> +#endif
> +#if defined HAVE_SYS_SIGNALFD_H
> +#include <sys/signalfd.h>
> +#elif defined HAVE_LINUX_SIGNALFD_H
> +#include <linux/signalfd.h>
> +#elif defined HAVE_SIGNALFD_H
> +#include <signalfd.h>
> +#endif])
> +]dnl
> +)dnl
> diff --git a/testcases/kernel/containers/netns/container_ftp.pl
> b/testcases/kernel/containers/netns/container_ftp.pl
> old mode 100644
> new mode 100755
> diff --git a/testcases/kernel/syscalls/signalfd/Makefile
> b/testcases/kernel/syscalls/signalfd/Makefile
> index 93517da..cf5a156 100644
> --- a/testcases/kernel/syscalls/signalfd/Makefile
> +++ b/testcases/kernel/syscalls/signalfd/Makefile
> @@ -15,15 +15,7 @@
> # along with this program; if not, write to the Free Software
> # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
> #
> -
> -include ../utils/cond.mk
> -
> -
> -CFLAGS += -I../../../../include \
> - $(call check_header,sys/signalfd.h, -DHAS_SYS_SIGNALFD_H
> -DHAS_SIGNALFD, ) \
> - $(call check_header,linux/signalfd.h, -DHAS_LINUX_SIGNALFD_H
> -DHAS_SIGNALFD, ) \
> - $(call check_header,signalfd.h, -DHAS_SIGNALFD_H -DHAS_SIGNALFD, )
> \
> - -Wall
> +CFLAGS += -I../../../../include -Wall
> LDLIBS += -L../../../../lib -lltp
>
> SRCS = $(wildcard *.c)
> diff --git a/testcases/kernel/syscalls/signalfd/signalfd01.c
> b/testcases/kernel/syscalls/signalfd/signalfd01.c
> index f4ac38f..3011a76 100644
> --- a/testcases/kernel/syscalls/signalfd/signalfd01.c
> +++ b/testcases/kernel/syscalls/signalfd/signalfd01.c
> @@ -35,6 +35,8 @@
> */
> # define _GNU_SOURCE
>
> +#include "config.h"
> +
>
> #include "test.h"
> #include "usctest.h"
> @@ -50,42 +52,52 @@ TCID_DEFINE(signalfd01);
> int TST_TOTAL = 1;
> extern int Tst_count;
>
> -#ifdef HAS_SIGNALFD
> -#include <linux/version.h>
> -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
> -#define SSI_SIGNO signo
> -#else
> -#define SSI_SIGNO ssi_signo
> -#endif
> -
> -
> -#ifdef HAS_SYS_SIGNALFD_H
> -
> -#include <sys/signalfd.h>
> -
> -#elif HAS_LINUX_SIGNALFD_H || HAS_SIGNALFD_H
>
> +#ifdef HAVE_LINUX_TYPES_H
> #include <linux/types.h>
> +#endif
>
> -#ifdef HAS_LINUX_SIGNALFD_H
> +#if defined HAVE_SYS_SIGNALFD_H
> +#include <sys/signalfd.h>
> +#elif defined HAVE_LINUX_SIGNALFD_H
> #include <linux/signalfd.h>
> -#else
> +#elif defined HAVE_SIGNALFD_H
> #include <signalfd.h>
> -#endif /* HAS_LINUX_SIGNALFD_H */
> +#else
> +#define USE_STUB
> +#endif
>
> +#ifndef HAVE_SIGNALFD
> #include "linux_syscall_numbers.h"
> #ifndef __NR_signalfd
> #define __NR_signalfd 0
> #endif
> -
> int
> signalfd(int fd, const sigset_t *mask, int flags)
> {
> /* Taken from GLIBC. */
> return (syscall(__NR_signalfd, fd, mask, _NSIG / 8));
> }
> +#endif
> +
> +#if defined HAVE_SIGNALFD_SIGINFO_SSI_SIGNO
> +#define LTP_SYSCALL_SIGNALFD_FIELD_PREFIX(FIELD) ssi_##FIELD
> +#elif defined HAVE_SIGNALFD_SIGINFO_SIGNO
> +#define LTP_SYSCALL_SIGNALFD_FIELD_PREFIX(FIELD) FIELD
> +#else
> +#define USE_STUB
> +#endif
> +
> +#ifdef USE_STUB
> +int
> +main(int argc, char** argv)
> +{
> + tst_resm(TCONF,
> + "System doesn't support execution of the test");
> + return 0;
> +}
> +#else
>
> -#endif /* HAS_SYS_SIGNALFD_H */
>
> void cleanup(void);
> void setup(void);
> @@ -177,15 +189,15 @@ do_test1(int ntst, int sig)
> goto out;
> }
>
> - if (fdsi.SSI_SIGNO == sig) {
> + if (fdsi.LTP_SYSCALL_SIGNALFD_FIELD_PREFIX(signo) == sig) {
> tst_resm(TPASS, "got expected signal");
> sfd_for_next = sfd;
> goto out;
> }
> else {
> tst_resm(TFAIL, "got unexpected signal: signal=%d : %s",
> - fdsi.SSI_SIGNO,
> - strsignal(fdsi.SSI_SIGNO));
> + fdsi.LTP_SYSCALL_SIGNALFD_FIELD_PREFIX(signo),
> +
> strsignal(fdsi.LTP_SYSCALL_SIGNALFD_FIELD_PREFIX(signo)));
> sfd_for_next = -1;
> close(sfd);
> goto out;
> @@ -271,14 +283,14 @@ do_test2(int ntst, int fd, int sig)
> goto out;
> }
>
> - if (fdsi.SSI_SIGNO == sig) {
> + if (fdsi.LTP_SYSCALL_SIGNALFD_FIELD_PREFIX(signo) == sig) {
> tst_resm(TPASS, "got expected signal");
> goto out;
> }
> else {
> tst_resm(TFAIL, "got unexpected signal: signal=%d : %s",
> - fdsi.SSI_SIGNO,
> - strsignal(fdsi.SSI_SIGNO));
> + fdsi.LTP_SYSCALL_SIGNALFD_FIELD_PREFIX(signo),
> +
> strsignal(fdsi.LTP_SYSCALL_SIGNALFD_FIELD_PREFIX(signo)));
> goto out;
> }
> out:
> @@ -348,16 +360,5 @@ cleanup(void)
> tst_exit();
> }
>
> +#endif
>
> -#else /* !HAS_SIGNALFD */
> -
> -int
> -main(int argc, char** argv)
> -{
> - tst_resm(TCONF,
> - "System doesn't support execution of the test");
> - return 0;
> -}
> -
> -
> -#endif /* !HAS_SIGNALFD */
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Ltp-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ltp-list
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list