3 # Test that we report an error when writing to nonexistent dirs
4 # but that we do create new files correctly
7 opts="--nostdinc -r $ROOT -I $abs_top_srcdir/lenses"
8 (augtool $opts | grep ^/augeas) <<EOF
9 set /files/etc/hosts/1/ipaddr 127.0.0.1
10 set /files/etc/hosts/1/canonical localhost
12 print /augeas/files/etc/hosts/error
18 /augeas/files/etc/hosts/error = "mk_augtemp"
19 /augeas/files/etc/hosts/error/message = "No such file or directory"
23 ROOT=$abs_top_builddir/build/test-save-empty
29 EXPECTED=$(expected_errors)
31 if [ "$ACTUAL" != "$EXPECTED" ]
33 echo "No error on missing /etc directory:"
40 if [ -n "$ACTUAL" ] ; then
41 echo "Error creating file:"
46 if [ ! -f $HOSTS ] ; then
47 echo "File ${HOSTS} was not created"
51 printf '127.0.0.1\tlocalhost\n' > $HOSTS.expected
53 if ! cmp $HOSTS $HOSTS.expected > /dev/null 2>&1 ; then
54 echo "Contents of $HOSTS are incorrect"