Hi,
Attached a small patch that cleanup a few syscalls (nice01,
quotactl01, setgroups01 and setgroups02) to use common
tst_require_root() function instead of local version.
Hope this helps,
Regards.
--
Nicolas Joly
Biology IT Center
Institut Pasteur, Paris.
commit 001278174589946063caef4561feafeeaf08bbf7
Author: Nicolas Joly <nj...@pasteur.fr>
Date: Sun Mar 1 16:28:29 2015 +0100
Cleanup nice01, quotactl01, setgroups01 and setgroups02 syscalls.
Use tst_require_root() instead of local version.
Signed-off-by: Nicolas Joly <nj...@pasteur.fr>
diff --git a/testcases/kernel/syscalls/nice/nice01.c
b/testcases/kernel/syscalls/nice/nice01.c
index 5217eb7..fd75ea5 100644
--- a/testcases/kernel/syscalls/nice/nice01.c
+++ b/testcases/kernel/syscalls/nice/nice01.c
@@ -142,12 +142,9 @@ int main(int ac, char **av)
void setup(void)
{
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
+ tst_require_root(NULL);
- /* Make sure the calling process is super-user only */
- if (geteuid() != 0) {
- tst_brkm(TBROK, NULL, "Must be ROOT to run this test.");
- }
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
TEST_PAUSE;
diff --git a/testcases/kernel/syscalls/quotactl/quotactl01.c
b/testcases/kernel/syscalls/quotactl/quotactl01.c
index d431575..3f6564f 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl01.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl01.c
@@ -136,13 +136,11 @@ void cleanup(void)
void setup(void)
{
+ tst_require_root(NULL);
+
/* Capture signals if any */
/* Create temporary directories */
- if (geteuid() != 0) {
- tst_brkm(TCONF, NULL,
- "You must be root in order to execute this test");
- }
if ((quota_loc = malloc(FILENAME_MAX)) == NULL) {
tst_brkm(TCONF | TERRNO, NULL,
"couldn't allocate memory for the quota loc buffer");
diff --git a/testcases/kernel/syscalls/setgroups/setgroups01.c
b/testcases/kernel/syscalls/setgroups/setgroups01.c
index 3f7e008..f3406b2 100644
--- a/testcases/kernel/syscalls/setgroups/setgroups01.c
+++ b/testcases/kernel/syscalls/setgroups/setgroups01.c
@@ -182,10 +182,9 @@ int main(int ac, char **av)
void setup(void)
{
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
+ tst_require_root(NULL);
- if (geteuid() != 0)
- tst_brkm(TBROK, cleanup, "Must be ROOT to run this test.");
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
TEST_PAUSE;
diff --git a/testcases/kernel/syscalls/setgroups/setgroups02.c
b/testcases/kernel/syscalls/setgroups/setgroups02.c
index 0f346a2..d53d4d5 100644
--- a/testcases/kernel/syscalls/setgroups/setgroups02.c
+++ b/testcases/kernel/syscalls/setgroups/setgroups02.c
@@ -151,12 +151,9 @@ int main(int ac, char **av)
void setup(void)
{
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
+ tst_require_root(NULL);
- /* Make sure the calling process is super-user only */
- if (geteuid() != 0) {
- tst_brkm(TBROK, NULL, "Must be ROOT to run this test.");
- }
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
TEST_PAUSE;
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list