From ed66391a6ed0ccb07adda753137b5220565c2aac Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Mon, 12 Jun 2017 16:38:37 +0000 Subject: [PATCH] Add a testcase for `ln -sF` The testcase fails today, so mark it with atf_expect_fail: in particular, the target (B) isn't being unlinked and the documentation doesn't suggest special handling for directories. Thus, there's either a doc or an implementation bug in ln(1) that needs to be resolved. MFC after: 1 month MFC with: r319714, r319854, r319855 PR: 219943 Reviewed by: ngie Submitted by: shivansh Differential Revision: D11159 (part of a larger diff) Sponsored by: Google, Inc (GSoC 2017) --- bin/ln/tests/ln_test.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/bin/ln/tests/ln_test.sh b/bin/ln/tests/ln_test.sh index b671e4144782..3e76f82eeb4c 100644 --- a/bin/ln/tests/ln_test.sh +++ b/bin/ln/tests/ln_test.sh @@ -150,6 +150,22 @@ snf_flag_dir_body() atf_check -o inline:'B\n' readlink C } +atf_test_case sF_flag +sF_flag_head() +{ + atf_set "descr" "Verify that if the target file already exists " \ + "and is a directory, then '-sF' option removes " \ + "it so that the link may occur" +} + +sF_flag_body() +{ + atf_expect_fail "B isn't being unlinked (bug 219943)" + atf_check mkdir A B + atf_check ln -sF A B + atf_check -o inline:'Symbolic Link\n' stat -f %SHT B +} + atf_test_case sf_flag sf_flag_head() { @@ -220,6 +236,7 @@ atf_init_test_cases() atf_add_test_case target_exists_symbolic atf_add_test_case shf_flag_dir atf_add_test_case snf_flag_dir + atf_add_test_case sF_flag atf_add_test_case sf_flag atf_add_test_case s_flag atf_add_test_case s_flag_broken