Skip to contentSkip to conversation

syscalls/access01: Set umask value before run case

PATCH New Bixuan Cui 3 participants 8 messages Sep 19, 2017 – Oct 9, 2017

lore
Share & tools
lore

Bixuan Cui

author
#0 lore raw

PATCH 1/1 syscalls/access01: Set umask value before run case

The case will fail when set the umask to 0077 acquiescently in system. Because the value of actual mode is 'set value' & ~'default value for the umask' when create dir.
So add 'umask(0022)' in setup().

---
 testcases/kernel/syscalls/access/access01.c | 2 ++
 1 file changed, 2 insertions(+)
testcases/kernel/syscalls/access/access01.c +2 -0
index 7a92525..b679832 100644
@@ -315,6 +315,8 @@ static void setup(void)
 {
 	struct passwd *pw;
 
+	umask(0022);
+
 	pw = SAFE_GETPWNAM("nobody");
 
 	uid = pw->pw_uid;

--
2.6.2

#1 lore raw

PATCH 1/1 syscalls/access01: Set umask value before run case

----- Original Message -----

Quoted 4 lines

The case will fail when set the umask to 0077 acquiescently in system. Because the value of actual mode is 'set value' & ~'default value for the umask' when create dir.
So add 'umask(0022)' in setup().

We do umask(0) in ltp-pan:

# umask
0077
# /opt/ltp/runltp -p -d results -l RUNTEST.log -o RUNTEST.run.log -s access01 -f syscalls > /dev/null
# cat /opt/ltp/results/RUNTEST.log
Test Start Time: Fri Sep 22 14:24:28 2017
-----------------------------------------
Testcase                       Result     Exit Value
--------                       ------     ----------
access01                       PASS       0    

I'm aware that running tests outside of ltp-pan is sometimes useful, so maybe we could add this to a library rather than in each test separately? What do you think Cyril?

Regards,
Jan

author
#2 lore raw

PATCH 1/1 syscalls/access01: Set umask value before run case

Quoted 22 lines · Jan Stancek

----- Original Message -----

Quoted 4 lines

The case will fail when set the umask to 0077 acquiescently in system. Because the value of actual mode is 'set value' & ~'default value for the umask' when create dir.
So add 'umask(0022)' in setup().

We do umask(0) in ltp-pan:

# umask
0077
# /opt/ltp/runltp -p -d results -l RUNTEST.log -o RUNTEST.run.log -s access01 -f syscalls > /dev/null
# cat /opt/ltp/results/RUNTEST.log
Test Start Time: Fri Sep 22 14:24:28 2017
-----------------------------------------
Testcase                       Result     Exit Value
--------                       ------     ----------
access01                       PASS       0    
Quoted 3 lines

I'm aware that running tests outside of ltp-pan is sometimes useful, so maybe we could add this to a library rather than in each test separately? What do you think Cyril?

Yes, I shouldn't run it without runltp script.

Thanks,
Bixuan Cui

Quoted 5 lines

Regards,
Jan

#3 lore raw

PATCH 1/1 syscalls/access01: Set umask value before run case

In reply to Jan Stancek

Hi!

Quoted 14 lines

We do umask(0) in ltp-pan:

# umask
0077
# /opt/ltp/runltp -p -d results -l RUNTEST.log -o RUNTEST.run.log -s access01 -f syscalls > /dev/null
# cat /opt/ltp/results/RUNTEST.log
Test Start Time: Fri Sep 22 14:24:28 2017
-----------------------------------------
Testcase                       Result     Exit Value
--------                       ------     ----------
access01                       PASS       0    
Quoted 3 lines

I'm aware that running tests outside of ltp-pan is sometimes useful, so maybe we could add this to a library rather than in each test separately? What do you think Cyril?

Running tests outside ltp-pan should indeed possible but I'm not sure that we want to change the umask in the test library. Most of the testcases will run with the more restrictive umask just fine and I would rather test the system in the default configuration. So changing it in the test setup in this case sounds reasonable to me.

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

PATCH 1/1 syscalls/access01: Set umask value before run case

----- Original Message -----

Quoted 20 lines

Hi!

Quoted 15 lines

We do umask(0) in ltp-pan:

# umask
0077
# /opt/ltp/runltp -p -d results -l RUNTEST.log -o RUNTEST.run.log -s
access01 -f syscalls > /dev/null
# cat /opt/ltp/results/RUNTEST.log
Test Start Time: Fri Sep 22 14:24:28 2017
-----------------------------------------
Testcase                       Result     Exit Value
--------                       ------     ----------
access01                       PASS       0
Quoted 3 lines

I'm aware that running tests outside of ltp-pan is sometimes useful, so maybe we could add this to a library rather than in each test separately? What do you think Cyril?

Quoted 5 lines

Running tests outside ltp-pan should indeed possible but I'm not sure that we want to change the umask in the test library. Most of the testcases will run with the more restrictive umask just fine and I would rather test the system in the default configuration. So changing it in the test setup in this case sounds reasonable to me.

OK, Will you push the patch?

Regards,
Jan

#5 lore raw

PATCH 1/1 syscalls/access01: Set umask value before run case

Hi!

Quoted 1 line

OK, Will you push the patch?

Done.

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

PATCH 1/1 syscalls/access01: Set umask value before run case

Quoted 2 lines · Cyril Hrubis

Hi!
I've reworded the commit message and pushed, thanks.

Thanks,
Bixuan Cui

Quoted 1 line