5 TOPDIR=$(cd $(dirname $0)/.. && pwd)
6 [ -n "$abs_top_srcdir" ] || abs_top_srcdir=$TOPDIR
8 export AUGEAS_LENS_LIB=$abs_top_srcdir/lenses
9 export AUGEAS_ROOT=$abs_top_srcdir/tests/root
17 if [ "$1" != "$2" ]; then
23 # print the tree for /etc/exports
24 act=$(augmatch /etc/exports)
25 assert_eq 23 $(echo "$act" | wc -l) "t1: expected 23 lines of output"
27 # show only the entry for a specific mount
28 act=$(augmatch -m 'dir["/home"]' /etc/exports)
29 assert_eq 9 $(echo "$act" | wc -l) "t2: expected 9 lines of output"
31 # show all the clients to which we are exporting /home
32 act=$(augmatch -eom 'dir["/home"]/client' /etc/exports)
33 exp=$(printf "207.46.0.0/16\n192.168.50.2/32\n")
34 assert_eq "$exp" "$act" "t3: expected '$exp'"
36 # report errors with exit code 2
37 augmatch -m '**' /etc/exports >/dev/null 2>&1
39 assert_eq 2 $ret "t4: expected exit code 2 but got $ret"
41 augmatch /etc >/dev/null 2>&1
43 assert_eq 2 $ret "t5: expected exit code 2 but got $ret"
46 act=$(augmatch -q -m "dir['/local']" /etc/exports)
48 assert_eq '' "$act" "t6: expected no output"
49 assert_eq 0 $ret "t6: expected exit code 0 but got $ret"
51 act=$(augmatch -q -m "dir['/not_there']" /etc/exports)
53 assert_eq '' "$act" "t7: expected no output"
54 assert_eq 1 $ret "t7: expected exit code 1 but got $ret"