Hi,
From: Subrata Modak <[EMAIL PROTECTED]>
Subject: Re: [LTP] proc01 failure
Date: Thu, 22 May 2008 19:20:58 +0530
> Also wanted to forward this info to the test case author and to others
> who have modified/patched this later.
>
> Stephane/Mike/Cai,
>
> Can you please look in to the following error in:
>
> ltp/testcases/kernel/fs/proc/proc01.c
> (http://ltp.cvs.sourceforge.net/*checkout*/ltp/ltp/testcases/kernel/fs/proc/proc01.c)
>
> test case.
>
>
>
> ...........................
> ...........................
>
> Thanks Li for the patch. The same has been applied. Can you also look
> into one test case which has been giving some weired failure. It was
> regarding the:
>
> ltp/testcases/kernel/fs/proc/proc01.c test case.
>
> I am just pasting what Max Stirling <[EMAIL PROTECTED]> reported on
> the mailing list some days back:
>
> Max´s mail.....................
>
> Does proc01 testcase pass for anyone?
>
> I ran the binary on my machine and it fails. Please see the below log.
>
> Am I _missing_ something?
>
> ubuntu@/home/ubuntu/Documents/work/ltp/ltp-full-20071130/testcases/kernel/fs/proc
> ->sudo ./proc01
> proc01 0 INFO : /proc/acpi/event: open: Device or resource busy
> proc01 0 INFO : /proc/sys/fs/binfmt_misc/register: is
> write-only.
> proc01 0 INFO : /proc/sysrq-trigger: is write-only.
> proc01 0 INFO : /proc/kmsg: read: Resource temporarily
> unavailable
> proc01 0 INFO : /proc/self/task/5273/mem: read: Input/output
> error
> proc01 0 INFO : /proc/self/task/5273/clear_refs: is write-only.
> proc01 0 INFO : /proc/self/task/5273/attr/prev: read: Invalid
> argument
> proc01 0 INFO : /proc/self/task/5273/attr/exec: read: Invalid
> argument
> proc01 0 INFO : /proc/self/task/5273/attr/fscreate: read:
> Invalid argument
> proc01 0 INFO : /proc/self/task/5273/attr/keycreate: read:
> Invalid argument
> proc01 0 INFO : /proc/self/task/5273/attr/sockcreate: read:
> Invalid argument
> proc01 0 INFO : /proc/self/mem: read: Input/output error
> proc01 0 INFO : /proc/self/clear_refs: is write-only.
> proc01 0 INFO : /proc/self/attr/prev: read: Invalid argument
> proc01 0 INFO : /proc/self/attr/exec: read: Invalid argument
> proc01 0 INFO : /proc/self/attr/fscreate: read: Invalid argument
> proc01 0 INFO : /proc/self/attr/keycreate: read: Invalid
> argument
> proc01 0 INFO : /proc/self/attr/sockcreate: read: Invalid
> argument
> proc01 1 FAIL : readproc() failed with 14 errors.
>
Those failures are known issues and probably too subtle to be fixed in
kernel side. However, You could try to apply the following two patches
in attachments which let the test pass at least for RHEL.
Patch (1/2) expect_fail.patch
Patch (2/2) expect_fail_more.patch
Thanks,
CaiQian
> Regards--
> Subrata
>
>
--- ltp-proc01-20071029/proc01.c.p4 2007-11-15 16:25:41.000000000 +0800
+++ ltp-proc01-20071029/proc01.c 2008-03-26 17:10:15.000000000 +0800
@@ -244,6 +244,15 @@
return 0;
}
+ /* Skip files does not honor O_NONBLOCK. */
+ if (!strcmp(obj, "/proc/ppc64/rtas/error_log")
+ || !strcmp(obj, "/proc/xen/xenbus")) {
+ tst_resm(TWARN, "%s: does not honor O_NONBLOCK.", obj);
+ close (fd);
+
+ return 0;
+ }
+
nread = 1;
while (nread > 0) {
nread = read(fd, buf, buffsize);
@@ -277,7 +286,13 @@
(!strcmp(obj, "/proc/sal/mca/event")
&& (tmperr == EAGAIN
- || tmperr == EWOULDBLOCK)))
+ || tmperr == EWOULDBLOCK))
+
+ ||
+
+ /* kernel-xen failures. */
+ (!strcmp(obj, "/proc/xen/privcmd")
+ && tmperr == EINVAL))
tst_resm(TINFO, "%s: read: expected failure: %s",
obj,
strerror(tmperr));
--- ltp-proc01-20071029/proc01.c.p2 2007-11-12 10:49:23.000000000 +0800
+++ ltp-proc01-20071029/proc01.c 2007-11-15 16:23:45.000000000 +0800
@@ -132,12 +132,13 @@
int fd;
ssize_t nread;
static char buf[MAX_BUFF_SIZE]; /* static kills reentrancy, but we
don't care about the contents */
+ int tmperr;
/* Determine the file type */
if (lstat(obj, &statbuf) < 0) {
/* permission denied is not considered as error */
if (errno != EACCES) {
- tst_resm(TINFO, "%s: lstat: %s", obj, strerror(errno));
+ tst_resm(TWARN, "%s: lstat: %s", obj, strerror(errno));
return 1;
}
return 0;
@@ -156,7 +157,7 @@
/* Open the directory to get access to what is in it */
if ((dir = opendir(obj)) == NULL) {
if (errno != EACCES) {
- tst_resm(TINFO, "%s: opendir: %s", obj,
+ tst_resm(TWARN, "%s: opendir: %s", obj,
strerror(errno));
return 1;
}
@@ -171,12 +172,12 @@
if (!strcmp(dir_ent->d_name, ".")
|| !strcmp(dir_ent->d_name, "..")
|| !strcmp(dir_ent->d_name, "kcore")
- || (!fnmatch("[0-9]*", dir_ent->d_name, 0)
+ || (!fnmatch("[0-9]*", dir_ent->d_name,
FNM_PATHNAME)
&& !strcmp(obj, procpath)))
continue;
if (opt_verbose)
- printf("%s\n", dir_ent->d_name);
+ fprintf(stderr, "%s\n", dir_ent->d_name);
/* Recursively call this routine to test the current
entry */
snprintf(dirobj, PATH_MAX, "%s/%s", obj,
@@ -195,18 +196,49 @@
/* is NONBLOCK enough to escape from FIFO's ? */
fd = open(obj, O_RDONLY | O_NONBLOCK);
if (fd < 0) {
- if (errno != EACCES) {
- tst_resm(TINFO, "%s: open: %s", obj,
- strerror(errno));
+ tmperr = errno;
+
+ /* List of expected failures. */
+ if ((!strcmp(obj, "/proc/acpi/event")
+ && tmperr == EBUSY)
+
+ ||
+
+ (!strcmp(obj, "/proc/sal/cpe/data")
+ && tmperr == EBUSY)
+
+ ||
+
+ (!strcmp(obj, "/proc/sal/cmc/data")
+ && tmperr == EBUSY)
+
+ ||
+
+ (!strcmp(obj, "/proc/sal/init/data")
+ && tmperr == EBUSY)
+
+ ||
+
+ (!strcmp(obj, "/proc/sal/mca/data")
+ && tmperr == EBUSY)) {
+
+ tst_resm(TINFO, "%s: open: expected failure: %s", obj,
+ strerror(tmperr));
+
+ } else {
+ if (tmperr != EACCES) {
+ tst_resm(TFAIL, "%s: open: %s", obj,
+ strerror(tmperr));
return 1;
- }
+ }
+ }
return 0;
}
/* Skip write-only files. */
if ((statbuf.st_mode & S_IRUSR) == 0
&& statbuf.st_mode & S_IWUSR) {
- tst_resm(TWARN, "%s: is write-only.", obj);
+ tst_resm(TINFO, "%s: is write-only.", obj);
close(fd);
return 0;
@@ -216,13 +248,59 @@
while (nread > 0) {
nread = read(fd, buf, buffsize);
if (nread < 0) {
+ tmperr = errno;
+
+ /* List of expected failures. */
+ if ((!strcmp(obj, "/proc/kmsg")
+ && (tmperr == EAGAIN
+ || tmperr == EWOULDBLOCK))
+
+ ||
+
+ (!strcmp(obj, "/proc/sal/cpe/event")
+ && (tmperr == EAGAIN
+ || tmperr == EWOULDBLOCK))
+
+ ||
+
+ (!strcmp(obj, "/proc/sal/cmc/event")
+ && (tmperr == EAGAIN
+ || tmperr == EWOULDBLOCK))
+
+ ||
+
+ (!strcmp(obj, "/proc/sal/init/event")
+ && (tmperr == EAGAIN
+ || tmperr == EWOULDBLOCK))
+
+ ||
+
+ (!strcmp(obj, "/proc/sal/mca/event")
+ && (tmperr == EAGAIN
+ || tmperr == EWOULDBLOCK)))
+
+ tst_resm(TINFO, "%s: read: expected failure: %s",
obj,
+ strerror(tmperr));
+
+ else if ((!strcmp(obj, "/proc/self/mem")
+ && tmperr == EIO)
+
+ ||
+
+ (!fnmatch("/proc/self/task/[0-9]*/mem",
obj, FNM_PATHNAME)
+ && tmperr == EIO))
+
+ tst_resm(TWARN, "%s: read: %s", obj,
strerror(tmperr));
+
+ else {
/* ignore no perm (not root) and no process
(terminated) errors */
- if (errno != EACCES && errno != ESRCH) {
- tst_resm(TINFO, "%s: read: %s", obj,
- strerror(errno));
+ if (tmperr != EACCES && tmperr != ESRCH) {
+ tst_resm(TFAIL, "%s: read: %s", obj,
+ strerror(tmperr));
close(fd);
return 1;
}
+ }
close(fd);
return 0;
}
@@ -230,14 +308,14 @@
#ifdef DEBUG
printf("%d", nread);
#endif
- printf(".");
+ fprintf(stderr, ".");
}
total_read += nread;
}
close(fd);
if (opt_verbose)
- printf("\n");
+ fprintf(stderr, "\n");
}
/*
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list