Skip to contentSkip to conversation

mtest05/mmstress: Fix failure on read-only system

PATCH New [email protected] 2 participants 4 messages Mar 10, 2017 – Mar 27, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtest05/mmstress: Fix failure on read-only system

From: Hoang Nguyen <[email protected]>

In order not to fail the test on read-only system, we used tst_tmpdir to create temporary folder to run the test. Then remove it with tst_rmdir after test finished (or test failed at the middle).

Fixes #87.

---
 testcases/kernel/mem/mtest05/mmstress.c | 3 +++
 1 file changed, 3 insertions(+)
testcases/kernel/mem/mtest05/mmstress.c +3 -0
index 0240a83..cbbc181 100644
@@ -832,6 +832,7 @@ int main(int argc,		/* number of command line parameters                     */
 	optarg = NULL;
 	opterr = 0;
 
+	tst_tmpdir();
 	if (argc < 2)
 		tst_resm(TINFO, "run %s -h for all options", argv[0]);
 
@@ -937,6 +938,7 @@ int main(int argc,		/* number of command line parameters                     */
 
 		if (global_rc != SUCCESS) {
 			tst_resm(TFAIL, "Test Failed");
+			tst_rmdir();
 			exit(global_rc);
 		}
 
@@ -947,5 +949,6 @@ int main(int argc,		/* number of command line parameters                     */
 	} else {
 		tst_resm(TPASS, "Test Passed");
 	}
+	tst_rmdir();
 	exit(global_rc);
 }
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 mtest05/mmstress: Fix failure on read-only system

Hi,
Could you help to check, so that we can close the Issue ? Thanks and regards
Hoang
Sent from Yahoo Mail on Android

On Fri, Mar 10, 2017 at 7:48, [email protected]<[email protected]> wrote: From: Hoang Nguyen <[email protected]>

In order not to fail the test on read-only system, we used tst_tmpdir to create temporary folder to run the test. Then remove it with tst_rmdir after test finished (or test failed at the middle).

Fixes #87.

---
 testcases/kernel/mem/mtest05/mmstress.c | 3 +++
 1 file changed, 3 insertions(+)
testcases/kernel/mem/mtest05/mmstress.c +3 -0
index 0240a83..cbbc181 100644
@@ -832,6 +832,7 @@ int main(int argc,        /* number of command line parameters                    */
     optarg = NULL;
     opterr = 0;
 
+    tst_tmpdir();
     if (argc < 2)
         tst_resm(TINFO, "run %s -h for all options", argv[0]);
 
@@ -937,6 +938,7 @@ int main(int argc,        /* number of command line parameters                    */
 
         if (global_rc != SUCCESS) {
             tst_resm(TFAIL, "Test Failed");
+            tst_rmdir();
             exit(global_rc);
         }
 
@@ -947,5 +949,6 @@ int main(int argc,        /* number of command line parameters                    */
     } else {
         tst_resm(TPASS, "Test Passed");
     }
+    tst_rmdir();
     exit(global_rc);
 }
Signature · 6 lines
2.7.4

  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20170322/3dff5a53/attachment.html>
#2 lore raw

PATCH 1/1 mtest05/mmstress: Fix failure on read-only system

In reply to [email protected]

Hi!
This was broken for when the test was passed the -t option since in that case the alarm called exit(). Well the -t option was broken anyway, since it did exit(0) regardless of the result of the test functions.

So I've cleaned up the test a bit so that SIGALRM only sets a flag that causes the main loop to exit and also to call tst_exit() properly and then added the tst_tmpdir() and tst_rmdir() calls.

Signature · 2 lines
Cyril Hrubis
[email protected]
#3 lore raw

PATCH 1/1 mtest05/mmstress: Fix failure on read-only system

Hi,
Thanks Cyril. I can see it passed on my board.
Thanks a lot for your help.
Best regards,
Hoang

Sent from Yahoo Mail on Android

On Wed, Mar 22, 2017 at 23:50, Cyril Hrubis<[email protected]> wrote: Hi!
This was broken for when the test was passed the -t option since in that case the alarm called exit(). Well the -t option was broken anyway, since it did exit(0) regardless of the result of the test functions.

So I've cleaned up the test a bit so that SIGALRM only sets a flag that causes the main loop to exit and also to call tst_exit() properly and then added the tst_tmpdir() and tst_rmdir() calls.

Signature · 6 lines
Cyril Hrubis
[email protected]
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20170327/2d059a84/attachment.html>