Imported Upstream version 4.5.14
[platform/upstream/findutils.git] / find / testsuite / find.gnu / sv-bug-24169.exp
1 # Bug report by Joey Hess.
2 #
3 # The command:
4 #   find -neweraa
5 # is not valid because there is a missing argument.
6 # The result should be a clean exit with nonzero status.
7 # However, it segfaults in 4.4.0.
8 #
9
10 global FTSFIND
11 if {[which $FTSFIND] == 0} then {
12     error "$FTSFIND, program does not exist"
13     exit 1
14 }
15
16 set scriptname [info script]
17 set testbase [file rootname $scriptname]
18 set test [file tail $testbase]
19 set testname "$test.generic"
20
21 set cmd "$FTSFIND -neweraa"
22 set expected 1
23
24 send_log "$cmd\n"
25 eval spawn -noecho $cmd
26 expect {
27     eof { set result [wait] }
28 }
29 send_log "result is '$result'\n"
30 if { [ lindex $result 2 ] == 0  } then {
31     set status [ lindex $result 3]
32     if { [llength $result] > 4 } then {
33         if { [lindex $result 4] == "CHILDKILLED" } then {
34             fail "$testname, $cmd was killed: [lrange $result 5 end]"
35         } else {
36             unresolved "$testname, $cmd had unexpected extended status $result"
37         }
38     } else {
39         if { $status != 1 } then {
40             unresolved "$testname, $cmd had unexpected status $status"
41         } else {
42             pass "$testname"
43         }
44     }
45 } else {
46     unresolved "$testname, failed to run $cmd"
47 }