Imported Upstream version 1.6.0
[platform/upstream/augeas.git] / src / try
1 #! /bin/bash
2
3 topdir=$(cd $(dirname $0)/.. && pwd)
4 export AUGEAS_LENS_LIB=${topdir}/lenses
5 export AUGEAS_ROOT=${topdir}/build/try
6
7 AUGCMDS=${topdir}/build/augcmds.txt
8 GDBCMDS=${topdir}/build/gdbcmds.txt
9
10 rm -rf $AUGEAS_ROOT
11 cp -pr ${topdir}/tests/root $AUGEAS_ROOT
12 find $AUGEAS_ROOT -name \*.augnew\* | xargs -r rm
13
14 if [[ ! -f $AUGCMDS ]] ; then
15     cat > $AUGCMDS <<EOF
16 match /augeas/version
17 EOF
18 fi
19
20 if [[ ! -f $GDBCMDS ]] ; then
21     cat > $GDBCMDS <<EOF
22 run --nostdinc -I $AUGEAS_LENS_LIB -r $AUGEAS_ROOT < $AUGCMDS
23 EOF
24 fi
25
26 cd $topdir/src
27 if [[ "x$1" == "xgdb" ]] ; then
28     [[ -n "$EMACS" ]] && int="-i=mi"
29     exec libtool --mode=execute gdb $int -x $GDBCMDS ./augtool
30 elif [[ "x$1" == "xstrace" ]] ; then
31     libtool --mode=execute /usr/bin/strace ./augtool --nostdinc < $AUGCMDS
32 elif [[ "x$1" == "xvalgrind" ]] ; then
33     libtool --mode=execute valgrind --leak-check=full ./augtool --nostdinc < $AUGCMDS
34 elif [[ "x$1" == "xcallgrind" ]] ; then
35     libtool --mode=execute valgrind --tool=callgrind ./augtool --nostdinc < $AUGCMDS
36 elif [[ "x$1" == "xcli" ]] ; then
37     shift
38     exec ./augtool --nostdinc "$@"
39 else
40     ./augtool --nostdinc "$@" < $AUGCMDS
41     echo
42     for f in $(find $AUGEAS_ROOT -name \*.augnew); do
43         echo "File $f"
44         diff -u ${f%.augnew} $f
45     done
46 fi