2 # Copyright 2015 EMC Corp.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are
9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # * Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
15 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 # XXX: need to nest this because of how kyua creates $TMPDIR; otherwise
35 # it will run into EPERM issues later
36 TEST_INPUTS_DIR="${ATF_TMPDIR}/test/inputs"
38 atf_check -e empty -s exit:0 mkdir -m 0777 -p $TEST_INPUTS_DIR
40 atf_check -e empty -s exit:0 mkdir -m 0755 -p a/b
41 atf_check -e empty -s exit:0 ln -s a/b c
42 atf_check -e empty -s exit:0 touch d
43 atf_check -e empty -s exit:0 ln d e
44 atf_check -e empty -s exit:0 touch .f
45 atf_check -e empty -s exit:0 mkdir .g
46 atf_check -e empty -s exit:0 mkfifo h
52 atf_set "require.user" "unprivileged"
59 WITH_A=$PWD/../with_A.out
60 WITHOUT_A=$PWD/../without_A.out
62 atf_check -e empty -o save:$WITH_A -s exit:0 ls -A
63 atf_check -e empty -o save:$WITHOUT_A -s exit:0 ls
70 for dot_path in '\.f' '\.g'; do
71 atf_check -e empty -o not-empty -s exit:0 grep "${dot_path}" \
73 atf_check -e empty -o empty -s not-exit:0 grep "${dot_path}" \
78 atf_test_case A_flag_implied_when_root
79 A_flag_implied_when_root_head()
81 atf_set "descr" "Verify that -A is implied for root"
82 atf_set "require.user" "root"
85 A_flag_implied_when_root_body()
89 WITH_EXPLICIT=$PWD/../with_explicit_A.out
90 WITH_IMPLIED=$PWD/../with_implied_A.out
92 atf_check -e empty -o save:$WITH_EXPLICIT -s exit:0 ls -A
93 atf_check -e empty -o save:$WITH_IMPLIED -s exit:0 ls
95 echo "Explicit -A usage"
97 echo "Implicit -A usage"
100 atf_check_equal "$(cat $WITH_EXPLICIT)" "$(cat $WITH_IMPLIED)"
103 atf_init_test_cases()
106 atf_add_test_case A_flag
107 atf_add_test_case A_flag_implied_when_root