public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 0/3] Cleanup environment variables prefixes
@ 2024-01-04 12:23 Petr Vorel
  2024-01-04 12:23 ` [LTP] [PATCH 1/3] lib: Use LTP_ prefix for LTP_ENABLE_DEBUG variable Petr Vorel
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Petr Vorel @ 2024-01-04 12:23 UTC (permalink / raw)
  To: ltp

Hi,

this is a cleanup work based on discussion:

https://lore.kernel.org/ltp/CAEemH2fwu+LSBrsQh6x6C-QsOLJ5O33xMYHG7wjbiPfN4D=fMw@mail.gmail.com/

I'd like to get it merged before release (TST_ENABLE_DEBUG has not been
released yet, it'd be good to get it fixed before release). We should
mention LTP_NO_CLEANUP in the release notes.

Kind regards,
Petr

Petr Vorel (3):
  lib: Use LTP_ prefix for LTP_ENABLE_DEBUG variable
  lib: Use LTP_ prefix for LTP_NO_CLEANUP variable
  doc: Add info about 'LTP_' and 'TST_' variable prefixes

 doc/C-Test-API.asciidoc          |  2 +-
 doc/User-Guidelines.asciidoc     | 10 +++++++---
 lib/newlib_tests/tst_res_flags.c |  2 +-
 lib/tst_test.c                   |  2 +-
 testcases/lib/test.sh            |  2 +-
 testcases/lib/tst_test.sh        |  2 +-
 6 files changed, 12 insertions(+), 8 deletions(-)

-- 
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH 1/3] lib: Use LTP_ prefix for LTP_ENABLE_DEBUG variable
  2024-01-04 12:23 [LTP] [PATCH 0/3] Cleanup environment variables prefixes Petr Vorel
@ 2024-01-04 12:23 ` Petr Vorel
  2024-01-04 12:23 ` [LTP] [PATCH 2/3] lib: Use LTP_ prefix for LTP_NO_CLEANUP variable Petr Vorel
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2024-01-04 12:23 UTC (permalink / raw)
  To: ltp

Variables which are supposed to be user defined should use LTP_ prefix
instead of TST_ prefix.

Fixes: 018f555a4 ("lib: Add support for TDEBUG tst_res() flag")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 doc/C-Test-API.asciidoc          | 2 +-
 doc/User-Guidelines.asciidoc     | 2 +-
 lib/newlib_tests/tst_res_flags.c | 2 +-
 lib/tst_test.c                   | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/doc/C-Test-API.asciidoc b/doc/C-Test-API.asciidoc
index 979ec5ccf..db16be36e 100644
--- a/doc/C-Test-API.asciidoc
+++ b/doc/C-Test-API.asciidoc
@@ -227,7 +227,7 @@ Printf-like function to report test result, it's mostly used with ttype:
 | 'TPASS'  | Test has passed.
 | 'TFAIL'  | Test has failed.
 | 'TINFO'  | General message.
-| 'TDEBUG' | Debug message (new C API only, printed with '-D' or via 'TST_ENABLE_DEBUG=1' or 'y'
+| 'TDEBUG' | Debug message (new C API only, printed with '-D' or via 'LTP_ENABLE_DEBUG=1' or 'y'
              environment variable), only for messages which would be too verbose for normal run.
 | 'TWARN'  | Something went wrong but we decided to continue. Mostly used in cleanup functions.
 |==============================
diff --git a/doc/User-Guidelines.asciidoc b/doc/User-Guidelines.asciidoc
index 9c6cb2fe7..cff2e83c8 100644
--- a/doc/User-Guidelines.asciidoc
+++ b/doc/User-Guidelines.asciidoc
@@ -41,7 +41,7 @@ For running LTP network tests see `testcases/network/README.md`.
                           and others, which imply it, shell: 'TST_NEEDS_TMPDIR=1').
                           Must be an absolute path (default: '/tmp').
 | 'TST_NO_CLEANUP'      | Disable running test cleanup (defined in 'TST_CLEANUP').
-| 'TST_ENABLE_DEBUG'    | Enable debug info (value '1' or 'y').
+| 'LTP_ENABLE_DEBUG'    | Enable debug info (value '1' or 'y').
 |==============================================================================
 
 
diff --git a/lib/newlib_tests/tst_res_flags.c b/lib/newlib_tests/tst_res_flags.c
index b104808d7..a14f0df2c 100644
--- a/lib/newlib_tests/tst_res_flags.c
+++ b/lib/newlib_tests/tst_res_flags.c
@@ -21,7 +21,7 @@ static struct tcase {
 	{FLAG(TCONF)},
 	{FLAG(TWARN)},
 	{FLAG(TINFO)},
-	{FLAG(TDEBUG), " (printed only with -D or TST_ENABLE_DEBUG=1)"},
+	{FLAG(TDEBUG), " (printed only with -D or LTP_ENABLE_DEBUG=1)"},
 };
 
 static void do_cleanup(void)
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 629610781..bcf2c4555 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -1149,7 +1149,7 @@ static void do_cgroup_requires(void)
 
 static void do_setup(int argc, char *argv[])
 {
-	char *tdebug_env = getenv("TST_ENABLE_DEBUG");
+	char *tdebug_env = getenv("LTP_ENABLE_DEBUG");
 
 	if (!tst_test)
 		tst_brk(TBROK, "No tests to run");
-- 
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [LTP] [PATCH 2/3] lib: Use LTP_ prefix for LTP_NO_CLEANUP variable
  2024-01-04 12:23 [LTP] [PATCH 0/3] Cleanup environment variables prefixes Petr Vorel
  2024-01-04 12:23 ` [LTP] [PATCH 1/3] lib: Use LTP_ prefix for LTP_ENABLE_DEBUG variable Petr Vorel
