Bump to 1.14.1
[platform/upstream/augeas.git] / tests / test-bug-1.sh
1 #!/bin/sh
2
3 # Test for bug https://fedorahosted.org/augeas/ticket/1
4 #
5 # Check that putting an invalid node into the tree and saving
6 # leads to failure, and therefore the original file being preserved
7
8 root=$abs_top_builddir/build/test-bug-1
9 file=$root/etc/logrotate.d/test
10
11 rm -rf $root
12 mkdir -p $(dirname $file)
13
14 cat > $file <<EOF
15 /myfile {
16   size=5M
17 }
18 EOF
19 ln $file $file.orig
20
21 augtool --nostdinc -I $abs_top_srcdir/lenses -r $root > /dev/null <<EOF
22 ins invalid before /files/etc/logrotate.d/rpm/rule[1]
23 save
24 EOF
25
26 result=$?
27
28 if [ $result -eq 0 ] ; then
29     echo "augtool succeeded, but should have failed"
30     exit 1
31 fi
32
33 if [ ! $file -ef $file.orig ] ; then
34     echo "File was changed, but should not have been"
35     exit 1
36 fi