Debian Codegraph @

tests/datamash-io-errors-cheap.sh

raw
1 #!/bin/sh
2
3 # Unit Tests for GNU Datamash - simple I/O error simulation
4
5 # Copyright (C) 2022 Erik Auerswald <[email protected]>
6 #
7 # This file is part of GNU Datamash.
8 #
9 # GNU Datamash is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # GNU Datamash is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with GNU Datamash. If not, see <https://www.gnu.org/licenses/>.
21 #
22 # Written by Erik Auerswald,
23 # based on datamash-io-errors.sh written by Assaf Gordon
24
25 ##
26 ## This script tests GNU Datamash's handling of basic I/O errors.
27 ##
28
29 . "${test_dir=.}/init.sh"; path_prepend_ ./src
30
31 fail=0
32
33 ##
34 ## This test requires the special file /dev/full
35 ##
36 test -w /dev/full || skip_ 'requires writable /dev/full'
37
38 ## Test 1: output error
39 echo 0 | datamash -g 1 count 1 > /dev/full &&
40 { warn_ "datamash failed to detect no-space error" ; fail=1 ; }
41
42 Exit $fail