3 # Copyright (C) 2018-2021 Red Hat Inc.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are
9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
12 # * Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
16 # * Neither the name of Red Hat nor the names of its contributors may be
17 # used to endorse or promote products derived from this software without
18 # specific prior written permission.
20 # THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
21 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23 # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
24 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
27 # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30 # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 # Test bad input to the data plugin.
41 # Since this test is expected to fail, valgrind will also fail.
48 # This command is expected to fail.
49 if nbdkit
-U - -fv -D data.AST
=1 data
"$data" --run true
; then
50 echo "$0: data plugin was expected to fail on bad input: $data"
55 # Invalid bytes, numbers and words.
62 bad
'0xffffffffffffffff'
63 bad
'0xffffffffffffffffffffffffffffffff'
65 for prefix
in le16 be16 le32 be32 le64 be64
; do
70 bad
"$prefix:0xffffffffffffffffffffffffffffffff"
75 bad
'le32:0x100000000'
76 bad
'be32:0x100000000'
77 bad
'le64:0x10000000000000000'
78 bad
'be64:0x10000000000000000'
80 # Invalid barewords and symbols.
88 #bad '0x' # should fail but does not XXX
110 # Mismatched parentheses.
143 if [ ! -r /NOFILE
]; then
147 # Unknown and out of scope assignments.
153 bad
'( 0 -> \a \a ) \a'
155 # Currently this should fail. \b subtitutes (0 -> \a) which only
156 # defines \a in the scope, not where it is used outside the scope.
157 # Should we make it work in future?
158 bad
'(0 -> \a) -> \b \b \a'
160 # Unknown variable definition