Skip to contentSkip to conversation

broken epoll Makefile

LTP In review Cyril Hrubis 1 participant 7 messages Aug 31, 2009 – Sep 17, 2009 5 messages not in the archive

lore
Share & tools
lore
#0 lore raw

Hi,
compilation of testcases/kernel/syscalls/epoll was randomly faling on s390, while trying to find culprint I've noticed that test in Makefile is badly broken. The problematic line is:

LIBC_HAS_EPOLL := $(shell echo '\#include <sys/epoll.h>' | $(CC) -E - > /dev/null 2>&1 && echo yes)

Where sombody added \ to escape # from makefile, but this is being printed into the $(CC) input and because of this LIBC_HAS_EPOLL is set to 'yes' no matter if this header is present or not. However it fails (sometimes) on s390.

This check should be moved to autoconf but just for now I'm too tired to do that.

Signature · 12 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hi!

Quoted 6 lines
Quoted 6 lines

compilation of testcases/kernel/syscalls/epoll was randomly faling on s390, while trying to find culprint I've noticed that test in Makefile is badly broken. The problematic line is:

LIBC_HAS_EPOLL := $(shell echo '\#include <sys/epoll.h>' | $(CC) -E - > /dev/null 2>&1 && echo yes)

Quoted 8 lines
Quoted 6 lines

Where sombody added \ to escape # from makefile, but this is being printed into the $(CC) input and because of this LIBC_HAS_EPOLL is set to 'yes' no matter if this header is present or not. However it fails (sometimes) on s390.

This check should be moved to autoconf but just for now I'm too tired to do that.

Can you please send a patch now ?

Working on. Should be hopefully finished today.

Signature · 12 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

PATCH 1/1 broken epoll Makefile

Hi!

Quoted 3 lines
Quoted 1 line

Working on. Should be hopefully finished today.

Great.

After trying to find old enough glibc (2.2.2 and older) in any distribution I've given up modifying the test to compile with non glibc epoll library. So when glibc epoll headers are not found the test is disabled entirely and dummy version of the test is compiled. Patch that also fixes some minor problems is attached.

Also there are several directories that doesn't contain Makefile (or any files) so the are not used or not compiled anyway. IMHO they should be removed. For example in CVS tree:

in testcases/kernel/syscals/

epoll2
epoll_create2
create_module
destroy_module
getcontext01
...

Empty directories are not exported to releases. At least it seems so, but still there are directories containing useless data, for example epoll2.

Signature · 2 lines
Cyril Hrubis
[email protected]
configure.ac +1 -0
Index: ltp/configure.ac
===================================================================
@@ -13,6 +13,7 @@ AC_CHECK_HEADERS_ONCE([ \
 ifaddrs.h \
 sys/capability.h \
 sys/inotify.h \
+sys/epoll.h \
 ])
 
 LTP_CHECK_SYSCALL_EVENTFD
testcases/kernel/syscalls/epoll/Makefile +0 -8
Index: ltp/testcases/kernel/syscalls/epoll/Makefile
===================================================================
@@ -19,14 +19,6 @@
 CFLAGS += -I../../../../include -Wall
 LDLIBS += -L../../../../lib -lltp
 
-LIBC_HAS_EPOLL := $(shell echo '\#include <sys/epoll.h>' | $(CC) -E - > /dev/null 2>&1 && echo yes)
-ifeq ($(LIBC_HAS_EPOLL),yes)
-CFLAGS += -DLTP_EPOLL_USE_SYS_LIBC
-else
-CFLAGS += -I. -DLTP_EPOLL_USE_LIB
-LDLIBS += -lepoll
-endif
-
 SRCS    = $(wildcard *.c)
 TARGETS = $(patsubst %.c,%,$(SRCS))
 
testcases/kernel/syscalls/epoll/epoll-ltp.c +24 -27

109 lines not on this page · raw message

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#5 lore raw

Hi!

Quoted 13 lines

Also there are several directories that doesn't contain Makefile (or any files) so the are not used or not compiled anyway. IMHO they should be removed. For example in CVS tree:

