Skip to contentSkip to conversation

syscalls/swapon03: do not fail if /proc/swaps is absent

PATCH New Steve Muckle 2 participants 2 messages Feb 20, 2018 – Feb 21, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syscalls/swapon03: do not fail if /proc/swaps is absent

If the /proc/swaps file is absent the test should be skipped due to incompatible configuration.

---
 testcases/kernel/syscalls/swapon/swapon03.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
testcases/kernel/syscalls/swapon/swapon03.c +1 -2
index d3f73b044fe1..f690389c55a3 100644
@@ -165,8 +165,7 @@ static int setup_swap(void)
 
 	/* This includes the first (header) line */
 	if ((fd = open("/proc/swaps", O_RDONLY)) == -1) {
-		tst_brkm(TFAIL | TERRNO, cleanup,
-			 "Failed to find out existing number of swap files");
+		tst_brkm(TCONF, cleanup, "Unable to open /proc/swaps");
 	}
 	do {
 		char *p = buf;
Signature · 1 line
2.13.6
#1 lore raw

PATCH 1/1 syscalls/swapon03: do not fail if /proc/swaps is absent

Hello Steve,

Quoted 13 lines · Steve Muckle

If the /proc/swaps file is absent the test should be skipped due to incompatible configuration.

---
 testcases/kernel/syscalls/swapon/swapon03.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
testcases/kernel/syscalls/swapon/swapon03.c +0 -0
index d3f73b044fe1..f690389c55a3 100644

testcases/kernel/syscalls/swapon/swapon03.c static int setup_swap(void) · line 168

Quoted 6 lines
testcases/kernel/syscalls/swapon/swapon03.c +1 -2
@@ -165,8 +165,7 @@ static int setup_swap(void)
 
 	/* This includes the first (header) line */
 	if ((fd = open("/proc/swaps", O_RDONLY)) == -1) {
-		tst_brkm(TFAIL | TERRNO, cleanup,
-			 "Failed to find out existing number of swap files");
+		tst_brkm(TCONF, cleanup, "Unable to open /proc/swaps");

You should probably only return TCONF if ENOENT, otherwise TFAIL or TBROK.

Quoted 5 lines
testcases/kernel/syscalls/swapon/swapon03.c +0 -0
 	}
 	do {
 		char *p = buf;
Signature · 1 line
2.13.6
Signature · 2 lines
Thank you,
Richard.