[LTP] [PATCH 4/4] lib: Improve doc related to $TMPDIR default value

Petr Vorel pvorel@suse.cz
Wed Feb 7 17:06:28 CET 2024


Link C and shell API related parts to $TMPDIR.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 include/tst_defaults.h    | 5 +++--
 testcases/lib/tst_test.sh | 2 ++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/tst_defaults.h b/include/tst_defaults.h
index 083427b7e..e3eb6f587 100644
--- a/include/tst_defaults.h
+++ b/include/tst_defaults.h
@@ -7,9 +7,10 @@
 #define TST_DEFAULTS_H_
 
 /*
- * This is the default temporary directory used by tst_tmpdir().
+ * This is the default temporary directory used by tst_tmpdir(),
+ * used when TMPDIR env variable is not set.
  *
- * This is used when TMPDIR env variable is not set.
+ * If changed, update also shell API in tst_test.sh.
  */
 #define TEMPDIR	"/tmp"
 
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index 20bf21660..760a49061 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -735,6 +735,8 @@ tst_run()
 
 	if [ "$TST_NEEDS_TMPDIR" = 1 ]; then
 		if [ -z "$TMPDIR" ]; then
+			# default value if TMPDIR not set.
+			# If changed, update also C API in tst_defaults.h.
 			_tst_tmpdir="/tmp"
 			export TMPDIR="$_tst_tmpdir"
 		else
-- 
2.43.0



More information about the ltp mailing list