This patch will allow swapon03 test case to pass even when max_swapfiles is not
known. Create maximum possible number of swapfiles during setup, then verify
that attempting to create one more swapfile will return EPERM. This is meant
to change as little as possible of the existing code.
Signed-off-by: Murlin Ray Wenzel [email protected]
--- ltp-full-20100630/testcases/kernel/syscalls/swapon/swapon03.c.orig
2010-08-02 10:31:53.042358851 -0600
+++ ltp-full-20100630/testcases/kernel/syscalls/swapon/swapon03.c
2010-08-02 13:05:19.978561054 -0600
@@ -142,8 +142,7 @@
/* Check return code */
if ((TEST_RETURN == -1) && (TEST_ERRNO == expected_errno)) {
tst_resm(TPASS, "swapon(2) got expected failure;"
- " Got errno - %d, probably your"
- " MAX_SWAPFILES is 30", expected_errno);
+ " Got errno = %d," , expected_errno);
} else if (TEST_RETURN < 0) {
tst_resm(TFAIL, "swapon(2) failed to produce"
" expected error: %d, got %d (%s)."
@@ -174,7 +173,7 @@
&& (TEST_ERRNO == expected_errno)) {
tst_resm(TPASS,
"swapon(2) got expected
failure;"
- " Got errno - %d, probably
your"
+ " Got errno = %d, probably
your"
" MAX_SWAPFILES is 32",
expected_errno);
} else {
@@ -291,11 +290,16 @@
/* turn on the swap file */
if ((res = syscall(__NR_swapon, filename, 0)) != 0) {
- tst_brkm(TFAIL | TERRNO, cleanup,
- "Failed swapon for file %s", filename);
- /* must cleanup already swapon files */
- clean_swap();
- exit(1);
+ if (errno == EPERM) {
+ printf("Successfully created %d
swapfiles\n", j);
+ break;
+ } else {
+ tst_brkm(TFAIL | TERRNO, cleanup,
+ "Failed swapon for file %s",
filename);
+ /* must cleanup already swapon files */
+ clean_swap();
+ exit(1);
+ }
}
}
tst_exit();
------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list