Hi,

> Yes, you can put all these stuffs in somewhere like:
> ltp/testcases/kernel/syscalls/compatibilities/.
> 
> Can you please resend this as a Patch based on my above proposal ?

I choose utils as its directory name.
 
Please put attached files compat_16.mk and newer_64.mk to 
ltp/testcases/kernel/syscalls/utils. 

Signed-off-by: Masatake YAMATO <[EMAIL PROTECTED]>

Index: testcases/kernel/syscalls/fadvise/Makefile
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/fadvise/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- testcases/kernel/syscalls/fadvise/Makefile  20 Aug 2008 10:55:19 -0000      
1.2
+++ testcases/kernel/syscalls/fadvise/Makefile  25 Aug 2008 11:45:41 -0000
@@ -22,13 +22,11 @@
 CFLAGS += -I../../../../include -Wall
 LDLIBS += -L../../../../lib -lltp
 
-SRCS      = $(wildcard *.c)
-TARGETS   = $(patsubst %.c,%,$(SRCS)) $(patsubst %.c,%_64,$(SRCS))
-
-%_64.o: %.c
-       $(COMPILE.c) $(OUTPUT_OPTION) $<
-%_64: CFLAGS += -DTST_USE_NEWER64_SYSCALL=1 -D_FILE_OFFSET_BITS=64
+include ../utils/newer_64.mk
+%_64: CFLAGS += -D_FILE_OFFSET_BITS=64
 
+SRCS      = $(wildcard *.c)
+TARGETS   += $(patsubst %.c,%,$(SRCS))
 
 all: $(TARGETS)
 
Index: testcases/kernel/syscalls/ftruncate/Makefile
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/ftruncate/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- testcases/kernel/syscalls/ftruncate/Makefile        20 Aug 2008 10:55:20 
-0000      1.11
+++ testcases/kernel/syscalls/ftruncate/Makefile        25 Aug 2008 11:45:41 
-0000
@@ -19,13 +19,11 @@
 CFLAGS += -I../../../../include -Wall
 LDLIBS += -L../../../../lib -lltp
 
-SRCS    = $(wildcard *.c)
-TARGETS = $(patsubst %.c,%,$(SRCS)) $(patsubst %.c,%_64,$(SRCS))
-
+include ../utils/newer_64.mk
+%_64: CFLAGS += -D_FILE_OFFSET_BITS=64
 
-%_64.o: %.c
-       $(COMPILE.c) $(OUTPUT_OPTION) $<
-%_64: CFLAGS += -DTST_USE_NEWER64_SYSCALL=1 -D_FILE_OFFSET_BITS=64
+SRCS    = $(wildcard *.c)
+TARGETS += $(patsubst %.c,%,$(SRCS))
 
 
 all: $(TARGETS)
Index: testcases/kernel/syscalls/sendfile/Makefile
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/sendfile/Makefile,v
retrieving revision 1.12
diff -u -r1.12 Makefile
--- testcases/kernel/syscalls/sendfile/Makefile 20 Aug 2008 10:55:21 -0000      
1.12
+++ testcases/kernel/syscalls/sendfile/Makefile 25 Aug 2008 11:45:54 -0000
@@ -19,15 +19,11 @@
 CFLAGS += -I../../../../include -Wall
 LDLIBS += -L../../../../lib -lltp
 
-SRCS    = $(wildcard *.c)
-TARGETS = $(patsubst %.c,%,$(SRCS)) $(patsubst %.c,%_64,$(SRCS))
+include ../utils/newer_64.mk
+%_64: CFLAGS += -D_FILE_OFFSET_BITS=64 -DOFF_T=__off64_t
 
-%_64.o: %.c
-       $(COMPILE.c) $(OUTPUT_OPTION) $<
-%_64: CFLAGS +=                                        \
-       -DTST_USE_NEWER64_SYSCALL=1             \
-       -D_FILE_OFFSET_BITS=64                  \
-       -DOFF_T=__off64_t
+SRCS    = $(wildcard *.c)
+TARGETS += $(patsubst %.c,%,$(SRCS))
 
 
 all: $(TARGETS)
Index: testcases/kernel/syscalls/setgid/Makefile
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/setgid/Makefile,v
retrieving revision 1.10
diff -u -r1.10 Makefile
--- testcases/kernel/syscalls/setgid/Makefile   20 Aug 2008 10:55:21 -0000      
1.10
+++ testcases/kernel/syscalls/setgid/Makefile   25 Aug 2008 11:45:55 -0000
@@ -19,13 +19,10 @@
 CFLAGS += -I../../../../include -Wall
 LDLIBS += -L../../../../lib -lltp
 
-SRCS    = $(wildcard *.c) 
-TARGETS = $(patsubst %.c,%,$(SRCS)) $(patsubst %.c,%_16,$(SRCS))
+include ../utils/compat_16.mk
 
