aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/cmp/tests/cmp_test2.sh
Commit message (Collapse)AuthorAgeFilesLines
* Improve reliability of stdout tests.Dag-Erling Smørgrav2024-11-141-0/+1
| | | | | | | | | | | If the test runner is under heavy load, the command we are testing may succeed in printing to stdout before the dummy receiver has terminated. Add a short delay to reduce the likelihood of this happening. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D47572
* cmp: Check the status of stdout.Dag-Erling Smørgrav2024-10-091-0/+30
| | | | | | | | | | POSIX requires us to print an error message and exit non-zero if writing to stdout fails. This can only happen if sflag is unset. MFC after: 3 days Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D47020
* cmp: Style and type issues.Dag-Erling Smørgrav2024-10-091-8/+8
| | | | | | | MFC after: 3 days Sponsored by: Klara, Inc. Reviewed by: 0mp, markj Differential Revision: https://reviews.freebsd.org/D47019
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* cmp: add -b, --print-bytesKyle Evans2021-09-291-0/+17
| | | | | | | | This is compatible with GNU cmp. Reviewed by: bapt, markj (earlier version) Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D32074
* cmp: add -i, --ignore-initial, an alternative to skip1/skip2 argsKyle Evans2021-09-291-0/+5
| | | | | | | | This is compatible with GNU cmp. Reviewed by: markj Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D32073
* cmp: add -n, --bytes to limit number of bytes to compareKyle Evans2021-09-291-0/+23
| | | | | | | | This is compatible with GNU cmp. Reviewed by: markj Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D32072
* cmp: accept SI suffixes for skip1 and skip2Kyle Evans2021-09-291-0/+17
| | | | | | | | This is compatible with GNU cmp. Reviewed by: bapt (earlier version), markj, imp Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D32071
* cmp: fix -s (silent) when used with skip offsetsEd Maste2021-01-111-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | -s causes cmp to print nothing for differing files, for use when only the exit status is of interest. -z compares the file size first, for regular files, and fails the comparison early if they do not match. Prior to this change -s implied -z as an optimization, but this is not valid when file offsets are specified. Now, enable the -z optimization for -s only if both skip arguments are not provided / 0. Note that using -z with differing skip values will currently always fail. We may want to compare size1 - skip1 with size2 - skip2 instaead, and in any case the man page should be clarified. PR: 252542 Fixes: 3e6902efc802ab57fc4e9bf798f2d271b152e7f9 Reported by: William Ahern Reviewed by: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28071
* Drop "All rights reserved" from the files I ownAlan Somers2019-03-111-1/+2
| | | | | | | | | Also, add SPDX tags where needed. MFC after: 2 weeks Notes: svn path=/head/; revision=345034
* Fix handling of rights on stdio streams, take two.Mark Johnston2019-02-251-0/+2
| | | | | | | | | | | | | | | | | | | Split the rights-limiting code into two cases: if one of the input files isn't a regular file, use caph_limit_stream(3) instead of open-coding the same logic; if both input files are regular files, and the initial attempts to map them succeed, we limit the rights on those files to CAP_MMAP_R. Add a regression test for PR 234885. PR: 234885 Reviewed by: delphij MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D19216 Notes: svn path=/head/; revision=344551
* Fix cmp(1) tests for "special" mode.Mark Johnston2019-01-211-5/+4
| | | | | | | | | | | Test failures don't seem to propagate up if atf_check is run in a pipeline. Thus, the tests continued to pass despite the bug reverted in r343245. MFC after: 1 week Notes: svn path=/head/; revision=343247
* Fix file descriptor leaks in cmp(1)Alan Somers2017-01-071-0/+67
Also, add a few test cases Reported by: Coverity CID: 271624 275338 Reviewed by: ngie MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D9074 Notes: svn path=/head/; revision=311572