Skip to contentSkip to conversation

shell: Remove tst_su

RFC PATCH New Petr Vorel 2 participants 3 messages Mar 27, 2019

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

RFC PATCH 1/1 shell: Remove tst_su

tst_su was added into legacy (but at the time the only) shell API in commit cd9a41dff ("test.sh: Add tst_su"). It was never used nor added into new shell API, thus removing.

---
 doc/test-writing-guidelines.txt | 25 +------------------------
 testcases/lib/test.sh           |  9 ---------
 2 files changed, 1 insertion(+), 33 deletions(-)
doc/test-writing-guidelines.txt +1 -24
index 3b8541e7a..f1912dc12 100644
@@ -1470,7 +1470,7 @@ setup(). The function will generate a TCONF if the requested flags are not
 fully supported on the running kernel, and TBROK if either a zero mask was
 supplied or if the kernel is already tainted before executing the test.
 
-Then you can call tst_taint_check() during run(), which returns 0 or the 
+Then you can call tst_taint_check() during run(), which returns 0 or the
 tainted flags set in /proc/sys/kernel/tainted as specified earlier.
 
 Depending on your kernel version, not all tainted-flags will be supported.
@@ -2122,29 +2122,6 @@ is a workaround since there are a daemons dumb enough to probe all newly
 mounted filesystems, which prevents them from umounting shortly after they
 were mounted.
 
-Running commands as different user with 'su'
-++++++++++++++++++++++++++++++++++++++++++++
-
-While some distributions retain paths added to +$PATH+ when doing
-+su user -c "command"+ this does not work at least in Debian. If you want to
-run LTP binaries as a different user you must use 'tst_su' instead which sets
-up +$PATH+ and the runs the command.
-
-.Run test child binary as a test user
-[source,sh]
--------------------------------------------------------------------------------
-#!/bin/sh
-TCID=foo01
-. test.sh
-
-tst_su testusr foo01_child
-if [ $? -ne 0 ]; then
-	tst_resm TFAIL "foo failed"
-else
-	tst_resm TPASS "foo passed"
-fi
--------------------------------------------------------------------------------
-
 ROD and ROD_SILENT
 ++++++++++++++++++
 
testcases/lib/test.sh +0 -9
index 954f2a22a..670248ee5 100644
@@ -368,15 +368,6 @@ tst_module_exists()
 	tst_brkm TCONF "Failed to find module '$mod_name'"
 }
 
-# Appends LTP path when doing su
-tst_su()
-{
-	local usr="$1"
-	shift
-
-	su "$usr" -c "PATH=\$PATH:$LTPROOT/testcases/bin/ $@"
-}
-
 TST_CHECKPOINT_WAIT()
 {
 	ROD tst_checkpoint wait 10000 "$1"
Signature · 1 line
2.21.0
#1 lore raw

RFC PATCH 1/1 shell: Remove tst_su

Hi!
Looks like we removed last user of that API in:

commit 0fc9b8624bea8acfdb408bf5ff4916b1453e3daa

Author: Petr Vorel <[email protected]>
Date:   Thu Sep 27 16:57:20 2018 +0200

Remove admin_tools test

Hence acked.

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

RFC PATCH 1/1 shell: Remove tst_su

Hi,

Quoted 11 lines

Hi!
Looks like we removed last user of that API in:

commit 0fc9b8624bea8acfdb408bf5ff4916b1453e3daa

Author: Petr Vorel <[email protected]>
Date:   Thu Sep 27 16:57:20 2018 +0200

Remove admin_tools test

Hence acked.

Thx! Pushed with adjusted commit message.

Kind regards,
Petr