blob: f041106c3c233b6190eb23348aa803504b222d02 [file] [log] [blame]
Denys Vlasenko6eb0cbe2014-01-09 16:07:11 +01001#!/bin/sh
2
3# Copyright 2014 by Denys Vlasenko <vda.linux@googlemail.com>
4# Licensed under GPLv2, see file LICENSE in this source tree.
5
6. ./testing.sh
7
8# testing "description" "command" "result" "infile" "stdin"
9
10mkdir -p find.tempdir
11touch find.tempdir/testfile
12
13testing "find -type f" \
14 "cd find.tempdir && find -type f 2>&1" \
15 "./testfile\n" \
16 "" ""
17
Denys Vlasenko6be3a522014-06-19 11:32:11 +020018optional FEATURE_FIND_EXEC
19testing "find -exec exitcode 1" \
20 "cd find.tempdir && find testfile -exec true {} \; 2>&1; echo \$?" \
21 "0\n" \
22 "" ""
23SKIP=
24optional FEATURE_FIND_EXEC_PLUS
25testing "find -exec exitcode 2" \
26 "cd find.tempdir && find testfile -exec true {} + 2>&1; echo \$?" \
27 "0\n" \
28 "" ""
29SKIP=
30# Surprisingly, "-exec false ;" results in exitcode 0! "-exec false +" is different!!!
31optional FEATURE_FIND_EXEC
32testing "find -exec exitcode 3" \
33 "cd find.tempdir && find testfile -exec false {} \; 2>&1; echo \$?" \
34 "0\n" \
35 "" ""
36SKIP=
37optional FEATURE_FIND_EXEC_PLUS
38testing "find -exec exitcode 4" \
39 "cd find.tempdir && find testfile -exec false {} + 2>&1; echo \$?" \
40 "1\n" \
41 "" ""
42SKIP=
43
Denys Vlasenko6eb0cbe2014-01-09 16:07:11 +010044# testing "description" "command" "result" "infile" "stdin"
45
46rm -rf find.tempdir
47
48exit $FAILCOUNT