@ 2024-01-04 12:23 ` Petr Vorel
  2024-01-04 12:23 ` [LTP] [PATCH 3/3] doc: Add info about 'LTP_' and 'TST_' variable prefixes Petr Vorel
  2024-01-05  2:36 ` [LTP] [PATCH 0/3] Cleanup environment variables prefixes Li Wang
  3 siblings, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2024-01-04 12:23 UTC (permalink / raw)
  To: ltp

Variables which are supposed to be user defined should use LTP_ prefix
instead of TST_ prefix.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 doc/User-Guidelines.asciidoc | 3 ++-
 testcases/lib/test.sh        | 2 +-
 testcases/lib/tst_test.sh    | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/doc/User-Guidelines.asciidoc b/doc/User-Guidelines.asciidoc
index cff2e83c8..63081fdea 100644
--- a/doc/User-Guidelines.asciidoc
+++ b/doc/User-Guidelines.asciidoc
@@ -40,7 +40,8 @@ For running LTP network tests see `testcases/network/README.md`.
 | 'TMPDIR'              | Base directory for template directory (C: '.needs_tmpdir = 1'
                           and others, which imply it, shell: 'TST_NEEDS_TMPDIR=1').
                           Must be an absolute path (default: '/tmp').
-| 'TST_NO_CLEANUP'      | Disable running test cleanup (defined in 'TST_CLEANUP').
+| 'LTP_NO_CLEANUP'      | Disable running test cleanup (defined in 'TST_CLEANUP').
+                          Shell API only.
 | 'LTP_ENABLE_DEBUG'    | Enable debug info (value '1' or 'y').
 |==============================================================================
 
diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
index 8947f47c1..d26cf5df0 100644
--- a/testcases/lib/test.sh
+++ b/testcases/lib/test.sh
@@ -108,7 +108,7 @@ tst_require_root()
 
 tst_exit()
 {
-	if [ -n "${TST_CLEANUP:-}" -a -z "${TST_NO_CLEANUP:-}" ]; then
+	if [ -n "${TST_CLEANUP:-}" -a -z "${LTP_NO_CLEANUP:-}" ]; then
 		$TST_CLEANUP
 	fi
 
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index 5f178a1be..98bc13b2c 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -26,7 +26,7 @@ trap "unset _tst_setup_timer_pid; tst_brk TBROK 'test terminated'" TERM
 
 _tst_do_cleanup()
 {
-	if [ -n "$TST_DO_CLEANUP" -a -n "$TST_CLEANUP" -a -z "$TST_NO_CLEANUP" ]; then
+	if [ -n "$TST_DO_CLEANUP" -a -n "$TST_CLEANUP" -a -z "$LTP_NO_CLEANUP" ]; then
 		if command -v $TST_CLEANUP >/dev/null 2>/dev/null; then
 			TST_DO_CLEANUP=
 			$TST_CLEANUP
-- 
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [LTP] [PATCH 3/3] doc: Add info about 'LTP_' and 'TST_' variable prefixes
  2024-01-04 12:23 [LTP] [PATCH 0/3] Cleanup environment variables prefixes Petr Vorel
  2024-01-04 12:23 ` [LTP] [PATCH 1/3] lib: Use LTP_ prefix for LTP_ENABLE_DEBUG variable Petr Vorel
  2024-01-04 12:23 ` [LTP] [PATCH 2/3] lib: Use LTP_ prefix for LTP_NO_CLEANUP variable Petr Vorel
@ 2024-01-04 12:23 ` Petr Vorel
  2024-01-04 17:54   ` Avinesh Kumar
  2024-01-05  2:36 ` [LTP] [PATCH 0/3] Cleanup environment variables prefixes Li Wang
  3 siblings, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2024-01-04 12:23 UTC (permalink / raw)
  To: ltp

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 doc/User-Guidelines.asciidoc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/doc/User-Guidelines.asciidoc b/doc/User-Guidelines.asciidoc
index 63081fdea..9ff9a59e7 100644
--- a/doc/User-Guidelines.asciidoc
+++ b/doc/User-Guidelines.asciidoc
@@ -7,6 +7,10 @@ For running LTP network tests see `testcases/network/README.md`.
 1. Library environment variables
 --------------------------------
 
