# # This file and its contents are supplied under the terms of the # Common Development and Distribution License ("CDDL"), version 1.0. # You may only use this file in accordance with the terms of version # 1.0 of the CDDL. # # A full copy of the text of the CDDL should have accompanied this # source. A copy of the CDDL is also available via the Internet at # http://www.illumos.org/license/CDDL. # # Copyright 2020 Joyent, Inc. # Copyright 2024 Bill Sommerfeld # # # Shell functions and definitions common to both find tests. # export LC_ALL=C.UTF-8 set -o pipefail unalias -a find_prog=/usr/bin/find find_prog_xpg4=/usr/xpg4/bin/find find_exit=0 # make sure we don't end in 1 or 2, which breaks the tests find_dir=/var/tmp/findtest.$$.dir testfind() { exp=$1 shift cmd="$@" echo "TEST: $cmd" out=$(eval $cmd | sort | tr '\n' ',') [[ "$exp" == "$out" ]] || { echo "TEST FAILED: $cmd" >&2 echo "expected: $exp" >&2 echo "got: $out" >&2 find_exit=1 } }