From owner-svn-src-user@freebsd.org Fri Oct 2 07:26:25 2015 Return-Path: Delivered-To: svn-src-user@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 E8EA6A0E50B for ; Fri, 2 Oct 2015 07:26:25 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::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 BFC421F29; Fri, 2 Oct 2015 07:26:25 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t927QPLP054542; Fri, 2 Oct 2015 07:26:25 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t927QPMJ054541; Fri, 2 Oct 2015 07:26:25 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201510020726.t927QPMJ054541@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 2 Oct 2015 07:26:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r288479 - user/ngie/more-tests/bin/ls/tests X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 07:26:26 -0000 Author: ngie Date: Fri Oct 2 07:26:24 2015 New Revision: 288479 URL: https://svnweb.freebsd.org/changeset/base/288479 Log: Add ls -t testcases Use sync instead of sleep Modified: user/ngie/more-tests/bin/ls/tests/ls_tests.sh Modified: user/ngie/more-tests/bin/ls/tests/ls_tests.sh ============================================================================== --- user/ngie/more-tests/bin/ls/tests/ls_tests.sh Fri Oct 2 07:06:26 2015 (r288478) +++ user/ngie/more-tests/bin/ls/tests/ls_tests.sh Fri Oct 2 07:26:24 2015 (r288479) @@ -304,9 +304,34 @@ q_flag_and_w_flag_body() atf_check -e empty -o match:"$test_file" -s exit:0 ls -w "$test_file" } +t_flag_head() +{ + atf_set "descr" "Verify that the output from ls -u sorts by last access with -t" +} + +t_flag_body() +{ + create_test_dir + + atf_check -e empty -o empty -s exit:0 touch a.file + sync + atf_check -e empty -o empty -s exit:0 touch b.file + sync + + atf_check -e empty -o match:'a\.file' -s exit:0 sh -c 'ls -lt | tail -n 1' + atf_check -e empty -o match:'b\.file.*a\.file' -s exit:0 ls -Ct + + atf_check -e empty -o empty -s exit:0 rm a.file + atf_check -e empty -o empty -s exit:0 sh -c 'echo "i am a" > a.file' + sync + + atf_check -e empty -o match:'b\.file' -s exit:0 sh -c 'ls -lt | tail -n 1' + atf_check -e empty -o match:'a\.file.*b\.file' -s exit:0 ls -Ct +} + u_flag_head() { - atf_set "descr" "Verify that the output from ls -u sorts by last access with -l and -t" + atf_set "descr" "Verify that the output from ls -u sorts by last access" } u_flag_body() @@ -314,17 +339,17 @@ u_flag_body() create_test_dir atf_check -e empty -o empty -s exit:0 touch a.file - sleep 0.3 + sync atf_check -e empty -o empty -s exit:0 touch b.file - sleep 0.3 + sync atf_check -e empty -o match:'b\.file' -s exit:0 sh -c 'ls -lu | tail -n 1' atf_check -e empty -o match:'a\.file.*b\.file' -s exit:0 ls -Cu atf_check -e empty -o empty -s exit:0 sh -c 'echo "i am a" > a.file' - sleep 0.3 + sync atf_check -e empty -o match:'i am a' -s exit:0 cat a.file - sleep 0.3 + sync atf_check -e empty -o match:'b\.file' -s exit:0 sh -c 'ls -lu | tail -n 1' atf_check -e empty -o match:'a\.file.*b\.file' -s exit:0 ls -Cu @@ -437,7 +462,7 @@ atf_init_test_cases() atf_add_test_case q_flag_and_w_flag #atf_add_test_case r_flag #atf_add_test_case s_flag - #atf_add_test_case t_flag + atf_add_test_case t_flag atf_add_test_case u_flag atf_add_test_case x_flag atf_add_test_case y_flag