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 cat a | atf_check -s exit:0 cmp a -
35 cat a | atf_check -s exit:0 cmp - a
36 cat b | atf_check -s not-exit:0 cmp a -
37 cat b | atf_check -s not-exit:0 cmp - a
43 atf_set "descr" "Test cmp(1)'s handling of symlinks"
46 echo 0123456789abcdef > a
47 echo 0123456789abcdeg > b
53 atf_check -s exit:0 cmp a a.lnk
54 atf_check -s exit:0 cmp a.lnk a
55 atf_check -s not-exit:0 -o ignore cmp a b.lnk
56 atf_check -s not-exit:0 -o ignore cmp b.lnk a
57 atf_check -s not-exit:0 -o ignore -e ignore cmp -h a a.lnk
58 atf_check -s not-exit:0 -o ignore -e ignore cmp -h a.lnk a
59 atf_check -s exit:0 cmp -h a.lnk a2.lnk
60 atf_check -s not-exit:0 -o ignore -e ignore cmp -h a.lnk adup.lnk
65 atf_add_test_case special
66 atf_add_test_case symlink