[augeas-devel] [PATCH] Add test for --autosave in test-save-mode.sh Add test-file.sh and test-file.augtool to test the -f option in augtool.

Raphaël Pinson raphink at gmail.com
Sat Jan 8 10:26:32 UTC 2011


On Fri, Jan 7, 2011 at 11:57 PM, David Lutterkort <lutter at redhat.com> wrote:
> ACK, but remove tests/test-file.sh and tests/test-file.augtool; they
> aren't needed (and test-file.sh is the same as test-get.sh)

Well it does the same augtool request, but using the -f option to test
it. Might not be necessary indeed...


>
> David
>
> On Wed, 2011-01-05 at 13:39 +0100, raphink at gmail.com wrote:
>> From: Raphaël Pinson <raphink at gmail.com>
>>
>> ---
>>  tests/Makefile.am       |    2 +-
>>  tests/test-file.augtool |    2 ++
>>  tests/test-file.sh      |   17 +++++++++++++++++
>>  tests/test-save-mode.sh |   13 +++++++++++++
>>  4 files changed, 33 insertions(+), 1 deletions(-)
>>  create mode 100644 tests/test-file.augtool
>>  create mode 100755 tests/test-file.sh
>>
>> diff --git a/tests/Makefile.am b/tests/Makefile.am
>> index cac16e8..b83fe3e 100644
>> --- a/tests/Makefile.am
>> +++ b/tests/Makefile.am
>> @@ -128,7 +128,7 @@ check_SCRIPTS = \
>>    test-put-symlink.sh test-save-empty.sh test-mv.sh \
>>    test-bug-1.sh test-idempotent.sh test-preserve.sh \
>>    test-events-saved.sh test-save-mode.sh test-unlink-error.sh \
>> -  test-augtool-empty-line.sh
>> +  test-augtool-empty-line.sh test-file.sh
>>
>>  EXTRA_DIST = \
>>    augtest $(AUGTESTS) root lens-test-1 \
>> diff --git a/tests/test-file.augtool b/tests/test-file.augtool
>> new file mode 100644
>> index 0000000..fd6f1ad
>> --- /dev/null
>> +++ b/tests/test-file.augtool
>> @@ -0,0 +1,2 @@
>> +# this is a comment
>> +match '/augeas//error/descendant-or-self::*'
>> diff --git a/tests/test-file.sh b/tests/test-file.sh
>> new file mode 100755
>> index 0000000..95a87dd
>> --- /dev/null
>> +++ b/tests/test-file.sh
>> @@ -0,0 +1,17 @@
>> +#! /bin/bash
>> +
>> +# Check that reading the files in tests/root/ with augtool does not lead to
>> +# any errors
>> +
>> +TOPDIR=$(cd $(dirname $0)/.. && pwd)
>> +[ -n "$abs_top_srcdir" ] || abs_top_srcdir=$TOPDIR
>> +
>> +export AUGEAS_LENS_LIB=$abs_top_srcdir/lenses
>> +export AUGEAS_ROOT=$abs_top_srcdir/tests/root
>> +
>> +errors=$(augtool --nostdinc -f "$abs_top_srcdir/tests/test-file.augtool")
>> +
>> +if [ "x$errors" != "x  (no matches)" ] ; then
>> +    printf "get /augeas//error reported errors:\n%s\n" "$errors"
>> +    exit 1
>> +fi
>> diff --git a/tests/test-save-mode.sh b/tests/test-save-mode.sh
>> index 6a4f220..b9562b7 100755
>> --- a/tests/test-save-mode.sh
>> +++ b/tests/test-save-mode.sh
>> @@ -109,3 +109,16 @@ EOF
>>  assert_ipaddr 127.0.0.2
>>  assert_file_exists_not $hosts.augnew
>>  assert_file_exists $hosts.augsave
>> +
>> +
>> +augopts="${augopts} --autosave"
>> +
>> +setup "autosave"
>> +run_augtool ok <<EOF
>> +set /files/etc/hosts/1/ipaddr 127.0.0.2
>> +EOF
>> +assert_ipaddr 127.0.0.2
>> +assert_file_exists_not $hosts.augnew
>> +assert_file_exists_not $hosts.augsave
>> +
>> +
>> --
>> 1.7.0.4
>>
>> _______________________________________________
>> augeas-devel mailing list
>> augeas-devel at redhat.com
>> https://www.redhat.com/mailman/listinfo/augeas-devel
>
>
>
> _______________________________________________
> augeas-devel mailing list
> augeas-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/augeas-devel
>




More information about the augeas-devel mailing list