Hi,

LTP's testset "hugeshmget02" failed in my systems.
But usually, "hugeshmget02" passed.

My environments are as follows:
------------
RHEL5.5 --- (x86, x86_64)
RHEL4.8 --- (x86_64)
------------


I noticed that "hugeshmget02" certainly fails after running 
of following POSIX testsets:
------------
sched_setparam/9-1
sched_setparam/10-1
------------

I tried to find the reason of this failure, and examined status of 
the shared memory before execution of test and after execution of test:
------------
[r...@rhel55-64-ltp sched_setparam]# ipcs -m

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x7402035b 1605632    root      600        4          0
0x00000000 1966081    gdm       600        393216     2          dest
0x7402035a 1572866    root      600        4          0

[r...@rhel55-64-ltp sched_setparam]# strace -o $(date +%Y%m%d%H%M%S).strace
-s 256 -T -tt -ff ./9-1.run-test
Test PASSED
[r...@rhel55-64-ltp sched_setparam]# ipcs -m

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x7402035b 1605632    root      600        4          0
0x00000000 1966081    gdm       600        393216     2          dest
0x7402035a 1572866    root      600        4          0
0xffffffff 1998851    root      600        4          0
------------


The result of strace is as follows:
------------
09:28:18.314752 execve("./9-1.run-test", ["./9-1.run-test"], [/* 24 vars
*/]) = 0 <0.011434>
09:28:18.332764 brk(0)                  = 0x17e5000 <0.000011>
09:28:18.332836 mmap(NULL, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b9422d13000 <0.000018>
09:28:18.332974 uname({sys="Linux", node="RHEL55-64-LTP", ...}) = 0
<0.000010>
09:28:18.333069 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file
or directory) <0.000027>
09:28:18.333214 open("/etc/ld.so.cache", O_RDONLY) = 3 <0.000014>
[...]
09:28:18.336308 stat("conformance/interfaces/sched_setparam/9-1.c",
0x7fff1883ce60) = -1 ENOENT (No such file or directory) <0.000014>
09:28:18.336369 shmget(0xffffffff, 4, IPC_CREAT|0600) = 1998851 <0.000026>
09:28:18.336427 shmat(1998851, 0, 0)    = ? <0.000013>
09:28:18.336500 sched_get_priority_min(SCHED_FIFO) = 1 <0.000026>
09:28:18.336565 sched_setscheduler(2465, SCHED_FIFO, { 1 }) = 0 <0.000012>
09:28:18.336626 clone(child_stack=0,
flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0x2b9422d28930) = 2466 <0.000363>
[...]
09:28:19.384594 kill(2466, SIGTERM)           = 0 <0.000077>
09:28:19.384932 kill(2467, SIGTERM)           = 0 <0.000031>
09:28:19.385112 exit_group(0)           = ?
------------

New shared memory was added after "sched_setparam/9-1".
Added shmid "1998851" is from "shmget()" of "sched_setparam/9-1".
And I judged that it is necessary to detach shared memory.

"sched_setparam/10-1" is same situation.

I revised "sched_setparam/9-1" and "sched_setparam/10-1".
After revision, "hugeshmget02" passed.


This failure may be only in several syetems of RHEL environment.
But I think that detaching is necessary at least even in non-failed systems.


Signed-off-by: Tomonori Mitani <[email protected]>
============
---
a/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/9-1.c
2010-12-14 09:47:45.000000000 +0900
+++
b/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/9-1.c
2010-12-14 15:07:56.000000000 +0900
@@ -144,6 +144,7 @@
        shmptr = (int *)shmat(shm_id, 0, 0);
        if (shmptr < (int*)0) {
                perror("An error occurs when calling shmat()");
+               shmctl(shm_id, IPC_RMID, NULL);
                return PTS_UNRESOLVED;
        }
        *shmptr = 0;
@@ -155,6 +156,8 @@
                } else {
                        perror("An error occurs when calling
sched_setscheduler()");
                }
+               shmdt(shmptr);
+               shmctl(shm_id, IPC_RMID, NULL);
                return PTS_UNRESOLVED;
        }
 
@@ -165,12 +168,16 @@
                        for(j=0; j<i; j++) {
                                kill(child_pid[j], SIGTERM);            
                        }
