Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Jul 2017 07:37:03 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r320724 - head/usr.bin/stat/tests
Message-ID:  <201707060737.v667b3LC068075@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Thu Jul  6 07:37:03 2017
New Revision: 320724
URL: https://svnweb.freebsd.org/changeset/base/320724

Log:
  :l_flag:: be more aggressive when normalizing whitespace
  
  Save output from ls -ldT and stat -l, then normalize all repeating whitespace using
  sed to single column spaces.
  
  This makes the test flexible with single-digit days, etc, similar to r320723. This
  approach is just a bit more of a hammer approach because of how the columns are
  ordered/spaced in both ls and stat.
  
  MFC after:	1 week
  MFC with:	r319841

Modified:
  head/usr.bin/stat/tests/stat_test.sh

Modified: head/usr.bin/stat/tests/stat_test.sh
==============================================================================
--- head/usr.bin/stat/tests/stat_test.sh	Thu Jul  6 06:15:44 2017	(r320723)
+++ head/usr.bin/stat/tests/stat_test.sh	Thu Jul  6 07:37:03 2017	(r320724)
@@ -60,14 +60,23 @@ l_flag_body()
 
 	paths="a b c d"
 
+	ls_out=ls.output
+	stat_out=stat.output
+
 	# NOTE:
 	# - Even though stat -l claims to be equivalent to `ls -lT`, the
 	#   whitespace is a bit more liberal in the `ls -lT` output.
 	# - `ls -ldT` is used to not recursively list the contents of
 	#   directories.
 	for path in $paths; do
-		atf_check -o inline:"$(ls -ldT $path | sed -e 's,  , ,g')\n" \
-		    stat -l $path
+		atf_check -o save:$ls_out ls -ldT $path
+		cat $ls_out
+		atf_check -o save:$stat_out stat -l $path
+		cat $stat_out
+		echo "Comparing normalized whitespace"
+		atf_check sed -i '' -E -e 's/[[:space:]]+/ /g' $ls_out
+		atf_check sed -i '' -E -e 's/[[:space:]]+/ /g' $stat_out
+		atf_check cmp $ls_out $stat_out
 	done
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707060737.v667b3LC068075>