in testcases/kernel/syscals/

epoll2
epoll_create2
create_module
destroy_module
getcontext01
...

Quoted 3 lines

Empty directories are not exported to releases. At least it seems so, but still there are directories containing useless data, for example epoll2.

This part of was forgotten but it still makes work with cvs tree harder. Any opinions?

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw

Hi!

Quoted 2 lines

fix your cvs up. cvs itself prunes empty dirs. there's nothing for us to "commit" to "fix" this.

Okay, cvs is even crazier than I was expecting. But still there are directories that are not empty but doesn't contain Makefile and are not used for anything. For example epoll2.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

Hi!

Quoted 1 line

the _GNU_SOURCE change shouldnt be in there (existing style is correct)

I don't like adding spaces between # and keyword but changed back as you wish.

Quoted 2 lines

the fall back error should be TCONF, and it shouldnt say "epoll library" as there is no such thing. a better message might be "no epoll support found".

Okay.

Fixed patch attached.

Signature · 2 lines
Cyril Hrubis
[email protected]
configure.ac +1 -0
Index: ltp/configure.ac
===================================================================
@@ -13,6 +13,7 @@ AC_CHECK_HEADERS_ONCE([ \
 ifaddrs.h \
 sys/capability.h \
 sys/inotify.h \
+sys/epoll.h \
 ])
 
 LTP_CHECK_SYSCALL_EVENTFD
testcases/kernel/syscalls/epoll/Makefile +0 -8
Index: ltp/testcases/kernel/syscalls/epoll/Makefile
===================================================================
@@ -19,14 +19,6 @@
 CFLAGS += -I../../../../include -Wall
 LDLIBS += -L../../../../lib -lltp
 
-LIBC_HAS_EPOLL := $(shell echo '\#include <sys/epoll.h>' | $(CC) -E - > /dev/null 2>&1 && echo yes)
-ifeq ($(LIBC_HAS_EPOLL),yes)
-CFLAGS += -DLTP_EPOLL_USE_SYS_LIBC
-else
-CFLAGS += -I. -DLTP_EPOLL_USE_LIB
-LDLIBS += -lepoll
-endif
-
 SRCS    = $(wildcard *.c)
 TARGETS = $(patsubst %.c,%,$(SRCS))
 
testcases/kernel/syscalls/epoll/epoll-ltp.c +0 -0
Index: ltp/testcases/kernel/syscalls/epoll/epoll-ltp.c
===================================================================

@@ -95,14 +95,15 @@
#include <sys/select.h>
#include <sys/wait.h>

-#ifdef LTP_EPOLL_USE_LIB
-# include <epoll.h>
-#else
-# include <sys/epoll.h>
-#endif
-
-/* Harness Specific Include Files. */
+#include "config.h"
#include "test.h"
+
+char *TCID = "sys_epoll02"; /* test program identifier */
+int TST_TOTAL = 1; /* total number of tests in this file */
+
+#ifdef HAVE_SYS_EPOLL_H
+
+#include <sys/epoll.h>
#include "usctest.h"

/* Local Defines */
@@ -114,11 +115,6 @@
#define NUM_RAND_ATTEMPTS 16
#define BACKING_STORE_SIZE_HINT 32

-/* Dummy function for tst_brk* */
-extern void cleanup(void)
-{
-}
-
/*
Define the beginning of a "protected region". This is a region where a wide variety of errors
@@ -202,9 +198,6 @@ kid_status = kid_status;})
extern int Tst_count; /* counter for tst_xxx routines */
extern char *TESTDIR; /* temporary dir created by tst_tmpdir() */

-/* Global Variables */
-char *TCID = "sys_epoll02"; /* test program identifier */
-int TST_TOTAL = 1; /* total number of tests in this file */

