From owner-svn-src-stable-11@freebsd.org Mon Mar 20 02:58:07 2017 Return-Path: Delivered-To: svn-src-stable-11@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 66801D14497; Mon, 20 Mar 2017 02:58:07 +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 24B211B33; Mon, 20 Mar 2017 02:58:07 +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 v2K2w6Dh074193; Mon, 20 Mar 2017 02:58:06 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2K2w6WL074192; Mon, 20 Mar 2017 02:58:06 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201703200258.v2K2w6WL074192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 20 Mar 2017 02:58:06 +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: r315604 - stable/11/usr.bin/xinstall/tests X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Mar 2017 02:58:07 -0000 Author: ngie Date: Mon Mar 20 02:58:05 2017 New Revision: 315604 URL: https://svnweb.freebsd.org/changeset/base/315604 Log: MFC r315098,r315106,r315108: r315098: Clarify src vs dest path mismatch in :symbolic_link_{absolute,relative}_body Unfortunately kyua does not omit the path mismatch on failure, so it must be coded into the error message. Cache the values, run the test(1) call, then print out the values in an atf_fail call to emit the required diagnostics to debug why things are failing. r315106: Add 3 more testcases demonstrating how install -l sr works The additional testcases use absolute paths for sources and targets, as the other testcase which tested `-l sr` used flat relative paths in the same directory. Please note that these testcases do not test `-l a` -- that's already addressed in the battery of tests. r315108: Restore some of the error message text accidentally removed in r315098 "unexpected symlink contents" is more pedantically correct than "unexpected symlink". Modified: stable/11/usr.bin/xinstall/tests/install_test.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/xinstall/tests/install_test.sh ============================================================================== --- stable/11/usr.bin/xinstall/tests/install_test.sh Mon Mar 20 02:47:28 2017 (r315603) +++ stable/11/usr.bin/xinstall/tests/install_test.sh Mon Mar 20 02:58:05 2017 (r315604) @@ -283,7 +283,11 @@ symbolic_link_absolute_body() { atf_check install -l sa testf copyf [ testf -ef copyf ] || atf_fail "not same file" [ -L copyf ] || atf_fail "copy is not symlink" - [ "$(readlink copyf)" = "$(pwd -P)/testf" ] || atf_fail "unexpected symlink contents" + copyf_path=$(readlink copyf) + testf_path="$(pwd -P)/testf" + if [ "$copyf_path" != "$testf_path" ]; then + atf_fail "unexpected symlink contents ('$copyf_path' != '$testf_path')" + fi } atf_test_case symbolic_link_relative @@ -292,7 +296,74 @@ symbolic_link_relative_body() { atf_check install -l sr testf copyf [ testf -ef copyf ] || atf_fail "not same file" [ -L copyf ] || atf_fail "copy is not symlink" - [ "$(readlink copyf)" = "testf" ] || atf_fail "unexpected symlink contents" + copyf_path=$(readlink copyf) + testf_path="testf" + if [ "$copyf_path" != "$testf_path" ]; then + atf_fail "unexpected symlink contents ('$copyf_path' != '$testf_path')" + fi +} + +atf_test_case symbolic_link_relative_absolute_source_and_dest1 +symbolic_link_relative_absolute_source_and_dest1_head() { + atf_set "descr" "Verify -l rs with absolute paths (.../copyf -> .../a/b/c/testf)" +} +symbolic_link_relative_absolute_source_and_dest1_body() { + src_path=a/b/c/testf + src_path_prefixed=$PWD/$src_path + dest_path=$PWD/copyf + + atf_check mkdir -p a/b/c + atf_check touch $src_path + atf_check install -l sr $src_path_prefixed $dest_path + [ $src_path_prefixed -ef $dest_path ] || atf_fail "not same file" + [ -L $dest_path ] || atf_fail "copy is not symlink" + dest_path_relative=$(readlink $dest_path) + src_path_relative="$src_path" + if [ "$src_path_relative" != "$dest_path_relative" ]; then + atf_fail "unexpected symlink contents ('$src_path_relative' != '$dest_path_relative')" + fi +} + +atf_test_case symbolic_link_relative_absolute_source_and_dest1_double_slash +symbolic_link_relative_absolute_source_and_dest1_double_slash_head() { + atf_set "descr" "Verify -l rs with absolute paths (.../copyf -> .../a/b/c/testf), using double-slashes" +} +symbolic_link_relative_absolute_source_and_dest1_double_slash_body() { + src_path=a//b//c//testf + src_path_prefixed=$PWD/$src_path + dest_path=$PWD/copyf + + atf_check mkdir -p a/b/c + atf_check touch $src_path + atf_check install -l sr $src_path_prefixed $dest_path + [ $src_path_prefixed -ef $dest_path ] || atf_fail "not same file" + [ -L $dest_path ] || atf_fail "copy is not symlink" + dest_path_relative=$(readlink $dest_path) + src_path_relative="$(echo $src_path | sed -e 's,//,/,g')" + if [ "$src_path_relative" != "$dest_path_relative" ]; then + atf_fail "unexpected symlink contents ('$src_path_relative' != '$dest_path_relative')" + fi +} + +atf_test_case symbolic_link_relative_absolute_source_and_dest2 +symbolic_link_relative_absolute_source_and_dest2_head() { + atf_set "descr" "Verify -l rs with absolute paths (.../a/b/c/copyf -> .../testf)" +} +symbolic_link_relative_absolute_source_and_dest2_body() { + src_path=testf + src_path_prefixed=$PWD/$src_path + dest_path=$PWD/a/b/c/copyf + + atf_check mkdir -p a/b/c + atf_check touch $src_path + atf_check install -l sr $src_path_prefixed $dest_path + [ $src_path_prefixed -ef $dest_path ] || atf_fail "not same file" + [ -L $dest_path ] || atf_fail "copy is not symlink" + dest_path_relative=$(readlink $dest_path) + src_path_relative="../../../$src_path" + if [ "$src_path_relative" != "$dest_path_relative" ]; then + atf_fail "unexpected symlink contents ('$src_path_relative' != '$dest_path_relative')" + fi } atf_test_case mkdir_simple @@ -341,5 +412,8 @@ atf_init_test_cases() { atf_add_test_case symbolic_link atf_add_test_case symbolic_link_absolute atf_add_test_case symbolic_link_relative + atf_add_test_case symbolic_link_relative_absolute_source_and_dest1 + atf_add_test_case symbolic_link_relative_absolute_source_and_dest1_double_slash + atf_add_test_case symbolic_link_relative_absolute_source_and_dest2 atf_add_test_case mkdir_simple }