From owner-svn-src-head@freebsd.org Sun Mar 12 03:58:55 2017 Return-Path: Delivered-To: svn-src-head@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 70585D08A97; Sun, 12 Mar 2017 03:58:55 +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 42DE81E1C; Sun, 12 Mar 2017 03:58:55 +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 v2C3wsOY029360; Sun, 12 Mar 2017 03:58:54 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2C3wsKW029359; Sun, 12 Mar 2017 03:58:54 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201703120358.v2C3wsKW029359@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 12 Mar 2017 03:58:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315106 - head/usr.bin/xinstall/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Mar 2017 03:58:55 -0000 Author: ngie Date: Sun Mar 12 03:58:54 2017 New Revision: 315106 URL: https://svnweb.freebsd.org/changeset/base/315106 Log: 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. MFC after: 1 week Sponsored by: Dell EMC Isilon Modified: head/usr.bin/xinstall/tests/install_test.sh Modified: head/usr.bin/xinstall/tests/install_test.sh ============================================================================== --- head/usr.bin/xinstall/tests/install_test.sh Sun Mar 12 03:53:41 2017 (r315105) +++ head/usr.bin/xinstall/tests/install_test.sh Sun Mar 12 03:58:54 2017 (r315106) @@ -303,6 +303,69 @@ symbolic_link_relative_body() { 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 mkdir_simple_body() { atf_check install -d dir1/dir2 @@ -349,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 }