Skip to contentSkip to conversation

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

PATCH RESEND Superseded Steve Muckle 3 participants 4 messages Apr 29, 2018 – May 1, 2018

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 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, 3 insertions(+)
testcases/kernel/syscalls/swapon/swapon03.c +3 -0
index d3f73b044fe1..955ac247b6a2 100644
@@ -328,6 +328,9 @@ static void setup(void)
 
 	tst_require_root();
 
+	if (access("/proc/swaps", F_OK))
+		tst_brkm(TCONF, NULL, "swap not supported by kernel");
+
 	tst_tmpdir();
 
 	switch ((fs_type = tst_fs_type(cleanup, "."))) {
Signature · 1 line
2.16.1
#1 lore raw

PATCH RESEND 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, 3 insertions(+)
testcases/kernel/syscalls/swapon/swapon03.c +0 -0
index d3f73b044fe1..955ac247b6a2 100644

testcases/kernel/syscalls/swapon/swapon03.c static void setup(void) · line 336

Quoted 9 lines
testcases/kernel/syscalls/swapon/swapon03.c +3 -0
@@ -328,6 +328,9 @@ static void setup(void)
 
 	tst_require_root();
 
+	if (access("/proc/swaps", F_OK))
+		tst_brkm(TCONF, NULL, "swap not supported by kernel");
+
 	tst_tmpdir();
 
 	switch ((fs_type = tst_fs_type(cleanup, "."))) {

LGTM

Signature · 2 lines
Thank you,
Richard.
Applied
#2 lore raw

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

In reply to Steve Muckle

Hi,

Quoted 13 lines

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, 3 insertions(+)
testcases/kernel/syscalls/swapon/swapon03.c +0 -0
index d3f73b044fe1..955ac247b6a2 100644

testcases/kernel/syscalls/swapon/swapon03.c static void setup(void) · line 336

Quoted 9 lines
testcases/kernel/syscalls/swapon/swapon03.c +3 -0
@@ -328,6 +328,9 @@ static void setup(void)
 
 	tst_require_root();
 
+	if (access("/proc/swaps", F_OK))
+		tst_brkm(TCONF, NULL, "swap not supported by kernel");
+
 	tst_tmpdir();
 
 	switch ((fs_type = tst_fs_type(cleanup, "."))) {

Merged, thanks!

BTW I wonder which distros don't have CONFIG_SWAP=y. Some embedded or Android?

Kind regards,
Petr

#3 lore raw

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

Quoted 3 lines · Petr Vorel

BTW I wonder which distros don't have CONFIG_SWAP=y. Some embedded or Android?

Thanks. Yes the platform in my case is Android, though I could see other embedded platforms not using swap also.

cheers,
Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20180501/4fcb1c2d/attachment.html>