From: Cyril H. <su...@li...> - 2012-06-28 15:56:57
|
The branch, master, has been updated via abcd7781da177e9e88ccb434a6320db0a27a962f (commit) via 182fd108d56e032d159292e0907c291472ec5dcc (commit) from c53503041d88596d07dff2a406f3033345d48e83 (commit) - Log ----------------------------------------------------------------- commit abcd7781da177e9e88ccb434a6320db0a27a962f Author: Cyril Hrubis <ch...@su...> Date: Thu Jun 28 17:45:48 2012 +0200 creat08: Use tst_tmpdir(). Signed-off-by: Cyril Hrubis <ch...@su...> commit 182fd108d56e032d159292e0907c291472ec5dcc Author: Cyril Hrubis <ch...@su...> Date: Wed Jun 27 15:39:31 2012 +0200 sysctl03: make use of tst_require_root() Signed-off-by: Cyril Hrubis <ch...@su...> ----------------------------------------------------------------------- Summary of changes: testcases/kernel/syscalls/creat/creat08.c | 9 +++++---- testcases/kernel/syscalls/sysctl/sysctl03.c | 25 +++++-------------------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/testcases/kernel/syscalls/creat/creat08.c b/testcases/kernel/syscalls/creat/creat08.c index 106bf1f..e28554e 100644 --- a/testcases/kernel/syscalls/creat/creat08.c +++ b/testcases/kernel/syscalls/creat/creat08.c @@ -431,14 +431,13 @@ int main(int ac, char **av) tst_exit(); } -static void -setup(void) +static void setup(void) { tst_require_root(NULL); + tst_tmpdir(); } -static void -cleanup(void) +static void cleanup(void) { if (unlink(setgid_A) == -1) { tst_resm(TBROK, "%s failed", setgid_A); @@ -461,4 +460,6 @@ cleanup(void) if (rmdir(DIR_B) == -1) { tst_brkm(TBROK|TERRNO, NULL, "rmdir %s failed", DIR_B); } + + tst_rmdir(); } diff --git a/testcases/kernel/syscalls/sysctl/sysctl03.c b/testcases/kernel/syscalls/sysctl/sysctl03.c index e67e8f0..f22ac12 100644 --- a/testcases/kernel/syscalls/sysctl/sysctl03.c +++ b/testcases/kernel/syscalls/sysctl/sysctl03.c @@ -162,7 +162,7 @@ int main(int ac, char **av) tst_brkm(TBROK, cleanup, "fork() failed"); } - if (pid == 0) { /* child */ + if (pid == 0) { TEST(sysctl(name, SIZE(name), 0, 0, osname, osnamelth)); if (TEST_RETURN != -1) { @@ -184,7 +184,7 @@ int main(int ac, char **av) cleanup(); - } else { /* parent */ + } else { /* wait for the child to finish */ wait(&status); } @@ -198,31 +198,16 @@ int main(int ac, char **av) tst_exit(); } -/* - * setup() - performs all ONE TIME setup for this test. - */ -void setup() +void setup(void) { - /* test must be run as root */ - if (geteuid() != 0) { - tst_brkm(TBROK, NULL, "Test must be run as root"); - } + tst_require_root(NULL); tst_sig(FORK, DEF_HANDLER, cleanup); TEST_PAUSE; } -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void cleanup() +void cleanup(void) { - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ TEST_CLEANUP; - } hooks/post-receive -- ltp |