Print this page
12495 findtest is flaky


   8 # A full copy of the text of the CDDL should have accompanied this
   9 # source.  A copy of the CDDL is also available via the Internet at
  10 # http://www.illumos.org/license/CDDL.
  11 #
  12 
  13 #
  14 # Copyright 2020 Joyent, Inc.
  15 #
  16 
  17 #
  18 # Clearly, grossly incomplete.
  19 #
  20 
  21 export LC_ALL=C.UTF-8
  22 
  23 set -o pipefail
  24 unalias -a
  25 
  26 find_prog=/usr/bin/find
  27 find_prog_xpg4=/usr/xpg4/bin/find
  28 find_dir="$(mktemp -d -p /tmp/)"
  29 find_exit=0
  30 





  31 testfind()
  32 {
  33         exp=$1
  34         shift
  35         cmd="$@"
  36 
  37         echo "TEST: $cmd"
  38 
  39         out=$(eval $cmd | tr '\n' ',')
  40 
  41         [[ "$exp" = "$out" ]] || {
  42                 echo "TEST FAILED: $cmd" >&2
  43                 echo "expected: $exp" >&2
  44                 echo "got: $out" >&2
  45                 find_exit=1
  46         }
  47 }
  48 
  49 mkdir -p $find_dir/1
  50 mkdir -p $find_dir/.2




   8 # A full copy of the text of the CDDL should have accompanied this
   9 # source.  A copy of the CDDL is also available via the Internet at
  10 # http://www.illumos.org/license/CDDL.
  11 #
  12 
  13 #
  14 # Copyright 2020 Joyent, Inc.
  15 #
  16 
  17 #
  18 # Clearly, grossly incomplete.
  19 #
  20 
  21 export LC_ALL=C.UTF-8
  22 
  23 set -o pipefail
  24 unalias -a
  25 
  26 find_prog=/usr/bin/find
  27 find_prog_xpg4=/usr/xpg4/bin/find

  28 find_exit=0
  29 
  30 # make sure we don't end in 1 or 2, which breaks the tests
  31 find_dir=/tmp/findtest.$$.dir
  32 
  33 mkdir $find_dir
  34 
  35 testfind()
  36 {
  37         exp=$1
  38         shift
  39         cmd="$@"
  40 
  41         echo "TEST: $cmd"
  42 
  43         out=$(eval $cmd | tr '\n' ',')
  44 
  45         [[ "$exp" = "$out" ]] || {
  46                 echo "TEST FAILED: $cmd" >&2
  47                 echo "expected: $exp" >&2
  48                 echo "got: $out" >&2
  49                 find_exit=1
  50         }
  51 }
  52 
  53 mkdir -p $find_dir/1
  54 mkdir -p $find_dir/.2