diff mbox series

[ndctl,1/2] test/daxctl-create.sh: use bash math syntax to find available size

Message ID 865e28870eb8c072c2e368362a6d86fc4fb9cb61.1724813664.git.alison.schofield@intel.com
State Accepted
Commit ceb596056aa612b88c4fb9fdebafb531d586ade7
Headers show
Series Use CXL regions in daxctl-create unit test | expand

Commit Message

Alison Schofield Aug. 28, 2024, 3:14 a.m. UTC
From: Alison Schofield <alison.schofield@intel.com>

The check for 1GB of available space in a DAX region always returned
true due to being wrapped inside a [[ ... ]] test, even when space
wasn't available. That caused set size to fail.

Update to use bash arithmetic evaluation instead.

This issue likely went unnoticed because users allocated >= 1GB of
efi_fake_mem. This fix is part of the transition to use CXL regions
in this test as efi_fake_mem support is being removed from the kernel.

Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---
 test/daxctl-create.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Verma, Vishal L Sept. 3, 2024, 9:28 p.m. UTC | #1
On Tue, 2024-08-27 at 20:14 -0700, alison.schofield@intel.com wrote:
> From: Alison Schofield <alison.schofield@intel.com>
> 
> The check for 1GB of available space in a DAX region always returned
> true due to being wrapped inside a [[ ... ]] test, even when space
> wasn't available. That caused set size to fail.
> 
> Update to use bash arithmetic evaluation instead.
> 
> This issue likely went unnoticed because users allocated >= 1GB of
> efi_fake_mem. This fix is part of the transition to use CXL regions
> in this test as efi_fake_mem support is being removed from the
> kernel.
> 
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>
> ---
>  test/daxctl-create.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/test/daxctl-create.sh b/test/daxctl-create.sh
> index c093cb9e306a..d968e7bedd82 100755
> --- a/test/daxctl-create.sh
> +++ b/test/daxctl-create.sh
> @@ -363,7 +363,7 @@ daxctl_test6()
>  
>  	# Use 2M by default or 1G if supported
>  	align=2097152
> -	if [[ $((available >= 1073741824 )) ]]; then
> +	if (( available >= 1073741824 )); then

Yikes, good find!

Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>

>  		align=1073741824
>  		size=$align
>  	fi
diff mbox series

Patch

diff --git a/test/daxctl-create.sh b/test/daxctl-create.sh
index c093cb9e306a..d968e7bedd82 100755
--- a/test/daxctl-create.sh
+++ b/test/daxctl-create.sh
@@ -363,7 +363,7 @@  daxctl_test6()
 
 	# Use 2M by default or 1G if supported
 	align=2097152
-	if [[ $((available >= 1073741824 )) ]]; then
+	if (( available >= 1073741824 )); then
 		align=1073741824
 		size=$align
 	fi