diff mbox series

tests: replace perl usage with shell built-in

Message ID 1520880705-8205-1-git-send-email-adilger@dilger.ca
State Superseded, archived
Headers show
Series tests: replace perl usage with shell built-in | expand

Commit Message

Andreas Dilger March 12, 2018, 6:51 p.m. UTC
A couple of tests use perl only for generating a string of N characters
long.  Instead, expand an environment variable to the required length.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
---
 tests/d_xattr_sorting/script   | 3 +--
 tests/f_create_symlinks/script | 8 +++++---
 2 files changed, 6 insertions(+), 5 deletions(-)

Comments

Andreas Dilger March 12, 2018, 7:10 p.m. UTC | #1
On Mar 12, 2018, at 12:51 PM, Andreas Dilger <adilger@dilger.ca> wrote:
> 
> A couple of tests use perl only for generating a string of N characters
> long.  Instead, expand an environment variable to the required length.

Sorry, this one didn't work...

> Signed-off-by: Andreas Dilger <adilger@dilger.ca>
> ---
> tests/d_xattr_sorting/script   | 3 +--
> tests/f_create_symlinks/script | 8 +++++---
> 2 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/d_xattr_sorting/script b/tests/d_xattr_sorting/script
> index 459a66a..f581c36 100644
> --- a/tests/d_xattr_sorting/script
> +++ b/tests/d_xattr_sorting/script
> @@ -19,8 +19,7 @@ echo Exit status is $status >> $OUT
> 
> B=$(mktemp ${TMPDIR:-/tmp}/b.XXXXXX)
> 
> -perl -e 'print "x" x 256;' > $B
> -
> +B="xxxxxxxx"; B+=$B; B+=$B; B+=$B; B+=$B; B+=$B
> echo "ea_set -f /tmp/b / security.SMEG64" > $OUT.new
> $DEBUGFS -w -R "ea_set -f $B / security.SMEG64" $TMPFILE >> $OUT.new 2>&1
> status=$?
> diff --git a/tests/f_create_symlinks/script b/tests/f_create_symlinks/script
> index 779d92e..1d10d32 100644
> --- a/tests/f_create_symlinks/script
> +++ b/tests/f_create_symlinks/script
> @@ -23,11 +23,13 @@ echo Exit status is $status >> $OUT.new
> sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
> rm -f $OUT.new
> 
> +B="xxxxxxx"; B+=$B; B+=$B; B+=$B; B+=$B; B+=$B; B+=$B; B+=$B; B+=$B
> for i in 30 70 500 1023 1024 1500; do
> -	echo "debugfs -R \"symlink /l_$i /$(perl -e "print 'x' x $i;")\" test.img" >> $OUT
> -	$DEBUGFS -w -R "symlink /l_$i /$(perl -e "print 'x' x $i;")" $TMPFILE \
> -		 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT
> +	echo "debugfs -R \"symlink /l_$i /${B:1:i}\" test.img" >> $OUT
> +	$DEBUGFS -w -R "symlink /l_$i /${B:1:i}" $TMPFILE 2>&1 |
> +		sed -f $cmd_dir/filter.sed >> $OUT
> done
> +unset B
> 
> for i in 30 70 500 1023 1024 1500; do
> 	echo "debugfs -R \"stat /l_$i\" test.img" >> $OUT
> --
> 1.8.0
> 


Cheers, Andreas
diff mbox series

Patch

diff --git a/tests/d_xattr_sorting/script b/tests/d_xattr_sorting/script
index 459a66a..f581c36 100644
--- a/tests/d_xattr_sorting/script
+++ b/tests/d_xattr_sorting/script
@@ -19,8 +19,7 @@  echo Exit status is $status >> $OUT
 
 B=$(mktemp ${TMPDIR:-/tmp}/b.XXXXXX)
 
-perl -e 'print "x" x 256;' > $B
-
+B="xxxxxxxx"; B+=$B; B+=$B; B+=$B; B+=$B; B+=$B
 echo "ea_set -f /tmp/b / security.SMEG64" > $OUT.new
 $DEBUGFS -w -R "ea_set -f $B / security.SMEG64" $TMPFILE >> $OUT.new 2>&1
 status=$?
diff --git a/tests/f_create_symlinks/script b/tests/f_create_symlinks/script
index 779d92e..1d10d32 100644
--- a/tests/f_create_symlinks/script
+++ b/tests/f_create_symlinks/script
@@ -23,11 +23,13 @@  echo Exit status is $status >> $OUT.new
 sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
 rm -f $OUT.new
 
+B="xxxxxxx"; B+=$B; B+=$B; B+=$B; B+=$B; B+=$B; B+=$B; B+=$B; B+=$B
 for i in 30 70 500 1023 1024 1500; do
-	echo "debugfs -R \"symlink /l_$i /$(perl -e "print 'x' x $i;")\" test.img" >> $OUT
-	$DEBUGFS -w -R "symlink /l_$i /$(perl -e "print 'x' x $i;")" $TMPFILE \
-		 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT
+	echo "debugfs -R \"symlink /l_$i /${B:1:i}\" test.img" >> $OUT
+	$DEBUGFS -w -R "symlink /l_$i /${B:1:i}" $TMPFILE 2>&1 |
+		sed -f $cmd_dir/filter.sed >> $OUT
 done
+unset B
 
 for i in 30 70 500 1023 1024 1500; do
 	echo "debugfs -R \"stat /l_$i\" test.img" >> $OUT