/*
* Given the number of random size requests to test,
@@ -367,7 +360,7 @@ static const char *result_strings[] = {
if (ev_ptr != NULL){ \
tst_resm(TFAIL, ( "(epoll_ctl(%d,%08x,%d,%p = {%08x,%08d}) returned %d:%s)" ) , ##__VA_ARGS__ , \
epoll_fds[epfd_index], epoll_ctl_ops[op_index], \
- epoll_fds[fd_index], ev_ptr, ev_ptr->events, ev_ptr->data, errno, \
+ epoll_fds[fd_index], ev_ptr, ev_ptr->events, ev_ptr->data.fd, errno, \
strerror(errno)); \
} else { \
tst_resm(TFAIL, ( "(epoll_ctl(%d,%08x,%d,%p) returned %d:%s)" ) , ##__VA_ARGS__ , \
@@ -381,7 +374,7 @@ static const char *result_strings[] = {
if (ev_ptr != NULL){ \
tst_resm(TPASS, ( "(epoll_ctl(%d,%08x,%d,%p = {%08x,%08d}) returned %d:%s)" ) , ##__VA_ARGS__ , \
epoll_fds[epfd_index], epoll_ctl_ops[op_index], \
- epoll_fds[fd_index], ev_ptr, ev_ptr->events, ev_ptr->data, errno, \
+ epoll_fds[fd_index], ev_ptr, ev_ptr->events, ev_ptr->data.fd, errno, \
strerror(errno)); \
} else { \
tst_resm(TPASS, ( "(epoll_ctl(%d,%08x,%d,%p) returned %d:%s)" ) , ##__VA_ARGS__ , \
@@ -390,8 +383,8 @@ static const char *result_strings[] = {
} \
})
#else
-#define EPOLL_CTL_TEST_FAIL(msg , ...) tst_resm(TFAIL, (const char*)(msg) , ##__VA_ARGS__) -#define EPOLL_CTL_TEST_PASS(msg , ...) tst_resm(TPASS, (const char*)(msg) , ##__VA_ARGS__) +#define EPOLL_CTL_TEST_FAIL(msg , ...) tst_resm(TFAIL, msg , ##__VA_ARGS__)
+#define EPOLL_CTL_TEST_PASS(msg , ...) tst_resm(TPASS, msg , ##__VA_ARGS__)
#endif

/****************************************************************************************/
@@ -642,12 +635,6 @@ int test_epoll_ctl(int epoll_fd)
} else /* The call of epoll_ctl behaved as expected */
EPOLL_CTL_TEST_PASS((result_strings
[result]));
-
-/* Just to be safe, undefine our macros */
-#undef EPOLL_CTL_TEST_FAIL
-#undef EPOLL_CTL_TEST_PASS
-#undef PROTECT_REGION_BEGIN
-#undef PROTECT_REGION_END
}
}
}
@@ -673,7 +660,7 @@ int main(int argc, char **argv)

/* Get the current time */
if (gettimeofday(&tv, NULL) != 0) {
- tst_brkm(TBROK, cleanup, "gettimeofday failed");
+ tst_brkm(TBROK, NULL, "gettimeofday failed");
tst_exit();
} else {
tst_resm(TINFO, "gettimeofday() works");
@@ -704,3 +691,13 @@ int main(int argc, char **argv)

return 0;
}
+
+#else
+
+int main(void)
+{
+ tst_resm(TCONF, "No epoll support found.");
+ tst_exit();
+}
+
+#endif

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): [email protected]

#11 lore raw

Hi!

Quoted 16 lines
Quoted 4 lines
Quoted 1 line

the _GNU_SOURCE change shouldnt be in there (existing style is correct)

I don't like adding spaces between # and keyword but changed back as you
wish.

lack of indentation in nested #if quickly makes for unreadable and unmaintainable code.
#ifdef FOO
#some more ifdefs
#ifdef MOO
#some more ifdesf
#else
#some more
#endif
#endif

Quoted 1 line

whereas the whitespace makes the nested logic trivial to track

Agree with that (and I would be nice to fix all unreadable code in ltp). But as I rarely use anything else that gcc, puting whitespaces before # is not problem for me and this style IMHO looks better. I know that works only for my personal projects, but have you seen compiler that is used these days and has problems with that?

Signature · 12 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list