diff mbox series

[RFC,3/3] doc: Update LTPROOT and PATH environment variables

Message ID 20210615163307.10755-4-pvorel@suse.cz
State Rejected
Headers show
Series C, shell API: Add $LTPROOT/testcases/bin into PATH | expand

Commit Message

Petr Vorel June 15, 2021, 4:33 p.m. UTC
to address changes in two previous commits.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 README.md          | 2 +-
 doc/user-guide.txt | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

Comments

Li Wang June 16, 2021, 9:42 a.m. UTC | #1
On Wed, Jun 16, 2021 at 12:33 AM Petr Vorel <pvorel@suse.cz> wrote:
>
> to address changes in two previous commits.
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  README.md          | 2 +-
>  doc/user-guide.txt | 7 +++++--
>  2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/README.md b/README.md
> index 703395c6b..b0ad47dfa 100644
> --- a/README.md
> +++ b/README.md
> @@ -162,7 +162,7 @@ $ testcases/bin/ioctl01 -h
>  Many require certain environment variables to be set
>
>  ```
> -$ LTPROOT=/opt/ltp PATH="$PATH:$LTPROOT/testcases/bin" testcases/bin/wc01.sh
> +$ LTPROOT=/opt/ltp testcases/bin/wc01.sh

I'm wondering does this really work? or, did I miss something?

Experiment in my kvm guest (with apply your patches):

# LTPROOT=/root/ltp-install wc01.sh
bash: wc01.sh: command not found...

# LTPROOT=/root/ltp-install testcases/bin/wc01.sh
-bash: testcases/bin/wc01.sh: No such file or directory

# LTPROOT=/root/ltp-install PATH="$PATH:$LTPROOT/testcases/bin" wc01.sh
wc01 1 TINFO: timeout per run is 0h 5m 0s
wc01 1 TPASS: wc passed with -c option.
wc01 2 TPASS: wc passed with --bytes option.
wc01 3 TPASS: wc passed with -l option.
wc01 4 TPASS: wc passed with --lines option.
wc01 5 TPASS: wc passed with -L option.
wc01 6 TPASS: wc passed with --max-line-length option.
wc01 7 TPASS: wc passed with -w option.
wc01 8 TPASS: wc passed with --words option.
wc01 9 TPASS: wc passed with -m option.
wc01 10 TPASS: wc passed with --chars option.
wc01 11 TPASS: wc passed with --help option.
wc01 12 TPASS: wc passed with --version option.

Summary:
passed   12
failed   0
broken   0
skipped  0
warnings 0
Petr Vorel June 16, 2021, 10:01 a.m. UTC | #2
Hi Li,

> > -$ LTPROOT=/opt/ltp PATH="$PATH:$LTPROOT/testcases/bin" testcases/bin/wc01.sh
> > +$ LTPROOT=/opt/ltp testcases/bin/wc01.sh

> I'm wondering does this really work? or, did I miss something?
Oops, I'm sorry to send broken patchset, this is obviously wrong.
We have to keep path set when calling script directly, because tst_test.sh would
be missing.

when in LPTROOT directory:
LTPROOT=/opt/ltp testcases/bin/wc01.sh
testcases/bin/wc01.sh: line 13: .: tst_test.sh: file not found

But we don't want to set path in each script nor load library as
. testcases/bin/tst_test.sh

Thus I guess setting PATH in LTP API doesn't make much sense if it works only
when using LTP runner (runltp{,-ng}, which BTW set path as well.
=> closing this.

> Experiment in my kvm guest (with apply your patches):

> # LTPROOT=/root/ltp-install wc01.sh
> bash: wc01.sh: command not found...
I would not expect this to be running, for this you obviously need to have set
PATH correctly.

> # LTPROOT=/root/ltp-install testcases/bin/wc01.sh
> -bash: testcases/bin/wc01.sh: No such file or directory
Nor this one.

Kind regards,
Petr

> # LTPROOT=/root/ltp-install PATH="$PATH:$LTPROOT/testcases/bin" wc01.sh
> wc01 1 TINFO: timeout per run is 0h 5m 0s
> wc01 1 TPASS: wc passed with -c option.
> wc01 2 TPASS: wc passed with --bytes option.
> wc01 3 TPASS: wc passed with -l option.
> wc01 4 TPASS: wc passed with --lines option.
> wc01 5 TPASS: wc passed with -L option.
> wc01 6 TPASS: wc passed with --max-line-length option.
> wc01 7 TPASS: wc passed with -w option.
> wc01 8 TPASS: wc passed with --words option.
> wc01 9 TPASS: wc passed with -m option.
> wc01 10 TPASS: wc passed with --chars option.
> wc01 11 TPASS: wc passed with --help option.
> wc01 12 TPASS: wc passed with --version option.

> Summary:
> passed   12
> failed   0
> broken   0
> skipped  0
> warnings 0
Li Wang June 16, 2021, 10:21 a.m. UTC | #3
On Wed, Jun 16, 2021 at 6:02 PM Petr Vorel <pvorel@suse.cz> wrote:
>
> Hi Li,
>
> > > -$ LTPROOT=/opt/ltp PATH="$PATH:$LTPROOT/testcases/bin" testcases/bin/wc01.sh
> > > +$ LTPROOT=/opt/ltp testcases/bin/wc01.sh
>
> > I'm wondering does this really work? or, did I miss something?
> Oops, I'm sorry to send broken patchset, this is obviously wrong.
> We have to keep path set when calling script directly, because tst_test.sh would
> be missing.
>
> when in LPTROOT directory:
> LTPROOT=/opt/ltp testcases/bin/wc01.sh
> testcases/bin/wc01.sh: line 13: .: tst_test.sh: file not found
>
> But we don't want to set path in each script nor load library as
> . testcases/bin/tst_test.sh
>
> Thus I guess setting PATH in LTP API doesn't make much sense if it works only
> when using LTP runner (runltp{,-ng}, which BTW set path as well.

Exactly :).
diff mbox series

Patch

diff --git a/README.md b/README.md
index 703395c6b..b0ad47dfa 100644
--- a/README.md
+++ b/README.md
@@ -162,7 +162,7 @@  $ testcases/bin/ioctl01 -h
 Many require certain environment variables to be set
 
 ```
