coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] tests: standardize perl usage in tests


From: Pádraig Brady
Subject: [PATCH] tests: standardize perl usage in tests
Date: Sat, 30 Jun 2018 18:55:52 -0700

* tests/cp/fiemap-FMR.sh: Ensure perl is parameterized to $PERL,
and ensure require_perl_ is used, so tests are skipped appropriately.
* tests/cp/preserve-gid.sh: Likewise.
* tests/du/long-from-unreadable.sh: Likewise.
* tests/misc/env-S-script.sh: Likewise.
* tests/misc/sort-benchmark-random.sh: Likewise.
* tests/rm/deep-2.sh: Likewise.
---
 tests/cp/fiemap-FMR.sh              | 1 -
 tests/cp/preserve-gid.sh            | 1 +
 tests/du/long-from-unreadable.sh    | 3 ++-
 tests/misc/env-S-script.sh          | 5 +++--
 tests/misc/sort-benchmark-random.sh | 5 +++--
 tests/rm/deep-2.sh                  | 1 -
 6 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/tests/cp/fiemap-FMR.sh b/tests/cp/fiemap-FMR.sh
index 563e2ac..773c99b 100755
--- a/tests/cp/fiemap-FMR.sh
+++ b/tests/cp/fiemap-FMR.sh
@@ -21,7 +21,6 @@ print_ver_ cp
 
 require_valgrind_
 require_perl_
-: ${PERL=perl}
 
 $PERL -e 'for (1..600) { sysseek (*STDOUT, 4096, 1)' \
   -e '&& syswrite (*STDOUT, "a" x 1024) or die "$!"}' > j || fail=1
diff --git a/tests/cp/preserve-gid.sh b/tests/cp/preserve-gid.sh
index cc29e25..fa949dd 100755
--- a/tests/cp/preserve-gid.sh
+++ b/tests/cp/preserve-gid.sh
@@ -19,6 +19,7 @@
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ cp
 
+require_perl_
 require_root_
 
 # Some of the tests expect a umask that grants group and/or world read access.
diff --git a/tests/du/long-from-unreadable.sh b/tests/du/long-from-unreadable.sh
index 815aba6..5fe4d64 100755
--- a/tests/du/long-from-unreadable.sh
+++ b/tests/du/long-from-unreadable.sh
@@ -31,6 +31,8 @@
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ du
 
+require_perl_
+
 # ecryptfs for example uses some of the file name space
 # for encrypting filenames, so we must check dynamically.
 name_max=$(stat -f -c %l .)
@@ -58,7 +60,6 @@ dir=$(printf '%200s\n' ' '|tr ' ' x)
 
 cwd=$(pwd)
 # Use perl instead:
-: ${PERL=perl}
 $PERL \
     -e 'my $d = '$dir'; foreach my $i (1..52)' \
     -e '  { mkdir ($d, 0700) && chdir $d or die "$!" }' \
diff --git a/tests/misc/env-S-script.sh b/tests/misc/env-S-script.sh
index 9573e60..3b048d6 100755
--- a/tests/misc/env-S-script.sh
+++ b/tests/misc/env-S-script.sh
@@ -20,6 +20,7 @@
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ env
 print_ver_ printf
+
 require_perl_
 
 # a shortcut to avoid long lines
@@ -118,7 +119,7 @@ compare exp4 out4 || fail=1
 # Ignoring the absolute paths, the script is:
 #     #!env -S perl -w -T
 #     print "hello\n";
-{ printf "#!$dir/env -S perl -w -T\n" ;
+{ printf "#!$dir/env -S $PERL -w -T\n" ;
   printf 'print "hello\\n";\n' ; } > env5 || framework_failure_
 chmod a+x env5 || framework_failure_
 cat<<\EOF>exp5 || framework_failure_
@@ -134,7 +135,7 @@ compare exp5 out5 || fail=1
 # The backslash before the '$' is required to prevent env(1) from treating
 # $ARGV as an (invalid syntax) envvar, and pass it as-is to Perl.
 { printf "#!$dir/env -S " ;
-  printf 'perl -mFile::Basename=basename -e ' ;
+  printf "$PERL -mFile::Basename=basename -e " ;
   printf '"print basename(\\$ARGV[0]);"\n' ; } > env6 || framework_failure_
 chmod a+x env6 || framework_failure_
 # Note: the perl script does not output a newline.
diff --git a/tests/misc/sort-benchmark-random.sh 
b/tests/misc/sort-benchmark-random.sh
index 9cff745..b4290ba 100755
--- a/tests/misc/sort-benchmark-random.sh
+++ b/tests/misc/sort-benchmark-random.sh
@@ -20,10 +20,11 @@
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ sort
+require_perl_
 
 very_expensive_
 
-perl -e '
+$PERL -e '
 my $num_lines = 500000;
 my $length = 100;
 
@@ -39,7 +40,7 @@ for (my $i=0; $i < $num_lines; $i++)
 # We need to generate a lot of data for sort to show a noticeable
 # improvement in performance. Sorting it in PERL may take awhile.
 
-perl -e '
+$PERL -e '
 open (FILE, "<in");
 my @list = <FILE>;
 print sort(@list);
diff --git a/tests/rm/deep-2.sh b/tests/rm/deep-2.sh
index ba68f0c..ba2a04f 100755
--- a/tests/rm/deep-2.sh
+++ b/tests/rm/deep-2.sh
@@ -34,7 +34,6 @@ mkdir x || framework_failure_
 cd x || framework_failure_
 
 # Construct a hierarchy containing a relative file with a long name
-: ${PERL=perl}
 $PERL \
     -e 'my $d = "x" x 200; foreach my $i (1..52)' \
     -e '  { mkdir ($d, 0700) && chdir $d or die "$!" }' \
-- 
2.9.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]