+                       shmdt(shmptr);
+                       shmctl(shm_id, IPC_RMID, NULL);
                        return PTS_UNRESOLVED;
                } else if (child_pid[i] == 0){
                        
                        child_process();
 
                        printf("This code should not be executed.\n");
+                       shmdt(shmptr);
+                       shmctl(shm_id, IPC_RMID, NULL);
                        return PTS_UNRESOLVED;
                }
        }               
@@ -181,12 +188,16 @@
                for(j=0; j<i; j++) {
                        kill(child_pid[j], SIGTERM);            
                }
+               shmdt(shmptr);
+               shmctl(shm_id, IPC_RMID, NULL);
                return PTS_UNRESOLVED;
        } else if (child_pid[i] == 0){
                
                test_process();
                
                printf("This code should not be executed.\n");
+               shmdt(shmptr);
+               shmctl(shm_id, IPC_RMID, NULL);
                return PTS_UNRESOLVED;
        }
 
@@ -199,6 +210,8 @@
        if (sched_setparam(child_pid[i], &param) != 0) {
                perror("An error occurs when calling sched_setparam()");
                kill_children(child_pid);
+               shmdt(shmptr);
+               shmctl(shm_id, IPC_RMID, NULL);
                return PTS_UNRESOLVED;
        }
        newcount = *shmptr;
@@ -206,10 +219,14 @@
        if (newcount == oldcount){
                printf("The target process does not preempt the calling
process\n");
                kill_children(child_pid);
+               shmdt(shmptr);
+               shmctl(shm_id, IPC_RMID, NULL);
                return PTS_FAIL;
        } 
                
        printf("Test PASSED\n");
        kill_children(child_pid);
+       shmdt(shmptr);
+       shmctl(shm_id, IPC_RMID, NULL);
        return PTS_PASS;
 }
---
a/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/10-1.
c       2010-12-11 02:09:56.000000000 +0900
+++
b/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/10-1.
c       2010-12-14 15:11:24.000000000 +0900
@@ -123,6 +123,7 @@
        shmptr = (int *)shmat(shm_id, 0, 0);
        if (shmptr < (int*)0) {
                perror("An error occurs when calling shmat()");
+               shmctl(shm_id, IPC_RMID, NULL);
                return PTS_UNRESOLVED;
        }
        *shmptr = 0;
@@ -135,6 +136,8 @@
                } else {
                        perror("An error occurs when calling
sched_setscheduler()");
                }
+               shmdt(shmptr);
+               shmctl(shm_id, IPC_RMID, NULL);
                return PTS_UNRESOLVED;
        }
 
@@ -145,12 +148,16 @@
                        for(j=0; j<i; j++) {
                                kill(child_pid[j], SIGTERM);            
                        }
+                       shmdt(shmptr);
+                       shmctl(shm_id, IPC_RMID, NULL);
                        return PTS_UNRESOLVED;
                } else if (child_pid[i] == 0){
                        
                        child_process();
 
                        printf("This code should not be executed.\n");
+                       shmdt(shmptr);
+                       shmctl(shm_id, IPC_RMID, NULL);
                        return PTS_UNRESOLVED;
                }
        }
@@ -163,6 +170,8 @@
        if (sched_setparam(getpid(), &param) != 0) {
                perror("An error occurs when calling sched_setparam()");
                kill_children(child_pid);
+               shmdt(shmptr);
+               shmctl(shm_id, IPC_RMID, NULL);
                return PTS_UNRESOLVED;
        }
        newcount = *shmptr;
@@ -170,10 +179,14 @@
        if (newcount == oldcount){
                printf("The calling process does not relinquish the
processor\n");
                kill_children(child_pid);
+               shmdt(shmptr);
+               shmctl(shm_id, IPC_RMID, NULL);
                return PTS_FAIL;
        } 
                
        printf("Test PASSED\n");
        kill_children(child_pid);
+       shmdt(shmptr);
+       shmctl(shm_id, IPC_RMID, NULL);
        return PTS_PASS;
 }
============


Regards--

-Tomonori Mitani

Attachment: 9-1.patch
Description: Binary data

Attachment: 10-1.patch
Description: Binary data

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to