[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ltp-cvs
Subject:    [Ltp-cvs] ltp/testcases/kernel/syscalls/swapoff swapoff01.c,1.3,1.4 swapoff02.c,1.5,1.6
From:       Robert Williamson <robbiew () users ! sourceforge ! net>
Date:       2005-01-17 22:10:14
Message-ID: E1Cqf5L-0006jJ-H9 () sc8-pr-cvs1 ! sourceforge ! net
[Download RAW message or body]

Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/swapoff
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25408/testcases/kernel/syscalls/swapoff

Modified Files:
	swapoff01.c swapoff02.c 
Log Message:
Applied patch from Ricky Ng-Adam for systems using tmpfs:
========================================================
Tests swapon01, swapon02, swapoff01, swapoff02 FAILED for me until I 
realized that my /tmp where the swapfiles where being created was set as 
a tmpfs (in-memory) filesystem. Swapon will refuse to work with an 
EINVAL as it should.

To help people figure this out faster in the future, this patch and two 
extra functions for LTP libs are to make these tests fail with a more 
informative message when attempts to create swap on tmpfs are made.

Also, I've added a test to check if there is sufficient disk space on 
the filesystem to create the requested swap (except for swapon02.c where 
I can't figure how much space total the test will require).


Index: swapoff02.c
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/swapoff/swapoff02.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** swapoff02.c	29 Apr 2003 17:06:59 -0000	1.5
--- swapoff02.c	17 Jan 2005 22:10:12 -0000	1.6
***************
*** 68,71 ****
--- 68,77 ----
   *RESTRICTIONS:
   *Incompatible with kernel versions below 2.1.35.
+  *
+  *CHANGES:
+  * 2005/01/01  Add extra check to stop test if insufficient disk space in dir
+  *             -Ricky Ng-Adam (rngadam@yahoo.com)
+  * 2005/01/01  Add extra check to stop test if swap file is on tmpfs
+  *             -Ricky Ng-Adam (rngadam@yahoo.com)
   *****************************************************************************/
  
***************
*** 254,257 ****
--- 260,271 ----
  	tst_tmpdir();
  
+ 	if(tst_is_cwd_tmpfs()) {
+ 		tst_brkm(TBROK, cleanup, "Cannot do swapon on a file located on a tmpfs filesystem");
+ 	}
+ 
+ 	if(!tst_cwd_has_free(65536)) {
+ 		tst_brkm(TBROK, cleanup, "Insufficient disk space to create swap file");
+ 	}
+ 
  	/*create file*/
  	if(system("dd if=/dev/zero of=swapfile01 bs=1024  count=65536 > tmpfile"

Index: swapoff01.c
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/swapoff/swapoff01.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** swapoff01.c	29 Apr 2003 17:06:59 -0000	1.3
--- swapoff01.c	17 Jan 2005 22:10:12 -0000	1.4
***************
*** 67,70 ****
--- 67,76 ----
   *RESTRICTIONS:
   * Not compatible with kernel versions below 1.3.2.
+  *
+  *CHANGES:
+  * 2005/01/01  Add extra check to stop test if insufficient disk space in dir
+  *             -Ricky Ng-Adam (rngadam@yahoo.com)
+  * 2005/01/01  Add extra check to stop test if swap file is on tmpfs
+  *             -Ricky Ng-Adam (rngadam@yahoo.com)
   *****************************************************************************/
  
***************
*** 152,155 ****
--- 158,169 ----
  	tst_tmpdir();
  
+ 	if(tst_is_cwd_tmpfs()) {
+ 		tst_brkm(TBROK, cleanup, "Cannot do swapon on a file located on a tmpfs filesystem");
+ 	}
+ 
+ 	if(!tst_cwd_has_free(65536)) {
+ 		tst_brkm(TBROK, cleanup, "Insufficient disk space to create swap file");
+ 	}
+ 
  	/*create file*/
  	if(system("dd if=/dev/zero of=swapfile01 bs=1024  count=65536 > tmpfile"



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Ltp-cvs mailing list
Ltp-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic