From: Joerg Vehlow <lkml@jv-coder.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 2/2] tst_test.sh: Add public tst_test_root command
Date: Wed, 9 Oct 2019 08:16:19 +0200 [thread overview]
Message-ID: <20191009061619.48677-3-lkml@jv-coder.de> (raw)
In-Reply-To: <20191009061619.48677-1-lkml@jv-coder.de>
From: Joerg Vehlow <joerg.vehlow@aox-tech.de>
If a test requires root only under certan circumstances, TST_NEEDS_ROOT
is not sufficient, because it always requires root.
---
testcases/lib/tst_test.sh | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index c70a5abbe..07712670d 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -326,6 +326,13 @@ tst_check_cmds()
return 0
}
+tst_test_root()
+{
+ if [ "$(id -ru)" != 0 ]; then
+ tst_brk TCONF "Must be super/root for this test!"
+ fi
+}
+
tst_test_drivers()
{
[ $# -eq 0 ] && return 0
@@ -389,13 +396,6 @@ _tst_setup_timer()
_tst_setup_timer_pid=$!
}
-_tst_require_root()
-{
- if [ "$(id -ru)" != 0 ]; then
- tst_brk TCONF "Must be super/root for this test!"
- fi
-}
-
_tst_find_module()
{
local _tst_module=$1
@@ -469,7 +469,7 @@ tst_run()
tst_brk TBROK "Number of iterations (-i) must be > 0"
fi
- [ "$TST_NEEDS_ROOT" = 1 ] && _tst_require_root
+ [ "$TST_NEEDS_ROOT" = 1 ] && tst_test_root
[ "$TST_DISABLE_APPARMOR" = 1 ] && tst_disable_apparmor
[ "$TST_DISABLE_SELINUX" = 1 ] && tst_disable_selinux
--
2.20.1
next prev parent reply other threads:[~2019-10-09 6:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-09 6:16 [LTP] Add TST_USES_MODULE and tst_test_root Joerg Vehlow
2019-10-09 6:16 ` [LTP] [PATCH 1/2] tst_test.sh: Add TST_USES_MODULE Joerg Vehlow
2019-10-09 7:36 ` Petr Vorel
2019-10-09 7:48 ` Joerg Vehlow
2019-10-09 6:16 ` Joerg Vehlow [this message]
2019-10-09 6:52 ` [LTP] [PATCH 2/2] tst_test.sh: Add public tst_test_root command Petr Vorel
2019-10-09 6:57 ` Joerg Vehlow
2019-10-09 7:53 ` Petr Vorel
2019-10-09 11:39 ` Cyril Hrubis
2019-10-09 11:43 ` Joerg Vehlow
2019-10-09 11:48 ` Cyril Hrubis
2019-10-09 11:53 ` Joerg Vehlow
2019-10-09 12:28 ` Cyril Hrubis
2019-10-11 8:36 ` Petr Vorel
2019-10-11 8:39 ` Joerg Vehlow
2019-10-11 8:20 ` Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191009061619.48677-3-lkml@jv-coder.de \
--to=lkml@jv-coder.de \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.