From owner-svn-src-user@freebsd.org Fri Oct 2 09:03:29 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 E7F16A0EDF2 for ; Fri, 2 Oct 2015 09:03:29 +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 B8E6B1603; Fri, 2 Oct 2015 09:03:29 +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 t9293TUr095694; Fri, 2 Oct 2015 09:03:29 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9293Ttl095693; Fri, 2 Oct 2015 09:03:29 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201510020903.t9293Ttl095693@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 09:03:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r288483 - 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 09:03:30 -0000 Author: ngie Date: Fri Oct 2 09:03:28 2015 New Revision: 288483 URL: https://svnweb.freebsd.org/changeset/base/288483 Log: - Add a testcase for ls -n - Detect errors with find when grabbing the paths for testing ls -p - Be explicit with testing for an exit code of 0 when running ls -dp 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 08:58:50 2015 (r288482) +++ user/ngie/more-tests/bin/ls/tests/ls_tests.sh Fri Oct 2 09:03:28 2015 (r288483) @@ -285,6 +285,26 @@ lcomma_flag_body() env LC_ALL=en_US.ISO8859-1 ls -l, i } +n_flag_head() +{ + atf_set "descr" "Verify that the output from ls -p prints out numeric GIDs/UIDs instead of symbolic GIDs/UIDs" + atf_set "require.user" "root" +} + +n_flag_body() +{ + daemon_gid=$(id -g daemon) || atf_skip "could not resolve gid for daemon (!)" + nobody_uid=$(id -u nobody) || atf_skip "could not resolve uid for nobody (!)" + + atf_check -e empty -o empty -s exit:0 touch a.file + atf_check -e empty -o empty -s exit:0 chown $nobody_uid:$daemon_gid a.file + + atf_check -e empty \ + -o match:'\-rw\-r\-\-r\-\-[[:space:]]+1[[:space:]]+'"$nobody_uid[[:space:]]+$daemon_gid"'[[:space:]]+.+a\.file' \ + ls -ln a.file + +} + p_flag_head() { atf_set "descr" "Verify that the output from ls -p prints out '/' after directories" @@ -294,14 +314,18 @@ p_flag_body() { create_test_inputs - for path in $(find -L .); do + paths=$(find -L .) + [ -n "$paths" ] || atf_skip 'Could not find any paths to iterate over (!)' + + for path in $paths; do suffix= # If path is not a symlink and is a directory, then the suffix # must be "/". if [ ! -L "${path}" -a -d "$path" ]; then suffix=/ fi - atf_check -e empty -o match:"$path${suffix}" ls -dp $path + atf_check -e empty -o match:"$path${suffix}" -s exit:0 \ + ls -dp $path done } @@ -497,7 +521,7 @@ atf_init_test_cases() #atf_add_test_case l_flag atf_add_test_case lcomma_flag #atf_add_test_case m_flag - #atf_add_test_case n_flag + atf_add_test_case n_flag #atf_add_test_case o_flag atf_add_test_case p_flag atf_add_test_case q_flag_and_w_flag