From owner-svn-src-stable@freebsd.org Mon Jul 17 21:01:12 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C1F3DA0AC2; Mon, 17 Jul 2017 21:01:12 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 25EA67143E; Mon, 17 Jul 2017 21:01:12 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6HL1BoM050172; Mon, 17 Jul 2017 21:01:11 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6HL1A9u050167; Mon, 17 Jul 2017 21:01:10 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707172101.v6HL1A9u050167@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 17 Jul 2017 21:01:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321086 - in stable/11: etc/mtree usr.bin/stat usr.bin/stat/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in stable/11: etc/mtree usr.bin/stat usr.bin/stat/tests X-SVN-Commit-Revision: 321086 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Jul 2017 21:01:12 -0000 Author: ngie Date: Mon Jul 17 21:01:10 2017 New Revision: 321086 URL: https://svnweb.freebsd.org/changeset/base/321086 Log: MFC r319834,r319841,r320723,r320724: r319834: Write up some basic tests for readlink(1) The tests exercise -f (f_flag), -n (n_flag), and no arguments (basic). r319841: Add initial tests for stat(1) Testcases for -H, -L, and -f haven't been implemented yet, in part due to additional complexity needed to validate the features: * -H and -f will require an external "helper" program to display/modify the state/permissions for a given path. * -L is being covered partially via the -n testcase today. r320723: Use %e instead of %d with x_output_date(..) stat -x doesn't 0-fill days so %d is inappropriate. %e is correct. MFC with: r319841 r320724: :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 with: r319841 Added: stable/11/usr.bin/stat/tests/ - copied from r319834, head/usr.bin/stat/tests/ stable/11/usr.bin/stat/tests/stat_test.sh - copied, changed from r319841, head/usr.bin/stat/tests/stat_test.sh Modified: stable/11/etc/mtree/BSD.tests.dist stable/11/usr.bin/stat/Makefile stable/11/usr.bin/stat/stat.1 stable/11/usr.bin/stat/tests/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/mtree/BSD.tests.dist ============================================================================== --- stable/11/etc/mtree/BSD.tests.dist Mon Jul 17 21:01:07 2017 (r321085) +++ stable/11/etc/mtree/BSD.tests.dist Mon Jul 17 21:01:10 2017 (r321086) @@ -650,6 +650,8 @@ .. soelim .. + stat + .. tail .. tar Modified: stable/11/usr.bin/stat/Makefile ============================================================================== --- stable/11/usr.bin/stat/Makefile Mon Jul 17 21:01:07 2017 (r321085) +++ stable/11/usr.bin/stat/Makefile Mon Jul 17 21:01:10 2017 (r321086) @@ -1,8 +1,12 @@ # $FreeBSD$ +.include + PROG= stat LINKS= ${BINDIR}/stat ${BINDIR}/readlink MLINKS= stat.1 readlink.1 + +SUBDIR.${MK_TESTS}+= tests .include Modified: stable/11/usr.bin/stat/stat.1 ============================================================================== --- stable/11/usr.bin/stat/stat.1 Mon Jul 17 21:01:07 2017 (r321085) +++ stable/11/usr.bin/stat/stat.1 Mon Jul 17 21:01:10 2017 (r321086) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 22, 2012 +.Dd June 22, 2017 .Dt STAT 1 .Os .Sh NAME Modified: stable/11/usr.bin/stat/tests/Makefile ============================================================================== --- head/usr.bin/stat/tests/Makefile Sun Jun 11 21:13:12 2017 (r319834) +++ stable/11/usr.bin/stat/tests/Makefile Mon Jul 17 21:01:10 2017 (r321086) @@ -1,5 +1,6 @@ # $FreeBSD$ ATF_TESTS_SH+= readlink_test +ATF_TESTS_SH+= stat_test .include Copied and modified: stable/11/usr.bin/stat/tests/stat_test.sh (from r319841, head/usr.bin/stat/tests/stat_test.sh) ============================================================================== --- head/usr.bin/stat/tests/stat_test.sh Mon Jun 12 00:21:55 2017 (r319841, copy source) +++ stable/11/usr.bin/stat/tests/stat_test.sh Mon Jul 17 21:01:10 2017 (r321086) @@ -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 } @@ -165,7 +174,7 @@ t_flag_body() x_output_date() { - local date_format='%a %b %d %H:%M:%S %Y' + local date_format='%a %b %e %H:%M:%S %Y' stat -t "$date_format" "$@" }