-%.c: compat_16.h
-%_16.o: %.c
-       $(COMPILE.c) $(OUTPUT_OPTION) $<
-%_16: CFLAGS += -DTST_USE_COMPAT16_SYSCALL=1
+SRCS    = $(wildcard *.c) 
+TARGETS += $(patsubst %.c,%,$(SRCS))
 
 
 all: $(TARGETS)
Index: testcases/kernel/syscalls/truncate/Makefile
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/truncate/Makefile,v
retrieving revision 1.9
diff -u -r1.9 Makefile
--- testcases/kernel/syscalls/truncate/Makefile 20 Aug 2008 10:55:21 -0000      
1.9
+++ testcases/kernel/syscalls/truncate/Makefile 25 Aug 2008 11:45:56 -0000
@@ -19,15 +19,11 @@
 CFLAGS += -I../../../../include -Wall
 LDLIBS += -L../../../../lib -lltp
 
-SRCS    = $(wildcard *.c)
-TARGETS = $(patsubst %.c,%,$(SRCS)) $(patsubst %.c,%_64,$(SRCS))
-
+include ../utils/newer_64.mk
+%_64: CFLAGS += -D_FILE_OFFSET_BITS=64
 
-%_64.o: %.c
-       $(COMPILE.c) $(OUTPUT_OPTION) $<
-%_64: CFLAGS +=                                        \
-       -DTST_USE_NEWER64_SYSCALL=1             \
-       -D_FILE_OFFSET_BITS=64
+SRCS    = $(wildcard *.c)
+TARGETS += $(patsubst %.c,%,$(SRCS))
 
 
 all: $(TARGETS)
#
#  Copyright (c) Red Hat Inc., 2008
#
#  This program is free software;  you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
#  the GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program;  if not, write to the Free Software
#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#

# Author: Masatake YAMATO <[EMAIL PROTECTED]>
# Technique used here is suggested by Garrett Cooper <[EMAIL PROTECTED]>

# This file does the same things on foo64 system call 
# as compat_16.mk does on foo16. See both compat_16.mk
# and Makefile for fadvise test case.

TARGETS_64 = $(patsubst %.c,%_64,$(SRCS))
TARGETS  +=  $(TARGETS_64)

DEF_64 = TST_USE_NEWER64_SYSCALL
COMPAT_64_H = newer_64.h
HAS_NEWER_64 := $(shell if [ -f $(NEWER_64_H) ]; then   \
                                echo yes;               \
                        else                            \
                                echo no;                \
                        fi)


ifeq ($(HAS_NEWER_64),yes)
%.c: $(NEWER_64_H)
endif

%_64.o: %.c
        $(COMPILE.c) $(OUTPUT_OPTION) $<
%_64: CFLAGS += -D$(DEF_64)=1
#
#  Copyright (c) Red Hat Inc., 2008
#
#  This program is free software;  you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
#  the GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program;  if not, write to the Free Software
#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#

# Author: Masatake YAMATO <[EMAIL PROTECTED]>
# Technique used here is suggested by Garrett Cooper <[EMAIL PROTECTED]>

# Usage:
# 
# This makefile snippet is for writing test cases
# for foo16 system calls. Here I assume you already have 
# test cases for foo like foo01, foo02.. fooN and I also 
# assume the source file name for fooN is fooN.c.
# On the above assumption, this file does:
# 
# * adding fooN_16 as TARGETS, 
# * making *.c depend on compat_16.h if the header file exists,
# * adding rules to build fooN_16 from fooN.c (and compat_16.h), and
# * passing a cpp symbol TST_USE_COMPAT16_SYSCALL to 
#   CC when building fooN_16.
#
#
# You can use this file in following procedures:
# 
# 1. write fooN.c.
# 2. add the code for 16 bit syscall and wrap
#    it #ifdef TST_USE_COMPAT16_SYSCALL/endif.
# 3. introduce your own compat_16.h if the ifdef 
#    block is too large.
# 4. don't forget putting compat_16.h in all fooN.c
#    if you introduced compat_16.h.
# 5. include this file compat_16.mk in your Makefile.
# 6. use `+=' instead of `=' as assignment operator for TARGETS.
# 7. Added extra definitions to CFLAGS in %_16 target if needed.
#
# See Makefile of setuid test case.
#
TARGETS_16 = $(patsubst %.c,%_16,$(SRCS))
TARGETS  +=  $(TARGETS_16)

DEF_16 = TST_USE_COMPAT16_SYSCALL
COMPAT_16_H = compat_16.h
HAS_COMPAT_16 := $(shell if [ -f $(COMPAT_16_H) ]; then \
                                echo yes;               \
                        else                            \
                                echo no;                \
                        fi)


ifeq ($(HAS_COMPAT_16),yes)
%.c: $(COMPAT_16_H)
endif

%_16.o: %.c
        $(COMPILE.c) $(OUTPUT_OPTION) $<
%_16: CFLAGS += -D$(DEF_16)=1
-------------------------------------------------------------------------
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

Reply via email to