blob: 78dfa123033e9f881d144c22159ba88aba5ee663 [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
Denys Vlasenko11775ed2014-12-22 19:37:05 +010013optional FEATURE_FIND_TYPE
Denys Vlasenko6eb0cbe2014-01-09 16:07:11 +010014testing "find -type f" \
15 "cd find.tempdir && find -type f 2>&1" \
16 "./testfile\n" \
17 "" ""
Denys Vlasenko11775ed2014-12-22 19:37:05 +010018SKIP=
Denys Vlasenko6be3a522014-06-19 11:32:11 +020019optional FEATURE_FIND_EXEC
20testing "find -exec exitcode 1" \
21 "cd find.tempdir && find testfile -exec true {} \; 2>&1; echo \$?" \
22 "0\n" \
23 "" ""
24SKIP=
25optional FEATURE_FIND_EXEC_PLUS
26testing "find -exec exitcode 2" \
27 "cd find.tempdir && find testfile -exec true {} + 2>&1; echo \$?" \
28 "0\n" \
29 "" ""
30SKIP=
31# Surprisingly, "-exec false ;" results in exitcode 0! "-exec false +" is different!!!
32optional FEATURE_FIND_EXEC
33testing "find -exec exitcode 3" \
34 "cd find.tempdir && find testfile -exec false {} \; 2>&1; echo \$?" \
35 "0\n" \
36 "" ""
37SKIP=
38optional FEATURE_FIND_EXEC_PLUS
39testing "find -exec exitcode 4" \
40 "cd find.tempdir && find testfile -exec false {} + 2>&1; echo \$?" \
41 "1\n" \
42 "" ""
43SKIP=
44
Denys Vlasenko6eb0cbe2014-01-09 16:07:11 +010045# testing "description" "command" "result" "infile" "stdin"
46
47rm -rf find.tempdir
48
49exit $FAILCOUNT