-$ LTPROOT=/opt/ltp PATH="$PATH:$LTPROOT/testcases/bin" testcases/bin/wc01.sh
+$ LTPROOT=/opt/ltp testcases/bin/wc01.sh
 ```
 
 Most commonly, the path variable needs to be set and also `LTPROOT`, but there
diff --git a/doc/user-guide.txt b/doc/user-guide.txt
index 8df29e688..ab2d773a7 100644
--- a/doc/user-guide.txt
+++ b/doc/user-guide.txt
@@ -11,6 +11,7 @@  For running LTP network tests see `testcases/network/README.md`.
 | 'KCONFIG_PATH'        | The path to the kernel config file, (if not set, it tries
                           the usual paths '/boot/config-RELEASE' or '/proc/config.gz').
 | 'LTPROOT'             | Prefix for installed LTP, the default is '/opt/ltp'.
+                          Used for setting 'PATH' and other environment variables.
 | 'LTP_COLORIZE_OUTPUT' | Force colorized output behaviour. 'y' or '1': always colorize
                           'n' or '0': never colorize.
 | 'LTP_DEV'             | Path to the block device to be used
@@ -19,8 +20,10 @@  For running LTP network tests see `testcases/network/README.md`.
 | 'LTP_TIMEOUT_MUL'     | Multiply timeout, must be number >= 1 (> 1 is useful for
                           slow machines to avoid unexpected timeout).
                           Variable is also used in shell tests, but ceiled to int.
-| 'PATH'                | It's required to addjust path:
-                          `PATH="$PATH:$LTPROOT/testcases/bin"`
+| 'PATH'                | Testcases are installed into 'LTPROOT/testcases/bin',
+                          'PATH' is set by library API. You need to add it into
+                          'PATH' only if you use custom runner (not runltp neither
+                          [runltp-ng](https://github.com/metan-ucw/runltp-ng).
 | 'TMPDIR'              | Base directory for template directory (C: '.needs_tmpdir = 1'
                           and others, which imply it, shell: 'TST_NEEDS_TMPDIR=1').
 | 'TST_NO_CLEANUP'      | Disable running test cleanup (defined in 'TST_CLEANUP').