public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/1] prepare_lvm.sh: Use $TMPDIR instead of custom $LVM_DIR
@ 2025-10-16  8:35 Petr Vorel
  2025-10-16  8:49 ` Martin Doucha
  0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2025-10-16  8:35 UTC (permalink / raw)
  To: ltp

Allow users to reuse TMPDIR environment variable instead of forcing them
to export LVM_DIR, which would behave the same as TMPDIR.

LVM_DIR is undocumented users expect TMPDIR.

Fixes: 0838220f25 ("prepare_lvm.sh: Allow to define tmp directory")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Hi,

it was me who introduced LVM_DIR, but thinking about it twice it was not
a good idea.

Kind regards,
Petr

 testcases/misc/lvm/cleanup_lvm.sh          | 8 ++++----
 testcases/misc/lvm/generate_lvm_runfile.sh | 4 ++--
 testcases/misc/lvm/prepare_lvm.sh          | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/testcases/misc/lvm/cleanup_lvm.sh b/testcases/misc/lvm/cleanup_lvm.sh
index f05289f008..b098359e1a 100755
--- a/testcases/misc/lvm/cleanup_lvm.sh
+++ b/testcases/misc/lvm/cleanup_lvm.sh
@@ -8,9 +8,9 @@ TST_TESTFUNC=cleanup_lvm
 TST_NEEDS_ROOT=1
 TST_NEEDS_CMDS="losetup umount vgremove"
 
-LVM_DIR="${LVM_DIR:-/tmp}"
-LVM_TMPDIR="$LVM_DIR/ltp/growfiles"
-LVM_IMGDIR="$LVM_DIR/ltp/imgfiles"
+TMPDIR="${TMPDIR:-/tmp}"
+LVM_TMPDIR="$TMPDIR/ltp/growfiles"
+LVM_IMGDIR="$TMPDIR/ltp/imgfiles"
 
 cleanup_lvm()
 {
@@ -27,7 +27,7 @@ cleanup_lvm()
 		ROD tst_device release $devname
 	done
 
-	rm -rf $LVM_DIR/ltp
+	rm -rf $TMPDIR/ltp
 	tst_res TPASS "LVM configuration for LTP removed successfully."
 }
 
diff --git a/testcases/misc/lvm/generate_lvm_runfile.sh b/testcases/misc/lvm/generate_lvm_runfile.sh
index 7f7e149d94..c95c4b880e 100755
--- a/testcases/misc/lvm/generate_lvm_runfile.sh
+++ b/testcases/misc/lvm/generate_lvm_runfile.sh
@@ -9,8 +9,8 @@ TST_TESTFUNC=generate_runfile
 TST_NEEDS_ROOT=1
 TST_NEEDS_CMDS="sed"
 
-LVM_DIR="${LVM_DIR:-/tmp}"
-LVM_TMPDIR="$LVM_DIR/ltp/growfiles"
+TMPDIR="${TMPDIR:-/tmp}"
+LVM_TMPDIR="$TMPDIR/ltp/growfiles"
 
 generate_runfile()
 {
diff --git a/testcases/misc/lvm/prepare_lvm.sh b/testcases/misc/lvm/prepare_lvm.sh
index 29f386df83..2ac844b0db 100755
--- a/testcases/misc/lvm/prepare_lvm.sh
+++ b/testcases/misc/lvm/prepare_lvm.sh
@@ -8,9 +8,9 @@ TST_TESTFUNC=prepare_lvm
 TST_NEEDS_ROOT=1
 TST_NEEDS_CMDS="mount pvcreate vgcreate lvcreate"
 
-LVM_DIR="${LVM_DIR:-/tmp}"
-LVM_TMPDIR="$LVM_DIR/ltp/growfiles"
-LVM_IMGDIR="$LVM_DIR/ltp/imgfiles"
+TMPDIR="${TMPDIR:-/tmp}"
+LVM_TMPDIR="$TMPDIR/ltp/growfiles"
+LVM_IMGDIR="$TMPDIR/ltp/imgfiles"
 
 error_check()
 {
-- 
2.51.0


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

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

* Re: [LTP] [PATCH 1/1] prepare_lvm.sh: Use $TMPDIR instead of custom $LVM_DIR
  2025-10-16  8:35 [LTP] [PATCH 1/1] prepare_lvm.sh: Use $TMPDIR instead of custom $LVM_DIR Petr Vorel
@ 2025-10-16  8:49 ` Martin Doucha
  2025-10-16  8:53   ` Petr Vorel
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Doucha @ 2025-10-16  8:49 UTC (permalink / raw)
  To: Petr Vorel, ltp

Hi,
I still think there's a valid use case for creating the LVM backing 
files on a different path than TMPDIR because they can be huge. But 
LVM_DIR should default to TMPDIR if not explicitly set. So how about this?

TMPDIR="${TMPDIR:-/tmp}"
LVM_DIR="${LVM_DIR:-$TMPDIR}"

On 10/16/25 10:35, Petr Vorel wrote:
> Allow users to reuse TMPDIR environment variable instead of forcing them
> to export LVM_DIR, which would behave the same as TMPDIR.
> 
> LVM_DIR is undocumented users expect TMPDIR.
> 
> Fixes: 0838220f25 ("prepare_lvm.sh: Allow to define tmp directory")
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> Hi,
> 
> it was me who introduced LVM_DIR, but thinking about it twice it was not
> a good idea.
> 
> Kind regards,
> Petr
> 
>   testcases/misc/lvm/cleanup_lvm.sh          | 8 ++++----
>   testcases/misc/lvm/generate_lvm_runfile.sh | 4 ++--
>   testcases/misc/lvm/prepare_lvm.sh          | 6 +++---
>   3 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/testcases/misc/lvm/cleanup_lvm.sh b/testcases/misc/lvm/cleanup_lvm.sh
> index f05289f008..b098359e1a 100755
> --- a/testcases/misc/lvm/cleanup_lvm.sh
> +++ b/testcases/misc/lvm/cleanup_lvm.sh
> @@ -8,9 +8,9 @@ TST_TESTFUNC=cleanup_lvm
>   TST_NEEDS_ROOT=1
>   TST_NEEDS_CMDS="losetup umount vgremove"
>   
> -LVM_DIR="${LVM_DIR:-/tmp}"
> -LVM_TMPDIR="$LVM_DIR/ltp/growfiles"
> -LVM_IMGDIR="$LVM_DIR/ltp/imgfiles"
> +TMPDIR="${TMPDIR:-/tmp}"
> +LVM_TMPDIR="$TMPDIR/ltp/growfiles"
> +LVM_IMGDIR="$TMPDIR/ltp/imgfiles"
>   
>   cleanup_lvm()
>   {
> @@ -27,7 +27,7 @@ cleanup_lvm()
>   		ROD tst_device release $devname
>   	done
>   
> -	rm -rf $LVM_DIR/ltp
> +	rm -rf $TMPDIR/ltp
>   	tst_res TPASS "LVM configuration for LTP removed successfully."
>   }
>   
> diff --git a/testcases/misc/lvm/generate_lvm_runfile.sh b/testcases/misc/lvm/generate_lvm_runfile.sh
> index 7f7e149d94..c95c4b880e 100755
> --- a/testcases/misc/lvm/generate_lvm_runfile.sh
> +++ b/testcases/misc/lvm/generate_lvm_runfile.sh
> @@ -9,8 +9,8 @@ TST_TESTFUNC=generate_runfile
>   TST_NEEDS_ROOT=1
>   TST_NEEDS_CMDS="sed"
>   
> -LVM_DIR="${LVM_DIR:-/tmp}"
> -LVM_TMPDIR="$LVM_DIR/ltp/growfiles"
> +TMPDIR="${TMPDIR:-/tmp}"
> +LVM_TMPDIR="$TMPDIR/ltp/growfiles"
>   
>   generate_runfile()
>   {
> diff --git a/testcases/misc/lvm/prepare_lvm.sh b/testcases/misc/lvm/prepare_lvm.sh
> index 29f386df83..2ac844b0db 100755
> --- a/testcases/misc/lvm/prepare_lvm.sh
> +++ b/testcases/misc/lvm/prepare_lvm.sh
> @@ -8,9 +8,9 @@ TST_TESTFUNC=prepare_lvm
>   TST_NEEDS_ROOT=1
>   TST_NEEDS_CMDS="mount pvcreate vgcreate lvcreate"
>   
> -LVM_DIR="${LVM_DIR:-/tmp}"
> -LVM_TMPDIR="$LVM_DIR/ltp/growfiles"
> -LVM_IMGDIR="$LVM_DIR/ltp/imgfiles"
> +TMPDIR="${TMPDIR:-/tmp}"
> +LVM_TMPDIR="$TMPDIR/ltp/growfiles"
> +LVM_IMGDIR="$TMPDIR/ltp/imgfiles"
>   
>   error_check()
>   {


-- 
Martin Doucha   mdoucha@suse.cz
SW Quality Engineer
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic

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

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

* Re: [LTP] [PATCH 1/1] prepare_lvm.sh: Use $TMPDIR instead of custom $LVM_DIR
  2025-10-16  8:49 ` Martin Doucha
@ 2025-10-16  8:53   ` Petr Vorel
  0 siblings, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2025-10-16  8:53 UTC (permalink / raw)
  To: Martin Doucha; +Cc: ltp

> Hi,
> I still think there's a valid use case for creating the LVM backing files on
> a different path than TMPDIR because they can be huge. But LVM_DIR should
> default to TMPDIR if not explicitly set. So how about this?

> TMPDIR="${TMPDIR:-/tmp}"
> LVM_DIR="${LVM_DIR:-$TMPDIR}"

Thanks for your review, Martin.
Make sense. And it will be backward compatible.
I'll send v2.

Kind regards,
Petr

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

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

end of thread, other threads:[~2025-10-16  8:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-16  8:35 [LTP] [PATCH 1/1] prepare_lvm.sh: Use $TMPDIR instead of custom $LVM_DIR Petr Vorel
2025-10-16  8:49 ` Martin Doucha
2025-10-16  8:53   ` Petr Vorel

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