]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: standardize perl usage in tests
authorPádraig Brady <P@draigBrady.com>
Sun, 1 Jul 2018 01:50:40 +0000 (18:50 -0700)
committerPádraig Brady <P@draigBrady.com>
Sun, 1 Jul 2018 01:57:43 +0000 (18:57 -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
tests/cp/preserve-gid.sh
tests/du/long-from-unreadable.sh
tests/misc/env-S-script.sh
tests/misc/sort-benchmark-random.sh
tests/rm/deep-2.sh

index 563e2ac51637c7f21341309ef01a87c5dc71c85f..773c99b46d364e75281c7eddd924727cffd55147 100755 (executable)
@@ -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
index cc29e257135b6a8f17af5666f8ff29c4a3a7ea96..fa949dd0d890f548b681e96eea960f84719dd1ef 100755 (executable)
@@ -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.
index 815aba6550eea0df43c3f990d602fe00f4fc1354..5fe4d649b9417075bb7d12c8905318a72bd29f0c 100755 (executable)
@@ -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 "$!" }' \
index 9573e6087fcc62255772871473fd5e4c35425448..3b048d64e0a9de7e7cb70e8c7b36b4cd075cacc5 100755 (executable)
@@ -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.
index 9cff74582e5e8f9de9aa8c1371220ce735cae399..b4290ba2a104c98770f9de8362932939a225f8da 100755 (executable)
 
 . "${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);
index ba68f0c5681a10df8a5bb003c4eb2089cecfbd2b..ba2a04f52758e75c3fc405510e952a9ce2c2d50d 100755 (executable)
@@ -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 "$!" }' \