+Following environment variables are expected to be set by LTP users. Therefore,
+with some exceptions, they have 'LTP_' prefix. Environment variables with 'TST_'
+prefix are used inside LTP shell API and should *not* be set by users.
+
 |==============================================================================
 | 'KCONFIG_PATH'        | The path to the kernel config file, (if not set, it tries
                           the usual paths '/boot/config-RELEASE' or '/proc/config.gz').
@@ -45,7 +49,6 @@ For running LTP network tests see `testcases/network/README.md`.
 | 'LTP_ENABLE_DEBUG'    | Enable debug info (value '1' or 'y').
 |==============================================================================
 
-
 2. Test execution time and timeout
 ----------------------------------
 
-- 
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH 3/3] doc: Add info about 'LTP_' and 'TST_' variable prefixes
  2024-01-04 12:23 ` [LTP] [PATCH 3/3] doc: Add info about 'LTP_' and 'TST_' variable prefixes Petr Vorel
@ 2024-01-04 17:54   ` Avinesh Kumar
  0 siblings, 0 replies; 7+ messages in thread
From: Avinesh Kumar @ 2024-01-04 17:54 UTC (permalink / raw)
  To: ltp

Hi,

Reviewed-by: Avinesh Kumar <akumar@suse.de>
for all the patches.

--
Thanks,
Avinesh



-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH 0/3] Cleanup environment variables prefixes
  2024-01-04 12:23 [LTP] [PATCH 0/3] Cleanup environment variables prefixes Petr Vorel
                   ` (2 preceding siblings ...)
  2024-01-04 12:23 ` [LTP] [PATCH 3/3] doc: Add info about 'LTP_' and 'TST_' variable prefixes Petr Vorel
@ 2024-01-05  2:36 ` Li Wang
  2024-01-05 13:35   ` Petr Vorel
  3 siblings, 1 reply; 7+ messages in thread
From: Li Wang @ 2024-01-05  2:36 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Petr Vorel <pvorel@suse.cz> wrote:

I'd like to get it merged before release (TST_ENABLE_DEBUG has not been
> released yet, it'd be good to get it fixed before release). We should
> mention LTP_NO_CLEANUP in the release notes.
>

+1

Reviewed-by: Li Wang <liwang@redhat.com>


-- 
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH 0/3] Cleanup environment variables prefixes
  2024-01-05  2:36 ` [LTP] [PATCH 0/3] Cleanup environment variables prefixes Li Wang
@ 2024-01-05 13:35   ` Petr Vorel
  0 siblings, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2024-01-05 13:35 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp

Hi Li, Avinesh,

thanks for your review, merged!

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-01-05 13:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-04 12:23 [LTP] [PATCH 0/3] Cleanup environment variables prefixes Petr Vorel
2024-01-04 12:23 ` [LTP] [PATCH 1/3] lib: Use LTP_ prefix for LTP_ENABLE_DEBUG variable Petr Vorel
2024-01-04 12:23 ` [LTP] [PATCH 2/3] lib: Use LTP_ prefix for LTP_NO_CLEANUP variable Petr Vorel
2024-01-04 12:23 ` [LTP] [PATCH 3/3] doc: Add info about 'LTP_' and 'TST_' variable prefixes Petr Vorel
2024-01-04 17:54   ` Avinesh Kumar
2024-01-05  2:36 ` [LTP] [PATCH 0/3] Cleanup environment variables prefixes Li Wang
2024-01-05 13:35   ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox