Skip to contentSkip to conversation

acct01: fix cleanup function

PATCH In review Honggyu Kim 2 participants 2 messages Nov 4, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 acct01: fix cleanup function

Currently, additional test for acct is done in cleanup.
This was not originally intended because TCONF case will also invoke cleanup function to finish and it will finally goes to TBROK, not TCONF. This patch removes the additional acct execution in cleanup.

---
 testcases/kernel/syscalls/acct/acct01.c |    3 ---
 1 file changed, 3 deletions(-)
testcases/kernel/syscalls/acct/acct01.c +0 -3
index 0fe973b..53376ae 100644
@@ -165,8 +165,5 @@ static void cleanup(void)
 {
 	TEST_CLEANUP;
 
-	if (acct(NULL) == -1)
-		tst_resm(TBROK | TERRNO, "acct(NULL) failed");
-
 	tst_rmdir();
 }
Signature · 14 lines
1.7.9.5



------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw

Hi!

Quoted 15 lines

Currently, additional test for acct is done in cleanup.
This was not originally intended because TCONF case will also invoke cleanup function to finish and it will finally goes to TBROK, not TCONF. This patch removes the additional acct execution in cleanup.

---
 testcases/kernel/syscalls/acct/acct01.c |    3 ---
 1 file changed, 3 deletions(-)
testcases/kernel/syscalls/acct/acct01.c +0 -0
index 0fe973b..53376ae 100644

testcases/kernel/syscalls/acct/acct01.c static void cleanup(void) · line 169

Quoted 8 lines
testcases/kernel/syscalls/acct/acct01.c +0 -3
@@ -165,8 +165,5 @@ static void cleanup(void)
 {
 	TEST_CLEANUP;
 
-	if (acct(NULL) == -1)
-		tst_resm(TBROK | TERRNO, "acct(NULL) failed");
-
 	tst_rmdir();
 }

This does not seem to be right. The acct(NULL) should turn off the process accounting so this is not a test for acct() but rather an attempt to restore the system to the previous state.

So the correct solution would be to call acct(NULL) first in the setup and if that failed with ENOSYS, exit the test with TCONF without calling the cleanup (if we do this check before the tst_tmpdir() we don't have to do any cleanup). Then we can also remove all checks for ENOSYS from the rest of the code.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list