]> git.ipfire.org Git - thirdparty/util-linux.git/blob - tests/ts/rename/exit_codes
tests: improve unbuffer check
[thirdparty/util-linux.git] / tests / ts / rename / exit_codes
1 #!/bin/bash
2
3 #
4 # Copyright (C) 2014 Sami Kerola <kerolasa@iki.fi>
5 #
6 # This file is part of util-linux.
7 #
8 # This file is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
12 #
13 # This file is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17 #
18 TS_TOPDIR="${0%/*}/../.."
19 TS_DESC="exit codes"
20
21 . $TS_TOPDIR/functions.sh
22 ts_init "$*"
23
24 ts_check_test_command "$TS_CMD_RENAME"
25
26 ts_cd "$TS_OUTDIR"
27
28 touch rename_exit_codes.{1..2}
29 $TS_CMD_RENAME -v not_a_match impossible rename_exit_codes.? >> $TS_OUTPUT 2>&1
30 echo "RENAME_EXIT_NOTHING: $?" >> $TS_OUTPUT
31
32 $TS_CMD_RENAME -v codes values rename_exit_codes.? >> $TS_OUTPUT 2>&1
33 echo "EXIT_SUCCESS: $?" >> $TS_OUTPUT
34
35 mkdir rename_exit_codes.2
36 ts_run --unbuffered $TS_CMD_RENAME -v values codes rename_exit_values.? >> $TS_OUTPUT 2>&1
37 echo "RENAME_EXIT_SOMEOK: $?" >> $TS_OUTPUT
38
39 rmdir rename_exit_codes.2
40 rm rename_exit_codes.? rename_exit_values.?
41
42 ts_finalize