Applied bug fixes from Gernot Payer:
====================================
1. It is quite useful if runalltests.sh can return proper exit codes,
so it can be used in an automated testing environment:
--- ltp-full-20040405/runalltests.sh 2004-03-18 17:38:58.000000000 +0100
+++ ltp-new-20040405/runalltests.sh 2004-04-20 13:58:23.107077311 +0200
@@ -336,8 +336,10 @@
if [ $? -eq 0 ]; then
echo "INFO: pan reported all tests PASS"
+ exit 0
else
echo "INFO: pan reported some tests FAIL"
+ exit 1
fi
[ ! -z "$QUIET_MODE" ] && { echo "INFO: Test end time: $(date)" ; }
2. On 32bit architectures I encountered fails in some growfiles tests.
Using O_LARGEFILE solved this problem for me.
--- ltp-full-20040405/testcases/kernel/fs/doio/Makefile 2003-03-13 21:09:12.000000000 +0100
+++ ltp-new-20040405/testcases/kernel/fs/doio/Makefile 2004-04-20 13:59:24.683431396 +0200
@@ -1,5 +1,5 @@
-CFLAGS+= -Wall -I../../../../include
+CFLAGS+= -Wall -I../../../../include -D_LARGEFILE64_SOURCE
LDLIBS+= -L../../../../lib -lltp
TARGETS=doio growfiles rwtest iogen
--- ltp-full-20040405/testcases/kernel/fs/doio/growfiles.c 2004-03-01 23:36:39.000000000 +0100
+++ ltp-new-20040405/testcases/kernel/fs/doio/growfiles.c 2004-04-20 13:59:24.687430445 +0200
@@ -164,7 +164,13 @@
int Pid=0;
int io_type = 0; /* I/O type -sync */
+
+#ifdef O_LARGEFILE
+int open_flags = O_RDWR|O_CREAT|O_LARGEFILE; /* open flags */
+#else
+#warning O_LARGEFILE is not defined!
int open_flags = O_RDWR|O_CREAT; /* open flags */
+#endif
#define MAX_FC_READ 196608 /* 4096 * 48 - 48 blocks */
3. And finally a suggestion for how to fix the bug found by Russ Weight:
--- ltp-full-20040405/testcases/kernel/syscalls/chdir/chdir01.c 2002-11-11 20:01:43.000000000 +0100
+++ ltp-new-20040405/testcases/kernel/syscalls/chdir/chdir01.c 2004-04-20 14:21:36.073489498 +0200
@@ -65,7 +65,7 @@
void setup(void);
void cleanup(void);
-static void checkname(char*, DIR*);
+static void checknames(char**, int, DIR*);
char testdir[40] = "";
@@ -75,6 +75,7 @@
DIR *ddir, *opendir();
int fd, ret;
char *filname = "chdirtest";
+ char *filenames[3];
int lc; /* loop counter */
char *msg; /* message returned from parse_opts */
@@ -109,9 +110,10 @@
/*NOTREACHED*/
}
- checkname(".", ddir);
- checkname("..", ddir);
- checkname(filname, ddir);
+ filenames[0] = ".";
+ filenames[1] = "..";
+ filenames[2] = filname;
+ checknames(filenames, 3, ddir);
TEST(chdir(filname));
@@ -188,17 +190,25 @@
}
void
-checkname(pfilname, ddir)
-char *pfilname;
+checknames(pfilnames, fnamecount, ddir)
+char **pfilnames;
+int fnamecount;
DIR *ddir;
{
struct dirent *dir;
+ int i, found;
- if ((dir = readdir(ddir)) != (struct dirent *) 0) {
- tst_resm(TINFO, "File %s in directory %s", dir->d_name,
- pfilname);
- if (strncmp(pfilname, dir->d_name, strlen(pfilname)) != 0) {
- tst_brkm(TFAIL, cleanup, "strncmp failed in checkname");
+ found = 0;
+ while ((dir = readdir(ddir)) != (struct dirent *) 0) {
+ for(i = 0; i < fnamecount; i++) {
+ /* if dir->d_name is not null terminated it is a bug anyway */
+ if (strcmp(pfilnames[i], dir->d_name) == 0) {
+ tst_resm(TINFO, "Found file %s", dir->d_name);
+ found++;
+ }
}
}
+ if(found < fnamecount) {
+ tst_brkm(TFAIL, cleanup, "Some files do not exist, but they must exist");
+ }
}
mfg
Gernot Payer
====================================
4 files changed