File: test-bug-1.sh

package info (click to toggle)
augeas 0.7.2-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 8,216 kB
  • ctags: 5,097
  • sloc: ansic: 48,281; sh: 11,387; cpp: 624; yacc: 515; ruby: 444; makefile: 319; lex: 198; perl: 27; pascal: 27
file content (36 lines) | stat: -rwxr-xr-x 725 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#! /bin/bash

# Test for bug https://fedorahosted.org/augeas/ticket/1
#
# Check that putting an invalid node into the tree and saving
# leads to failure, and therefore the original file being preserved

root=$abs_top_builddir/build/test-bug-1
file=$root/etc/logrotate.d/test

rm -rf $root
mkdir -p $(dirname $file)

cat > $file <<EOF
myfile {
  weekly
}
EOF
ln $file $file.orig

augtool --nostdinc -I $abs_top_srcdir/lenses -r $root > /dev/null <<EOF
ins invalid before /files/etc/logrotate.d/test/rule
save
EOF

result=$?

if [ $result -eq 0 ] ; then
    echo "augtool succeeded, but should have failed"
    exit 1
fi

if [ ! $file -ef $file.orig ] ; then
    echo "File was changed, but should not have been"
    exit 1
fi