tests: fix false failure with disabled SELinux support
[coreutils.git] / tests / split / numeric.sh
blob1fd9b6f5bdeb0400ec26cec5a1d9f3d66bd0b597
1 #!/bin/sh
2 # Show that split --numeric-suffixes[=from] works.
4 # Copyright (C) 2012-2013 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
20 print_ver_ split
22 # Check default start from 0
23 printf '1\n2\n3\n4\n5\n' > in || framework_failure_
24 split --numeric-suffixes --lines=2 in || fail=1
25 cat <<\EOF > exp-1
28 EOF
29 cat <<\EOF > exp-2
32 EOF
33 cat <<\EOF > exp-3
35 EOF
36 compare exp-1 x00 || fail=1
37 compare exp-2 x01 || fail=1
38 compare exp-3 x02 || fail=1
40 # Check --numeric-suffixes=X
41 split --numeric-suffixes=1 --lines=2 in || fail=1
42 cat <<\EOF > exp-1
45 EOF
46 cat <<\EOF > exp-2
49 EOF
50 cat <<\EOF > exp-3
52 EOF
53 compare exp-1 x01 || fail=1
54 compare exp-2 x02 || fail=1
55 compare exp-3 x03 || fail=1
57 # Check that split failed when suffix length is not large enough for
58 # the numerical suffix start value
59 split -a 3 --numeric-suffixes=1000 in 2> /dev/null && fail=1
61 # check invalid --numeric-suffixes start values are flagged
62 split --numeric-suffixes=-1 in 2> /dev/null && fail=1
63 split --numeric-suffixes=one in 2> /dev/null && fail=1
65 Exit $fail