Debian Codegraph @

tests/shell/testcases/include/0009glob_nofile_1

raw
1 #!/bin/bash
2
3 # When not using wildcards, not having any match is an error.
4
5 set -e
6
7 tmpdir=$(mktemp -d)
8 if [ ! -d $tmpdir ] ; then
9 echo "Failed to create tmp directory" >&2
10 exit 0
11 fi
12
13 # remove the directory
14 rmdir $tmpdir
15
16 tmpfile1=$(mktemp)
17 if [ ! -w $tmpfile1 ] ; then
18 echo "Failed to create tmp file" >&2
19 exit 0
20 fi
21
22 # cleanup if aborted
23 trap "rm -rf $tmpfile1" EXIT
24
25 RULESET1="include \"$tmpdir/non_existent_file.nft\""
26
27 echo "$RULESET1" > $tmpfile1
28
29 $NFT -f $tmpfile1 || exit 0
30 echo "E: Failed to catch a missing include directory/file" >&2
31 exit 1