public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: "Mitani" <mitani@ryobi.co.jp>
To: ltp-list@lists.sourceforge.net
Cc: "當座 健市" <toza@ryobi.co.jp>
Subject: [LTP] [PATCH] POSIX "sched_setparam/9-1" and "sched_setparam/10-1" tests
Date: Tue, 14 Dec 2010 17:28:28 +0900	[thread overview]
Message-ID: <000001cb9b68$e2a50240$a7ef06c0$@co.jp> (raw)

[-- Attachment #1: Type: text/plain, Size: 6901 bytes --]

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:
------------
[root@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

[root@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
[root@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 <mitani@ryobi.co.jp>
============
---
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 #2: 9-1.patch --]
[-- Type: application/octet-stream, Size: 2078 bytes --]

--- 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;
 }

[-- Attachment #3: 10-1.patch --]
[-- Type: application/octet-stream, Size: 1695 bytes --]

--- 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;
 }

[-- Attachment #4: Type: text/plain, Size: 290 bytes --]

------------------------------------------------------------------------------
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

[-- Attachment #5: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

                 reply	other threads:[~2010-12-14  8:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000001cb9b68$e2a50240$a7ef06c0$@co.jp' \
    --to=mitani@ryobi.co.jp \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=toza@ryobi.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox