cmp_test2.sh (d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf) | cmp_test2.sh (d350e8d795d53dbc58ea428f76355cf5e28f6116) |
---|---|
1# SPDX-License-Identifier: BSD-2-Clause 2# 3# Copyright (c) 2017 Alan Somers 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions 7# are met: 8# 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 27atf_test_case special 28special_head() { 29 atf_set "descr" "Test cmp(1)'s handling of non-regular files" 30} 31special_body() { 32 echo 0123456789abcdef > a 33 echo 0123456789abcdeg > b | 1# SPDX-License-Identifier: BSD-2-Clause 2# 3# Copyright (c) 2017 Alan Somers 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions 7# are met: 8# 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 27atf_test_case special 28special_head() { 29 atf_set "descr" "Test cmp(1)'s handling of non-regular files" 30} 31special_body() { 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" | 34 atf_check -s exit:0 -o empty -e empty cmp a - <a 35 atf_check -s exit:0 -o empty -e empty cmp - a <a 36 atf_check -s exit:1 -o not-empty -e empty cmp a - <b 37 atf_check -s exit:1 -o not-empty -e empty cmp - a <b |
38 | 38 |
39 atf_check -s exit:0 -o empty -e empty -x "cmp a a <&-" | 39 atf_check -s exit:0 -o empty -e empty cmp a a <&- |
40} 41 42atf_test_case symlink 43symlink_head() { 44 atf_set "descr" "Test cmp(1)'s handling of symlinks" 45} 46symlink_body() { 47 echo 0123456789abcdef > a --- 59 unchanged lines hidden (view full) --- 107 108 atf_check -s exit:1 -o ignore cmp -s a b 109 atf_check -s exit:0 cmp -sn 4 a b 110 atf_check -s exit:0 cmp -sn 3 a b 111 atf_check -s exit:1 -o ignore cmp -sn 5 a b 112 113 # Test special, too. The implementation for link is effectively 114 # identical. | 40} 41 42atf_test_case symlink 43symlink_head() { 44 atf_set "descr" "Test cmp(1)'s handling of symlinks" 45} 46symlink_body() { 47 echo 0123456789abcdef > a --- 59 unchanged lines hidden (view full) --- 107 108 atf_check -s exit:1 -o ignore cmp -s a b 109 atf_check -s exit:0 cmp -sn 4 a b 110 atf_check -s exit:0 cmp -sn 3 a b 111 atf_check -s exit:1 -o ignore cmp -sn 5 a b 112 113 # Test special, too. The implementation for link is effectively 114 # identical. |
115 atf_check -s exit:0 -e empty -x "cat a | cmp -sn 4 b -" 116 atf_check -s exit:0 -e empty -x "cat a | cmp -sn 3 b -" 117 atf_check -s exit:1 -o ignore -x "cat a | cmp -sn 5 b -" | 115 atf_check -s exit:0 -e empty cmp -sn 4 b - <a 116 atf_check -s exit:0 -e empty cmp -sn 3 b - <a 117 atf_check -s exit:1 -o ignore cmp -sn 5 b - <a |
118} 119 120atf_test_case bflag 121bflag_head() 122{ 123 atf_set "descr" "Test cmp(1) -b (print bytes)" 124} 125bflag_body() --- 19 unchanged lines hidden --- | 118} 119 120atf_test_case bflag 121bflag_head() 122{ 123 atf_set "descr" "Test cmp(1) -b (print bytes)" 124} 125bflag_body() --- 19 unchanged lines hidden --- |