shell API: print environment variables in .h
cover shell API: print environment variables in .h
Petr Vorel (2):
tst_test.sh: Print environment variables in help
doc: Mention places for environment variables
doc/library-api-writing-guidelines.txt | 4 ++++ testcases/lib/tst_test.sh | 22 ++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-)
Signature · 5 lines
2.34.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 1/2 tst_test.sh: Print environment variables in help
to sync with C API.
Unlike C API environment variables are printed at the top, because we expect custom $TST_USAGE function prints part of the usage itself (but not all tests do).
--- testcases/lib/tst_test.sh | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
testcases/lib/tst_test.sh +20 -2
@@ -448,12 +448,30 @@ tst_usage() if [ -n "$TST_USAGE" ]; then $TST_USAGE else - echo "usage: $0" - echo "OPTIONS" + cat << EOF +usage: $0 + +Options +------- +EOF fi echo "-h Prints this help" echo "-i n Execute test n times" + + cat << EOF + +Environment Variables +--------------------- +KCONFIG_PATH Specify kernel config file +KCONFIG_SKIP_CHECK Skip kernel config check if variable set (not set by default) +LTPROOT Prefix for installed LTP (default: /opt/ltp) +LTP_COLORIZE_OUTPUT Force colorized output behaviour (y/1 always, n/0: never) +LTP_DEV Path to the block device to be used (for .needs_device) +LTP_DEV_FS_TYPE Filesystem used for testing (default: ext2) +LTP_TIMEOUT_MUL Timeout multiplier (must be a number >=1, ceiled to int) +TMPDIR Base directory for template directory (for .needs_tmpdir, default: /tmp) +EOF } _tst_resstr()
Signature · 5 lines
2.34.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 1/2] tst_test.sh: Print environment variables in help
For series:
Signature · 6 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 1/2] tst_test.sh: Print environment variables in help
In reply to Petr VorelHi!
Quoted 6 lines
testcases/lib/tst_test.sh +0
-0@@ -448,12 +448,30 @@ tst_usage() if [ -n "$TST_USAGE" ]; then
testcases/lib/tst_test.sh tst_usage() · line 456
Quoted 10 lines
testcases/lib/tst_test.sh +6
-2$TST_USAGE else - echo "usage: $0" - echo "OPTIONS" + cat << EOF +usage: $0 + +Options +------- +EOF
I think that the cat EOF syntax inside of else branch is a bit confusing, especially sice it prints just three lines of text...
But other than that:
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 1/2] tst_test.sh: Print environment variables in help
Quoted 12 lines
Hi!
Quoted 11 lines
testcases/lib/tst_test.sh +1
-2@@ -448,12 +448,30 @@ tst_usage() if [ -n "$TST_USAGE" ]; then $TST_USAGE else - echo "usage: $0" - echo "OPTIONS" + cat << EOF
Quoted 8 lines
testcases/lib/tst_test.sh tst_usage() · line 456
Quoted 5 lines
testcases/lib/tst_test.sh +5
-0+usage: $0 + +Options +------- +EOFI think that the cat EOF syntax inside of else branch is a bit confusing, especially sice it prints just three lines of text...
Good point, I'll replace it with echo.
Quoted 3 lines
But other than that:
Reviewed-by Cyril Hrubis <[email protected]>
How about dropping this?
echo "usage: $0"
(as a separate commit, I'd sent v2)
Because we don't support it in C API, is it really required to have it in shell.
I mean it's useful to show which options are mandatory or which cannot be combined together etc. But in reality most of shell tests does not add it and thus they are missing "OPTIONS" line (sure, I can add usage to them if you think it's useful).
OTOH some tests have really complex setup, i.e. testcases/network/netstress/netstress.c, that adding a support for usage string would help them.
If you notice there were extra new lines (\n) to separate client and server side to make help at least a bit readable, but Andrea removed them in 98af9ecf9e ("tst_test: Complete help message adding option before desc"):
git show --word-diff 98af9ecf9e334c07251f2f464191635f161a1603 testcases/network/netstress/netstress.c
These extra lines would not be needed when sort of usage added to C API. I can add it, but I'm aware it's so minor, that I'm wasting a time of all of us.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 1/2] tst_test.sh: Print environment variables in help
Hi Cyril, Li,
Quoted 21 lines
Quoted 12 lines
Hi!
Quoted 11 lines
testcases/lib/tst_test.sh +1
-2@@ -448,12 +448,30 @@ tst_usage() if [ -n "$TST_USAGE" ]; then $TST_USAGE else - echo "usage: $0" - echo "OPTIONS" + cat << EOFQuoted 8 lines
testcases/lib/tst_test.sh tst_usage() · line 456
Quoted 5 lines
testcases/lib/tst_test.sh +5
-0+usage: $0 + +Options +------- +EOFI think that the cat EOF syntax inside of else branch is a bit confusing, especially sice it prints just three lines of text...
Quoted 1 line
Good point, I'll replace it with echo.
FYI merged with replaced echo.
Quoted 20 lines
Quoted 3 lines
But other than that:
Reviewed-by Cyril Hrubis <[email protected]>How about dropping this?
echo "usage: $0"(as a separate commit, I'd sent v2)
Because we don't support it in C API, is it really required to have it in shell.
I mean it's useful to show which options are mandatory or which cannot be combined together etc. But in reality most of shell tests does not add it and thus they are missing "OPTIONS" line (sure, I can add usage to them if you think it's useful).
OTOH some tests have really complex setup, i.e.
testcases/network/netstress/netstress.c, that adding a support for usage string would help them.
Quoted 8 lines
If you notice there were extra new lines (\n) to separate client and server side to make help at least a bit readable, but Andrea removed them in
98af9ecf9e("tst_test: Complete help message adding option before desc"):git show --word-diff
98af9ecf9e334c07251f2f464191635f161a1603testcases/network/netstress/netstress.cThese extra lines would not be needed when sort of usage added to C API. I can add it, but I'm aware it's so minor, that I'm wasting a time of all of us.
FYI I'll probably add options string for shell and might add support for C API to have help (would be useful for netstress.c).
Kind regards,
Petr
Quoted 2 lines
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 2/2 doc: Mention places for environment variables
In reply to Petr Vorel--- doc/library-api-writing-guidelines.txt | 4 ++++ 1 file changed, 4 insertions(+)
doc/library-api-writing-guidelines.txt +4 -0
@@ -18,6 +18,10 @@ Library tests are in 'lib/newlib_tests' directory. Don't forget to update docs when you change the API. +Environment variables should be listed in +https://github.com/linux-test-project/ltp/wiki/User-Guidelines[LTP User Guidelines] +and in help output (`-h`) for both C and shell API. + 2. C API --------
Signature · 5 lines
2.34.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 2/2] doc: Mention places for environment variables
Hi!
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi,
Subject was meant to be: "shell API: print environment variables in -h"
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Petr
This patch series looks good to me,
Best Regards
Yang Xu
Quoted 8 lines
Petr Vorel (2):
tst_test.sh: Print environment variables in help
doc: Mention places for environment variablesdoc/library-api-writing-guidelines.txt | 4 ++++ testcases/lib/tst_test.sh | 22 ++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-)
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp