Print this page
12495 findtest is flaky
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/test/util-tests/tests/find/findtest.ksh
+++ new/usr/src/test/util-tests/tests/find/findtest.ksh
1 1 #!/bin/ksh
2 2 #
3 3 # This file and its contents are supplied under the terms of the
4 4 # Common Development and Distribution License ("CDDL"), version 1.0.
5 5 # You may only use this file in accordance with the terms of version
6 6 # 1.0 of the CDDL.
7 7 #
8 8 # A full copy of the text of the CDDL should have accompanied this
9 9 # source. A copy of the CDDL is also available via the Internet at
10 10 # http://www.illumos.org/license/CDDL.
11 11 #
12 12
13 13 #
14 14 # Copyright 2020 Joyent, Inc.
15 15 #
16 16
17 17 #
↓ open down ↓ |
17 lines elided |
↑ open up ↑ |
18 18 # Clearly, grossly incomplete.
19 19 #
20 20
21 21 export LC_ALL=C.UTF-8
22 22
23 23 set -o pipefail
24 24 unalias -a
25 25
26 26 find_prog=/usr/bin/find
27 27 find_prog_xpg4=/usr/xpg4/bin/find
28 -find_dir="$(mktemp -d -p /tmp/)"
29 28 find_exit=0
30 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 +
31 35 testfind()
32 36 {
33 37 exp=$1
34 38 shift
35 39 cmd="$@"
36 40
37 41 echo "TEST: $cmd"
38 42
39 43 out=$(eval $cmd | tr '\n' ',')
40 44
41 45 [[ "$exp" = "$out" ]] || {
42 46 echo "TEST FAILED: $cmd" >&2
43 47 echo "expected: $exp" >&2
44 48 echo "got: $out" >&2
45 49 find_exit=1
46 50 }
47 51 }
48 52
49 53 mkdir -p $find_dir/1
50 54 mkdir -p $find_dir/.2
51 55 touch $find_dir/.2/1
52 56 touch $find_dir/.2/c
53 57
54 58 testfind "$find_dir/1,$find_dir/.2/1," \
55 59 $find_prog $find_dir -name \"1\"
56 60 testfind "$find_dir/1,$find_dir/.2/1," \
57 61 $find_prog $find_dir -path \"*1\"
58 62
59 63 cd $find_dir
60 64
61 65 testfind "" $find_prog . -name \"*2\"
62 66 testfind "./.2," $find_prog_xpg4 . -name \"*2\"
63 67 testfind "./.2," $find_prog . -name \".*2\"
64 68 testfind "./.2," $find_prog_xpg4 . -name \".*2\"
65 69 testfind "./1,./.2/1," $find_prog . -path \"*1\"
66 70 testfind "./.2," $find_prog . -path \"*2\"
67 71 testfind "./.2,./.2/1,./.2/c," $find_prog . -path \"*2*\"
68 72
69 73 cd -
70 74 rm -rf $find_dir
71 75
72 76 exit $find_exit
↓ open down ↓ |
32 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX