Convert chdir01 to the new API
PATCH v2 1/2 Convert chdir01 to the new API
chdir02 and chdir03 were removed because the updated chdir01 makes them redundant.
---
Changes since v1:
- Require root privileges and run the test on all file systems
- Fixed expected return value for directory with 0644 access mode
- Added test case for chdir("/");
- Improved chdir() return value/errno checks
runtest/quickhit | 2 +- runtest/syscalls | 2 - testcases/kernel/syscalls/chdir/.gitignore | 2 - testcases/kernel/syscalls/chdir/chdir01.c | 247 ++++++++------------- testcases/kernel/syscalls/chdir/chdir02.c | 163 -------------- testcases/kernel/syscalls/chdir/chdir03.c | 68 ------ 6 files changed, 91 insertions(+), 393 deletions(-) delete mode 100644 testcases/kernel/syscalls/chdir/chdir02.c delete mode 100644 testcases/kernel/syscalls/chdir/chdir03.c
runtest/quickhit +1 -1
@@ -24,7 +24,7 @@ brk01 brk01 # Basic test for brk() # TEST CASES # 1.) brk(2) returns... -chdir02 chdir02 +chdir01 chdir01 # Basic test for chdir(2) # TEST CASES # 1.) chdir(2) returns...
runtest/syscalls +0 -2
@@ -55,8 +55,6 @@ cacheflush01 cacheflush01 chdir01 chdir01 chdir01A symlink01 -T chdir01 -chdir02 chdir02 -chdir03 chdir03 chdir04 chdir04 chmod01 chmod01
testcases/kernel/syscalls/chdir/.gitignore +0 -2
@@ -1,4 +1,2 @@ /chdir01 -/chdir02 -/chdir03 /chdir04
testcases/kernel/syscalls/chdir/chdir01.c +90 -157
271 lines not on this page · raw message
testcases/kernel/syscalls/chdir/chdir02.c deleted +0 -163
163 lines not on this page · raw message
testcases/kernel/syscalls/chdir/chdir03.c deleted +0 -68
68 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH v2 2/2 Add chdir() test for unprivileged user
chdir01 tests chdir() return values with root permissions. chdir02 does the same test scenario with EUID set to nobody.
---
Changes since v1: New patch
runtest/syscalls | 1 + testcases/kernel/syscalls/chdir/.gitignore | 1 + testcases/kernel/syscalls/chdir/chdir02.c | 134 +++++++++++++++++++++ 3 files changed, 136 insertions(+) create mode 100644 testcases/kernel/syscalls/chdir/chdir02.c
runtest/syscalls +1 -0
@@ -54,6 +54,7 @@ capset04 capset04 cacheflush01 cacheflush01 chdir01 chdir01 +chdir02 chdir02 chdir01A symlink01 -T chdir01 chdir04 chdir04
testcases/kernel/syscalls/chdir/.gitignore +1 -0
@@ -1,2 +1,3 @@ /chdir01 +/chdir02 /chdir04
testcases/kernel/syscalls/chdir/chdir02.c new file +134 -0
134 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH v2 2/2 Add chdir() test for unprivileged user
Hi Martin,
runtest/syscalls capset04 capset04 · line 59
Quoted 8 lines
+++ b/runtest/syscalls
runtest/syscalls +1
-0@@ -54,6 +54,7 @@ capset04 capset04 cacheflush01 cacheflush01 chdir01 chdir01 +chdir02 chdir02 chdir01A symlink01 -T chdir01 chdir04 chdir04
You missed to add chdir02 to runtest/quickhit. I guess this was deliberate, right?
(I wonder if we really need runtest/quickhit anyway).
I like both tests (nice work, thanks!), just don't like the duplicity. Isn't there a way to use getopt parameter for one of the variants and have just single test? But understand if you don't bother with it (maybe better duplicity but simpler code).
Other that that LGTM.
Kind regards,
Petr
PATCH v2 2/2 Add chdir() test for unprivileged user
Quoted 6 lines · Petr Vorel
Hi Martin,
Quoted 3 lines
+++ b/runtest/syscalls
runtest/syscalls +0
-0@@ -54,6 +54,7 @@ capset04 capset04 cacheflush01 cacheflush01
Quoted 7 lines
runtest/syscalls capset04 capset04 · line 59
Quoted 4 lines
runtest/syscalls +1
-0chdir01 chdir01 +chdir02 chdir02 chdir01A symlink01 -T chdir01 chdir04 chdir04You missed to add chdir02 to runtest/quickhit. I guess this was deliberate, right?
(I wonder if we really need runtest/quickhit anyway).
Yes, this was deliberate since only chdir02 was there originally (the one that was checking only chdir("/"); and chdir("/etc");.
Quoted 7 lines
I like both tests (nice work, thanks!), just don't like the duplicity. Isn't there a way to use getopt parameter for one of the variants and have just single test? But understand if you don't bother with it (maybe better duplicity but simpler code).
Other that that LGTM.
Reviewed-by Petr Vorel <[email protected]>
I could add a second set of expected values to the test case list and do it like this:
static void run(unsigned int n) {
TEST(chdir(tc->name));
/* result validation here */
SAFE_SETEUID(ltpuser->pw_uid);
TEST(chdir(tc->name));
SAFE_SETEUID(0);
/* result validation here */
}Should I resubmit that as v3?
Signature · 7 lines
Martin Doucha [email protected] QA Engineer for Software Maintenance SUSE LINUX, s.r.o. CORSO IIa Krizikova 148/34 186 00 Prague 8 Czech Republic
PATCH v2 2/2 Add chdir() test for unprivileged user
Hi Martin,
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
+++ b/runtest/syscalls
runtest/syscalls +1
-0@@ -54,6 +54,7 @@ capset04 capset04 cacheflush01 cacheflush01 chdir01 chdir01 +chdir02 chdir02 chdir01A symlink01 -T chdir01 chdir04 chdir04
Quoted 6 lines
Quoted 3 lines
You missed to add chdir02 to runtest/quickhit. I guess this was deliberate, right?
(I wonder if we really need runtest/quickhit anyway).Yes, this was deliberate since only chdir02 was there originally (the one that was checking only
chdir("/"); andchdir("/etc");.
Understand, thanks for info.
Quoted 11 lines
Quoted 7 lines
I like both tests (nice work, thanks!), just don't like the duplicity. Isn't there a way to use getopt parameter for one of the variants and have just single test? But understand if you don't bother with it (maybe better duplicity but simpler code).
Other that that LGTM.
Reviewed-by Petr Vorel <[email protected]>I could add a second set of expected values to the test case list and do it like this:
Quoted 8 lines
static void run(unsigned int n) {
TEST(chdir(tc->name));
/* result validation here */
SAFE_SETEUID(ltpuser->pw_uid);
TEST(chdir(tc->name));
SAFE_SETEUID(0);
/* result validation here */
}LGTM, thank you!
Quoted 1 line
Should I resubmit that as v3?
Yes, please.
Kind regards,
Petr