1 # Copyright (c) 2017 Alan Somers
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions
7 # 1. Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer.
9 # 2. Redistributions in binary form must reproduce the above copyright
10 # notice, this list of conditions and the following disclaimer in the
11 # documentation and/or other materials provided with the distribution.
13 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
14 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
15 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
17 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23 # POSSIBILITY OF SUCH DAMAGE.
29 atf_set "descr" "Test cmp(1)'s handling of non-regular files"
32 echo 0123456789abcdef > a
33 echo 0123456789abcdeg > b
34 atf_check -s exit:0 -o empty -e empty -x "cat a | cmp a -"
35 atf_check -s exit:0 -o empty -e empty -x "cat a | cmp - a"
36 atf_check -s exit:1 -o not-empty -e empty -x "cat b | cmp a -"
37 atf_check -s exit:1 -o not-empty -e empty -x "cat b | cmp - a"
39 atf_check -s exit:0 -o empty -e empty -x "cmp a a <&-"
44 atf_set "descr" "Test cmp(1)'s handling of symlinks"
47 echo 0123456789abcdef > a
48 echo 0123456789abcdeg > b
54 atf_check -s exit:0 cmp a a.lnk
55 atf_check -s exit:0 cmp a.lnk a
56 atf_check -s not-exit:0 -o ignore cmp a b.lnk
57 atf_check -s not-exit:0 -o ignore cmp b.lnk a
58 atf_check -s not-exit:0 -o ignore -e ignore cmp -h a a.lnk
59 atf_check -s not-exit:0 -o ignore -e ignore cmp -h a.lnk a
60 atf_check -s exit:0 cmp -h a.lnk a2.lnk
61 atf_check -s not-exit:0 -o ignore -e ignore cmp -h a.lnk adup.lnk
66 atf_add_test_case special
67 atf_add_test_case symlink