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

List:       ltp-cvs
Subject:    [Ltp-cvs] ltp/testcases/kernel/syscalls/swapon swapon01.c,1.3,1.4 swapon02.c,1.21,1.22
From:       Robert Williamson <robbiew () users ! sourceforge ! net>
Date:       2005-01-17 22:10:14
Message-ID: E1Cqf5Q-0006jH-Qu () sc8-pr-cvs1 ! sourceforge ! net
[Download RAW message or body]

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

Modified Files:
	swapon01.c swapon02.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: swapon02.c
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/swapon/swapon02.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** swapon02.c	12 Oct 2004 15:55:06 -0000	1.21
--- swapon02.c	17 Jan 2005 22:10:11 -0000	1.22
***************
*** 72,75 ****
--- 72,77 ----
   *
   *CHANGES:
+  * 2005/01/01  Add extra check to stop test if swap file is on tmpfs
+  *             -Ricky Ng-Adam (rngadam@yahoo.com)
   * 01/02/03  Added fork to handle SIGSEGV generated when the intentional EPERM
   * error for hitting MAX_SWAPFILES is hit. 
***************
*** 364,368 ****
              if (swapon(filename, 0) != 0) {
                  tst_resm(TWARN, "Failed swapon for file %s"
!                          "returned %d", filename);
                  /* must cleanup already swapon files */
                  cleanup03();
--- 366,370 ----
              if (swapon(filename, 0) != 0) {
                  tst_resm(TWARN, "Failed swapon for file %s"
!                          " returned %d", filename);
                  /* must cleanup already swapon files */
                  cleanup03();
***************
*** 441,444 ****
--- 443,451 ----
    tst_tmpdir();
  
+ 
+   if(tst_is_cwd_tmpfs()) {
+     tst_brkm(TBROK, cleanup, "Cannot do swapon on a file located on a tmpfs filesystem");
+   }
+ 
    /*create file*/
    if ((strncmp(kmachine, "ia64", 4)) == 0) {

Index: swapon01.c
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/swapon/swapon01.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** swapon01.c	28 Apr 2003 20:27:58 -0000	1.3
--- swapon01.c	17 Jan 2005 22:10:10 -0000	1.4
***************
*** 66,69 ****
--- 66,75 ----
   *RESTRICTIONS:
   * Not compatible 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)
   *****************************************************************************/
  
***************
*** 137,140 ****
--- 143,147 ----
  setup()
  {
+ 
  	/* capture signals */
  	tst_sig(FORK, DEF_HANDLER, cleanup);
***************
*** 151,154 ****
--- 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 >"
***************
*** 157,160 ****
--- 172,176 ----
  	}
  
+ 
  	/* make above file a swap file*/
  	if( system("mkswap swapfile01 > tmpfile 2>&1") != 0) {



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