From 45b8c6cf6916cf012ad0512f9cf249c152b45236 Mon Sep 17 00:00:00 2001 From: Jian Yu Date: Thu, 6 Jul 2017 23:16:06 -0700 Subject: [PATCH] =?utf8?q?LU-9663=20tests:=20replace=20=E2=80=9Cls=20-s?= =?utf8?q?=E2=80=9D=20with=20=E2=80=9Cstat=20-c=20'%s'=E2=80=9D=20to=20get?= =?utf8?q?=20file=20size?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch improves acl/2561{,_zfs}.test to use “stat -c '%s'” to get file size instead of using “ls -s”, which prints the allocated size of the file in blocks. Test-Parameters: trivial \ envdefinitions=ONLY=103 \ mdtfilesystemtype=zfs ostfilesystemtype=zfs \ testlist=sanity Change-Id: I8bfea5197102baeece244e20731c90172c5cc2f1 Signed-off-by: Jian Yu Reviewed-on: https://review.whamcloud.com/27961 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Fan Yong --- lustre/tests/acl/2561.test | 4 ++-- lustre/tests/acl/2561_zfs.test | 4 ++-- lustre/tests/acl/run | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lustre/tests/acl/2561.test b/lustre/tests/acl/2561.test index 073d1a0..ac38131 100644 --- a/lustre/tests/acl/2561.test +++ b/lustre/tests/acl/2561.test @@ -4,8 +4,8 @@ LU-2561 newly created file is same size as directory $ cd 2561 $ getfacl --access . | setfacl -d -M- . $ touch f1 - $ ls -s f1 - > 0 f1 + $ stat -c '%s' f1 + > 0 $ cd .. $ rm -rf 2561 diff --git a/lustre/tests/acl/2561_zfs.test b/lustre/tests/acl/2561_zfs.test index 8ab0657..ac38131 100644 --- a/lustre/tests/acl/2561_zfs.test +++ b/lustre/tests/acl/2561_zfs.test @@ -4,8 +4,8 @@ LU-2561 newly created file is same size as directory $ cd 2561 $ getfacl --access . | setfacl -d -M- . $ touch f1 - $ ls -s f1 - > 1 f1 + $ stat -c '%s' f1 + > 0 $ cd .. $ rm -rf 2561 diff --git a/lustre/tests/acl/run b/lustre/tests/acl/run index 6a86c22..ffffd5a 100755 --- a/lustre/tests/acl/run +++ b/lustre/tests/acl/run @@ -42,7 +42,7 @@ if (!defined($ARGV[0])) { open($testfile, $ARGV[0]) or die "Can't open file $ARGV[0]: $!"; for (;;) { my $line = <$testfile>; $line_number++; - if (defined $line) { + if (defined $line && $line !~ /\%s/) { # Substitute %VAR and %{VAR} with environment variables. $line =~ s[%(?:(\w+)|\{(\w+)\})][$ENV{"$1$2"}]eg; } -- 1.8.3.1