]>
git.ipfire.org Git - thirdparty/util-linux.git/blob - tests/ts/misc/line
3 # This file is part of util-linux.
5 # This file is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This file is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 TS_TOPDIR
="${0%/*}/../.."
18 .
$TS_TOPDIR/functions.sh
21 ts_check_test_command
"$TS_CMD_LINE"
22 ts_check_test_command
"$TS_CMD_HEXDUMP"
24 ts_log
'# usually behave like "head -n 1"'
26 $TS_CMD_LINE >> $TS_OUTPUT 2>> $TS_ERRLOG
27 echo "ret: $?" >> $TS_OUTPUT
29 ts_log
'# never consume more than one line'
31 ($TS_CMD_LINE && $TS_CMD_LINE) >> $TS_OUTPUT 2>> $TS_ERRLOG
32 echo "ret: $?" >> $TS_OUTPUT
34 ts_log
'# add a newline'
36 $TS_CMD_LINE >> $TS_OUTPUT 2>> $TS_ERRLOG
37 echo "ret: $?" >> $TS_OUTPUT
39 ts_log
'# print one newline on empty input'
41 $TS_CMD_LINE >> $TS_OUTPUT 2>> $TS_ERRLOG
42 echo "ret: $?" >> $TS_OUTPUT
44 ts_log
'# add a newline, return 1 when EOF'
45 (printf "xyz" && cat </dev
/null
) |
46 $TS_CMD_LINE >> $TS_OUTPUT 2>> $TS_ERRLOG
47 echo "ret: $?" >> $TS_OUTPUT
49 ts_log
'# print one newline on empty input, return 1 when EOF'
50 $TS_CMD_LINE </dev
/null
>> $TS_OUTPUT 2>> $TS_ERRLOG
51 echo "ret: $?" >> $TS_OUTPUT
53 ts_log
'# large line of zero bytes'
54 dd if=/dev
/zero bs
=1k count
=1k
2>/dev
/null |
55 $TS_CMD_LINE line |
$TS_CMD_HEXDUMP -C >> $TS_OUTPUT 2>> $TS_ERRLOG
56 echo "ret: $?" >> $TS_OUTPUT